• J
    fs: Push mnt_want_write() outside of i_mutex · c30dabfe
    Jan Kara 提交于
    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: NJan Kara <jack@suse.cz>
    Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
    c30dabfe
namei.c 97.0 KB