diff options
author | Jan Kara <jack@suse.cz> | 2012-05-03 14:48:03 +0200 |
---|---|---|
committer | Fengguang Wu <fengguang.wu@intel.com> | 2012-05-06 13:43:41 +0800 |
commit | 169ebd90131b2ffca74bb2dbe7eeacd39fb83714 (patch) | |
tree | 513136e110970da388680947c225ef8ca05a6dd7 /fs/bad_inode.c | |
parent | dbd5768f87ff6fb0a4fe09c4d7b6c4a24de99430 (diff) |
writeback: Avoid iput() from flusher thread
Doing iput() from flusher thread (writeback_sb_inodes()) can create problems
because iput() can do a lot of work - for example truncate the inode if it's
the last iput on unlinked file. Some filesystems depend on flusher thread
progressing (e.g. because they need to flush delay allocated blocks to reduce
allocation uncertainty) and so flusher thread doing truncate creates
interesting dependencies and possibilities for deadlocks.
We get rid of iput() in flusher thread by using the fact that I_SYNC inode
flag effectively pins the inode in memory. So if we take care to either hold
i_lock or have I_SYNC set, we can get away without taking inode reference
in writeback_sb_inodes().
As a side effect of these changes, we also fix possible use-after-free in
wb_writeback() because inode_wait_for_writeback() call could try to reacquire
i_lock on the inode that was already free.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Diffstat (limited to 'fs/bad_inode.c')
0 files changed, 0 insertions, 0 deletions