]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
libxfs: fix buffer log item lifetime weirdness
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 26 Apr 2019 21:50:48 +0000 (16:50 -0500)
committerEric Sandeen <sandeen@redhat.com>
Fri, 26 Apr 2019 21:50:48 +0000 (16:50 -0500)
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 <darrick.wong@oracle.com>
Reviewed-by: Bill O'Donnell <billodo@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/trans.c

index b4589d0a916ce4862f08db97649642ec5e19d5ee..4fdf4b1f36439c3538fdc2d2bbc27b181475ec58 100644 (file)
@@ -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);
 }