Skip to content

Commit

Permalink
xfs: cancel failed transaction in xfs_fs_commit_blocks()
Browse files Browse the repository at this point in the history
If xfs_trans_reserve fails we don't cancel the transaction,
and we'll leak the allocated transaction pointer.

Spotted by Coverity.

Signed-off-by: Eric Sandeen <ssandeen@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
  • Loading branch information
Eric Sandeen authored and Dave Chinner committed Feb 23, 2015
1 parent fc92156 commit 83d5f01
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs/xfs/xfs_pnfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,10 @@ xfs_fs_commit_blocks(

tp = xfs_trans_alloc(mp, XFS_TRANS_SETATTR_NOT_SIZE);
error = xfs_trans_reserve(tp, &M_RES(mp)->tr_ichange, 0, 0);
if (error)
if (error) {
xfs_trans_cancel(tp, 0);
goto out_drop_iolock;
}

xfs_ilock(ip, XFS_ILOCK_EXCL);
xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
Expand Down

0 comments on commit 83d5f01

Please sign in to comment.