If multiple threads read a file with the same file handle, then the
kernel could return the same data twice, it can skip blocks,...:
- the file pointer is read at the beginning of do_generic_file_read()
- multiple threads can be running within do_generic_file_read()
- the file pointer is updated at the end of do_generic_file_read().

Is someone working on a fix for this problem?


And: what about using the new rw-semaphores for the inode semaphore?
generic_file_write() currently acquires the inode semaphore but:

- this prevents multiple concurrent write operations, this might be a
big disadvantage for databases which are stored in normal files
(postgres?)
- IIRC the down(&i_sem) is only required to protect against concurrent
sys_ftruncate() and to protect the file pointer.

--> everyone grabs the inode semaphore "write", and generic_file_write()
grabs it "read".

Reply via email to