Description (everything for ext2):
sys_write() calls generic_file_write() without acquiring the big kernel
lock, and generic_file_write() uses f_pos and i_size without any locks.
Note that O_APPEND is broken as well, and this might be the larger problem.
My only idea is quite ugly, so I hope someone has a better solution:
2 new fields in every inode: a linked list (contains all operations
currently executing on the inode) and a wait queue (for all
collisions).
Note that currently do_truncate() acquires inode->i_sem before calling
i_op->truncate, but I don't see why. (sys_open(O_TRUNC) truncates
a file, but it doesn't acquire the inode semaphore.)
Btw, I think that the lock_kernel()-call in sys_lseek() is superflous:
sys_lseek accesses the same fields as sys_write(), but sys_write()
does not acquire the big kernel lock.
Manfred
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/