Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

xfs: fix btree cursor error cleanups

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>

authored by

Brian Foster and committed by
Dave Chinner
f307080a 0ae120f8

+3 -2
+1 -1
fs/xfs/libxfs/xfs_ialloc.c
··· 2232 2232 } 2233 2233 2234 2234 xfs_trans_brelse(tp, agbp); 2235 - xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR); 2235 + xfs_btree_del_cursor(cur, error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR); 2236 2236 if (error) 2237 2237 return error; 2238 2238
+2 -1
fs/xfs/xfs_itable.c
··· 473 473 * pending error, then we are done. 474 474 */ 475 475 del_cursor: 476 - xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR); 476 + xfs_btree_del_cursor(cur, error ? 477 + XFS_BTREE_ERROR : XFS_BTREE_NOERROR); 477 478 xfs_buf_relse(agbp); 478 479 if (error) 479 480 break;