]> git.karo-electronics.de Git - linux-beck.git/commitdiff
xfs: fix btree cursor error cleanups
authorBrian Foster <bfoster@redhat.com>
Wed, 19 Aug 2015 00:00:53 +0000 (10:00 +1000)
committerDave Chinner <david@fromorbit.com>
Wed, 19 Aug 2015 00:00:53 +0000 (10:00 +1000)
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@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/libxfs/xfs_ialloc.c
fs/xfs/xfs_itable.c

index 66efc702452a0cd45920ce3fd021c689d7bdd40b..0b29918291ff5d5765c524f624b619aa5b202815 100644 (file)
@@ -2232,7 +2232,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;
 
index f41b0c3fddab5558f5040c00501e16b6ef935992..930ebd86bebac3a300faf44fabe77aa28258cf60 100644 (file)
@@ -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;