diff options
| author | Wu Fengguang <[email protected]> | 2009-06-16 15:33:17 -0700 |
|---|---|---|
| committer | Linus Torvalds <[email protected]> | 2009-06-16 19:47:45 -0700 |
| commit | 84a892456046921a40646114deed65e2df93a1bc (patch) | |
| tree | 2639b6031e55988b8780960c023618c381d61c55 /include/linux | |
| parent | 81236810226f71bd9ff77321c8e8276dae7efc61 (diff) | |
writeback: skip new or to-be-freed inodes
1) I_FREEING tests should be coupled with I_CLEAR
The two I_FREEING tests are racy because clear_inode() can set i_state to
I_CLEAR between the clear of I_SYNC and the test of I_FREEING.
2) skip I_WILL_FREE inodes in generic_sync_sb_inodes() to avoid possible
races with generic_forget_inode()
generic_forget_inode() sets I_WILL_FREE call writeback on its own, so
generic_sync_sb_inodes() shall not try to step in and create possible races:
generic_forget_inode
inode->i_state |= I_WILL_FREE;
spin_unlock(&inode_lock);
generic_sync_sb_inodes()
spin_lock(&inode_lock);
__iget(inode);
__writeback_single_inode
// see non zero i_count
may WARN here ==> WARN_ON(inode->i_state & I_WILL_FREE);
spin_unlock(&inode_lock);
may call generic_forget_inode again ==> iput(inode);
The above race and warning didn't turn up because writeback_inodes() holds
the s_umount lock, so generic_forget_inode() finds MS_ACTIVE and returns
early. But we are not sure the UBIFS calls and future callers will
guarantee that. So skip I_WILL_FREE inodes for the sake of safety.
Cc: Eric Sandeen <[email protected]>
Acked-by: Jeff Layton <[email protected]>
Cc: Masayoshi MIZUMA <[email protected]>
Signed-off-by: Wu Fengguang <[email protected]>
Cc: Artem Bityutskiy <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Acked-by: Jan Kara <[email protected]>
Cc: Al Viro <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'include/linux')
0 files changed, 0 insertions, 0 deletions