linux/fs/xfs/linux-2.6
Dave Chinner 1bfd8d0419 xfs: introduce inode cluster buffer trylocks for xfs_iflush
There is an ABBA deadlock between synchronous inode flushing in
xfs_reclaim_inode and xfs_icluster_free. xfs_icluster_free locks the
buffer, then takes inode ilocks, whilst synchronous reclaim takes
the ilock followed by the buffer lock in xfs_iflush().

To avoid this deadlock, separate the inode cluster buffer locking
semantics from the synchronous inode flush semantics, allowing
callers to attempt to lock the buffer but still issue synchronous IO
if it can get the buffer. This requires xfs_iflush() calls that
currently use non-blocking semantics to pass SYNC_TRYLOCK rather
than 0 as the flags parameter.

This allows xfs_reclaim_inode to avoid the deadlock on the buffer
lock and detect the failure so that it can drop the inode ilock and
restart the reclaim attempt on the inode. This allows
xfs_ifree_cluster to obtain the inode lock, mark the inode stale and
release it and hence defuse the deadlock situation. It also has the
pleasant side effect of avoiding IO in xfs_reclaim_inode when it
tries to next reclaim the inode as it is now marked stale.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Alex Elder <aelder@sgi.com>
2011-03-26 09:13:55 +11:00
..
kmem.c xfs: Convert linux-2.6/ files to new logging interface 2011-03-07 10:00:35 +11:00
kmem.h xfs: replace KM_LARGE with explicit vmalloc use 2010-01-21 13:44:56 -06:00
mrlock.h
time.h
xfs_acl.c xfs: provide simple rcu-walk ACL implementation 2011-01-07 17:50:30 +11:00
xfs_aops.c xfs: Convert linux-2.6/ files to new logging interface 2011-03-07 10:00:35 +11:00
xfs_aops.h xfs: kill xfs_iomap 2010-12-16 16:05:51 -06:00
xfs_buf.c vmap: flush vmap aliases when mapping fails 2011-03-26 09:13:42 +11:00
xfs_buf.h xfs: fix error handling for synchronous writes 2011-01-11 20:28:42 -06:00
xfs_discard.c xfs: check if device support discard in xfs_ioc_trim() 2011-02-21 20:39:00 -06:00
xfs_discard.h xfs: add FITRIM support 2011-01-11 20:28:29 -06:00
xfs_export.c xfs: fix exporting with left over 64-bit inodes 2010-12-16 16:04:55 -06:00
xfs_export.h
xfs_file.c xfs: preallocation transactions do not need to be synchronous 2011-03-26 09:13:08 +11:00
xfs_fs_subr.c xfs: use range primitives for xfs page cache operations 2010-10-18 15:07:24 -05:00
xfs_globals.c xfs: remove xfs_cred.h 2010-10-18 15:08:06 -05:00
xfs_ioctl.c xfs: preallocation transactions do not need to be synchronous 2011-03-26 09:13:08 +11:00
xfs_ioctl.h xfs: convert attr to use unsigned names 2010-01-20 10:47:48 +11:00
xfs_ioctl32.c xfs: Extend project quotas to support 32bit project ids 2010-10-18 15:08:08 -05:00
xfs_ioctl32.h xfs: Extend project quotas to support 32bit project ids 2010-10-18 15:08:08 -05:00
xfs_iops.c fallocate should be a file operation 2011-01-17 02:25:31 -05:00
xfs_iops.h
xfs_linux.h xfs: kill support/debug.[ch] 2011-03-07 10:09:35 +11:00
xfs_message.c xfs: don't name variables "panic" 2011-03-11 16:34:51 -06:00
xfs_message.h xfs: kill support/debug.[ch] 2011-03-07 10:09:35 +11:00
xfs_quotaops.c Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs-2.6 2010-08-07 12:57:07 -07:00
xfs_stats.c xfs: switch to seq_file 2009-09-15 12:29:24 -05:00
xfs_stats.h
xfs_super.c xfs: introduce inode cluster buffer trylocks for xfs_iflush 2011-03-26 09:13:55 +11:00
xfs_super.h xfs: remove xfs_version.h 2010-10-18 15:08:04 -05:00
xfs_sync.c xfs: introduce inode cluster buffer trylocks for xfs_iflush 2011-03-26 09:13:55 +11:00
xfs_sync.h xfs: implement batched inode lookups for AG walking 2010-10-18 15:07:53 -05:00
xfs_sysctl.c xfs: Convert linux-2.6/ files to new logging interface 2011-03-07 10:00:35 +11:00
xfs_sysctl.h
xfs_trace.c xfs: remove unneeded #include statements 2010-07-26 13:16:33 -05:00
xfs_trace.h xfs: add FITRIM support 2011-01-11 20:28:29 -06:00
xfs_vnode.h xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_xattr.c xfs: constify xattr_handler 2010-05-21 18:31:19 -04:00