xfs
[Top] [All Lists]

[PATCH v3 11/13] xfs: fix btree cursor error cleanups

To: xfs@xxxxxxxxxxx
Subject: [PATCH v3 11/13] xfs: fix btree cursor error cleanups
From: Brian Foster <bfoster@xxxxxxxxxx>
Date: Mon, 10 Aug 2015 15:01:47 -0400
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1439233309-19959-1-git-send-email-bfoster@xxxxxxxxxx>
References: <1439233309-19959-1-git-send-email-bfoster@xxxxxxxxxx>
The btree cursor cleanup function takes an error parameter that affects
how buffers are released from the cursor. All buffers are released in
the event of error. Several callers do not specify the XFS_BTREE_ERROR
flag in the event of error, however. This can cause buffers to hang
around locked or with an elevated hold count and thus lead to umount
hangs in the event of errors.

Fix up the xfs_btree_del_cursor() callers to pass XFS_BTREE_ERROR if the
cursor is being torn down due to error.

Signed-off-by: Brian Foster <bfoster@xxxxxxxxxx>
Reviewed-by: Christoph Hellwig <hch@xxxxxx>
---
 fs/xfs/libxfs/xfs_ialloc.c | 2 +-
 fs/xfs/xfs_itable.c        | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c
index ce63e04..54deb2d 100644
--- a/fs/xfs/libxfs/xfs_ialloc.c
+++ b/fs/xfs/libxfs/xfs_ialloc.c
@@ -2233,7 +2233,7 @@ xfs_imap_lookup(
        }
 
        xfs_trans_brelse(tp, agbp);
-       xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR);
+       xfs_btree_del_cursor(cur, error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
        if (error)
                return error;
 
diff --git a/fs/xfs/xfs_itable.c b/fs/xfs/xfs_itable.c
index f41b0c3..930ebd8 100644
--- a/fs/xfs/xfs_itable.c
+++ b/fs/xfs/xfs_itable.c
@@ -473,7 +473,8 @@ xfs_bulkstat(
                 * pending error, then we are done.
                 */
 del_cursor:
-               xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR);
+               xfs_btree_del_cursor(cur, error ?
+                                         XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
                xfs_buf_relse(agbp);
                if (error)
                        break;
-- 
2.1.0

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