diff options
author | Dave Chinner <dchinner@redhat.com> | 2011-04-21 05:34:26 -0400 |
---|---|---|
committer | Alex Elder <aelder@sgi.com> | 2011-05-19 13:03:42 -0400 |
commit | ee58abdfcc8201f500107c7ba03f738af8b49b85 (patch) | |
tree | 626cb302906b221d676c8318a7082663c3e80fdb /fs | |
parent | e57375153d7376f2a923d98c388c1e20227b5731 (diff) |
xfs: avoid getting stuck during async inode flushes
When the underlying inode buffer is locked and xfs_sync_inode_attr()
is doing a non-blocking flush, xfs_iflush() can return EAGAIN. When
this happens, clear the error rather than returning it to
xfs_inode_ag_walk(), as returning EAGAIN will result in the AG walk
delaying for a short while and trying again. This can result in
background walks getting stuck on the one AG until inode buffer is
unlocked by some other means.
This behaviour was noticed when analysing event traces followed by
code inspection and verification of the fix via further traces.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Alex Elder <aelder@sgi.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_sync.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/xfs/linux-2.6/xfs_sync.c b/fs/xfs/linux-2.6/xfs_sync.c index 3e898a48122d..cb1bb2080e44 100644 --- a/fs/xfs/linux-2.6/xfs_sync.c +++ b/fs/xfs/linux-2.6/xfs_sync.c | |||
@@ -267,6 +267,16 @@ xfs_sync_inode_attr( | |||
267 | 267 | ||
268 | error = xfs_iflush(ip, flags); | 268 | error = xfs_iflush(ip, flags); |
269 | 269 | ||
270 | /* | ||
271 | * We don't want to try again on non-blocking flushes that can't run | ||
272 | * again immediately. If an inode really must be written, then that's | ||
273 | * what the SYNC_WAIT flag is for. | ||
274 | */ | ||
275 | if (error == EAGAIN) { | ||
276 | ASSERT(!(flags & SYNC_WAIT)); | ||
277 | error = 0; | ||
278 | } | ||
279 | |||
270 | out_unlock: | 280 | out_unlock: |
271 | xfs_iunlock(ip, XFS_ILOCK_SHARED); | 281 | xfs_iunlock(ip, XFS_ILOCK_SHARED); |
272 | return error; | 282 | return error; |