diff options
author | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2014-12-10 15:54:34 -0800 |
---|---|---|
committer | Jiri Slaby <jslaby@suse.cz> | 2015-01-26 14:39:04 +0100 |
commit | bd15ad4f51c047fddaa073bf461a5e09e28b640d (patch) | |
tree | eecb922b6d411a7d62ebe84400e0fa9507cbb518 /scripts | |
parent | a3c563629b22bdf1fc61a294dcc345d341f41e9e (diff) |
nilfs2: fix the nilfs_iget() vs. nilfs_new_inode() races
commit 705304a863cc41585508c0f476f6d3ec28cf7e00 upstream.
Same story as in commit 41080b5a2401 ("nfsd race fixes: ext2") (similar
ext2 fix) except that nilfs2 needs to use insert_inode_locked4() instead
of insert_inode_locked() and a bug of a check for dead inodes needs to
be fixed.
If nilfs_iget() is called from nfsd after nilfs_new_inode() calls
insert_inode_locked4(), nilfs_iget() will wait for unlock_new_inode() at
the end of nilfs_mkdir()/nilfs_create()/etc to unlock the inode.
If nilfs_iget() is called before nilfs_new_inode() calls
insert_inode_locked4(), it will create an in-core inode and read its
data from the on-disk inode. But, nilfs_iget() will find i_nlink equals
zero and fail at nilfs_read_inode_common(), which will lead it to call
iget_failed() and cleanly fail.
However, this sanity check doesn't work as expected for reused on-disk
inodes because they leave a non-zero value in i_mode field and it
hinders the test of i_nlink. This patch also fixes the issue by
removing the test on i_mode that nilfs2 doesn't need.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Diffstat (limited to 'scripts')
0 files changed, 0 insertions, 0 deletions