xfs: unlock inode when xfs_ioctl_setattr_get_trans can't get transaction
PATCH 1/1 xfs: unlock inode when xfs_ioctl_setattr_get_trans can't get transaction
From: Darrick J. Wong <[email protected]>
We passed an inode into xfs_ioctl_setattr_get_trans with join_flags indicating which locks are held on that inode. If we can't allocate a transaction then we need to unlock the inode before we bail out, like all the other error paths do.
--- fs/xfs/xfs_ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_ioctl.c +1 -1
@@ -1173,7 +1173,7 @@ xfs_ioctl_setattr_get_trans( error =xfs_trans_alloc (mp, &M_RES (mp)->tr_ichange,0 ,0 ,0 , &tp);if (error) -return ERR_PTR (error); + goto out_unlock;xfs_ilock (ip,XFS_ILOCK_EXCL );xfs_trans_ijoin (tp, ip,XFS_ILOCK_EXCL | join_flags);
Quoted 8 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
We passed an inode into
xfs_ioctl_setattr_get_transwithjoin_flagsindicating which locks are held on that inode. If we can't allocate a transaction then we need to unlock the inode before we bail out, like all the other error paths do.Signed-off-by Darrick J. Wong <[email protected]>
Yup, that's a problem, and the function header comment says "we now take full responsibility for unlocking the inode" so this looks fine.
Signature · 2 lines
Dave Chinner [email protected]
Quoted 8 lines · Dave Chinner
Quoted 7 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
We passed an inode into
xfs_ioctl_setattr_get_transwithjoin_flagsindicating which locks are held on that inode. If we can't allocate a transaction then we need to unlock the inode before we bail out, like all the other error paths do.
Quoted 5 lines
Quoted 1 line
Signed-off-by Darrick J. Wong <[email protected]>Yup, that's a problem, and the function header comment says "we now take full responsibility for unlocking the inode" so this looks fine.
Cool. Thanks for the review!
--D
Quoted 5 lines
Reviewed-by Dave Chinner <[email protected]>Signature · 2 lines
Dave Chinner [email protected]
Quoted 8 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
We passed an inode into
xfs_ioctl_setattr_get_transwithjoin_flagsindicating which locks are held on that inode. If we can't allocate a transaction then we need to unlock the inode before we bail out, like all the other error paths do.Signed-off-by Darrick J. Wong <[email protected]>
Looks good,