]> git.baikalelectronics.ru Git - kernel.git/commit
fs: Push mnt_want_write() outside of i_mutex
authorJan Kara <jack@suse.cz>
Tue, 12 Jun 2012 14:20:30 +0000 (16:20 +0200)
committerAl Viro <viro@zeniv.linux.org.uk>
Mon, 30 Jul 2012 21:02:49 +0000 (01:02 +0400)
commitf584ff7ae1044e74a956db4693ed9b27e79e064e
tree2a643a825fb91a1ae48c5673a9f5fcba891b6122
parent2d8073d88f150e7ceae4c1023f1f2b770ae4448d
fs: Push mnt_want_write() outside of i_mutex

Currently, mnt_want_write() is sometimes called with i_mutex held and sometimes
without it. This isn't really a problem because mnt_want_write() is a
non-blocking operation (essentially has a trylock semantics) but when the
function starts to handle also frozen filesystems, it will get a full lock
semantics and thus proper lock ordering has to be established. So move
all mnt_want_write() calls outside of i_mutex.

One non-trivial case needing conversion is kern_path_create() /
user_path_create() which didn't include mnt_want_write() but now needs to
because it acquires i_mutex.  Because there are virtual file systems which
don't bother with freeze / remount-ro protection we actually provide both
versions of the function - one which calls mnt_want_write() and one which does
not.

[AV: scratch the previous, mnt_want_write() has been moved to kern_path_create()
by now]

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/namei.c