[Top] [All Lists]

[PATCH 2/4] xfs: don't look forever in xfs_inode_ag_walk during async in

To: xfs@xxxxxxxxxxx
Subject: [PATCH 2/4] xfs: don't look forever in xfs_inode_ag_walk during async inode flushes
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Thu, 21 Apr 2011 14:29:02 +1000
In-reply-to: <1303360144-10632-1-git-send-email-david@xxxxxxxxxxxxx>
References: <1303360144-10632-1-git-send-email-david@xxxxxxxxxxxxx>
From: Dave Chinner <dchinner@xxxxxxxxxx>

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 happenѕ, 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@xxxxxxxxxx>
Reviewed-by: Christoph Hellwig <hch@xxxxxx>
 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 7883762..3253572 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(
        error = xfs_iflush(ip, flags);
+       /*
+        * We don't want to try again on non-blocking flushes that can't run
+        * again immediately. If an inode really must be written, then that's
+        * what the SYNC_WAIT flag is for.
+        */
+       if (error == EAGAIN) {
+               ASSERT(!(flags & SYNC_WAIT));
+               error = 0;
+       }
        xfs_iunlock(ip, XFS_ILOCK_SHARED);
        return error;

<Prev in Thread] Current Thread [Next in Thread>