xfs
[Top] [All Lists]

[PATCH] xfs: Abort intent log item in xfs_iflush() upon error to get buf

To: xfs@xxxxxxxxxxx
Subject: [PATCH] xfs: Abort intent log item in xfs_iflush() upon error to get buf
From: Shyam Kaushik <shyam@xxxxxxxxxxxxxxxxx>
Date: Tue, 12 Apr 2016 12:27:30 +0530
Delivered-to: xfs@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zadarastorage-com.20150623.gappssmtp.com; s=20150623; h=from:mime-version:thread-index:date:message-id:subject:to; bh=30IyIS7TPkMcRVrlCe8OTZjJUnr0ytOhLPiz1Qe/qvE=; b=VPYCYTFkFZ1ipECPD3cOwG/aKATTkRa0Ak39D7qMUPiVwsi7Ks3TA3Skb5jBi4KFTx TF/iCELnboe67ELeSyrCCTzEZKIldlJxP8vXWcG3W7cibGCgdM0CUhL88v+kaA9m3/Mo ZCyTR80I7Gr6be+xQ/ArS/dd9BYPy6SE062GQw0VCJqpPPqdSBkTvTr9UZuLiVYmi5qT zTrqlxq9Q2J8aVWnz+mADPaOzICAnEdPneFOACkLPXC3x/GwfwQ/+6dz/7msdpXvBNkB WElLsA6qGPm6hs3mjSfJPnJnZ0RpKWbsUgsc3sJEtamKnxWVp9Ezog1zX5/UbQAU6dHX 2kVg==
Thread-index: AdGUiJTdu19S3LQ9Rpu4ACmQUIoVwA==
Looking at xfs_iflush(). If an IO fails, it is supposed to unlock the
inode by calling xfs_iflush_abort(), which will also remove it from
the AIL. This can also happen on reclaim of a dirty inode, and if so
we'll still reclaim the inode because reclaim assumes xfs_iflush()
cleans up properly. Which, apparently, it doesn't.

Fix xfs_iflush() buf get failure to remove intent log item.

Discovered-by: Dave Chinner <dchinner at redhat.com>
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 96f606d..85414a6 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -3374,8 +3374,9 @@ xfs_iflush(
        error = xfs_imap_to_bp(mp, NULL, &ip->i_imap, &dip, &bp,
XBF_TRYLOCK,
                               0);
        if (error || !bp) {
-               xfs_ifunlock(ip);
-               return error;
+               if (!bp)
+                       error = -EIO;
+               goto abort_out;
        }

        /*
--

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