提交 866707fc 编写于 作者: J Jan Blunck 提交者: Linus Torvalds

Documentation/filesystems/Locking: update documentation on llseek() wrt BKL

The inode's i_size is not protected by the big kernel lock.  Therefore it
does not make sense to recommend taking the BKL in filesystems llseek
operations.  Instead it should use the inode's mutex or use just use
i_size_read() instead.  Add a note that this is not protecting
file->f_pos.
Signed-off-by: NJan Blunck <jblunck@suse.de>
Acked-by: NAlan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: John Kacur <jkacur@redhat.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 ca572727
...@@ -429,8 +429,9 @@ check_flags: no ...@@ -429,8 +429,9 @@ check_flags: no
implementations. If your fs is not using generic_file_llseek, you implementations. If your fs is not using generic_file_llseek, you
need to acquire and release the appropriate locks in your ->llseek(). need to acquire and release the appropriate locks in your ->llseek().
For many filesystems, it is probably safe to acquire the inode For many filesystems, it is probably safe to acquire the inode
mutex. Note some filesystems (i.e. remote ones) provide no mutex or just to use i_size_read() instead.
protection for i_size so you will need to use the BKL. Note: this does not protect the file->f_pos against concurrent modifications
since this is something the userspace has to take care about.
Note: ext2_release() was *the* source of contention on fs-intensive Note: ext2_release() was *the* source of contention on fs-intensive
loads and dropping BKL on ->release() helps to get rid of that (we still loads and dropping BKL on ->release() helps to get rid of that (we still
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册