]> git.baikalelectronics.ru Git - kernel.git/commit
vfs: Move waiting for inode writeback from end_writeback() to evict_inode()
authorJan Kara <jack@suse.cz>
Thu, 3 May 2012 12:48:01 +0000 (14:48 +0200)
committerFengguang Wu <fengguang.wu@intel.com>
Sun, 6 May 2012 05:43:40 +0000 (13:43 +0800)
commitc47b512974994b93fb090e6cbc2f0e5b1d2b644e
treeb93db15bf5e4cd890670db0fd36575b5efce2366
parent538a9fedf82b499f1199c27fc569250f20a46b8a
vfs: Move waiting for inode writeback from end_writeback() to evict_inode()

Currently, I_SYNC can never be set when evict_inode() (and thus
end_writeback()) is called because flusher thread holds inode reference while
inode is under writeback. As a result inode_sync_wait() in those places
currently does nothing. However that is going to change and unveils problems
with calling inode_sync_wait() from end_writeback(). Several filesystems call
end_writeback() after they have deleted the inode (btrfs, gfs2, ...) and other
filesystems (ext3, ext4, reiserfs, ...) can deadlock when waiting for I_SYNC
because they call end_writeback() from within a transaction.

To avoid these issues, we move inode_sync_wait() into evict_inode() before
calling ->evict_inode(). That way we preserve the current property that
->evict_inode() and writeback never run in parallel and all filesystems are
safe.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
fs/inode.c