From: Darrick J. Wong Date: Fri, 26 Apr 2019 21:50:48 +0000 (-0500) Subject: libxfs: fix buffer log item lifetime weirdness X-Git-Tag: v5.0.0-rc1~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7736b0ace12e73112d5a1e645d7e072d15b62c88;p=thirdparty%2Fxfsprogs-dev.git libxfs: fix buffer log item lifetime weirdness In xfsprogs, the lifetime of xfs_buf log items doesn't match the kernel because we keep them around after comitting or cancelling transactions. This is confusing, so change the lifetime to be consistent. Worse yet, if an inode cluster buffer gets bjoined to a transaction (e.g. someone called xfs_trans_read_buf) we'll leak it when flushing an inode core back to that buffer. Signed-off-by: Darrick J. Wong Reviewed-by: Bill O'Donnell Reviewed-by: Eric Sandeen Signed-off-by: Eric Sandeen --- diff --git a/libxfs/trans.c b/libxfs/trans.c index b4589d0a9..4fdf4b1f3 100644 --- a/libxfs/trans.c +++ b/libxfs/trans.c @@ -545,6 +545,7 @@ libxfs_trans_brelse( xfs_trans_del_item(&bip->bli_item); if (bip->bli_flags & XFS_BLI_HOLD) bip->bli_flags &= ~XFS_BLI_HOLD; + xfs_buf_item_put(bip); bp->b_transp = NULL; libxfs_putbuf(bp); } @@ -905,6 +906,7 @@ buf_item_unlock( hold = bip->bli_flags & XFS_BLI_HOLD; bip->bli_flags &= ~XFS_BLI_HOLD; + xfs_buf_item_put(bip); if (!hold) libxfs_putbuf(bp); }