All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: unlock inode when xfs_ioctl_setattr_get_trans can't get transaction
@ 2019-04-22 18:25 Darrick J. Wong
  2019-04-22 23:20 ` Dave Chinner
  2019-04-23  6:19 ` Christoph Hellwig
  0 siblings, 2 replies; 4+ messages in thread
From: Darrick J. Wong @ 2019-04-22 18:25 UTC (permalink / raw)
  To: xfs

From: Darrick J. Wong <darrick.wong@oracle.com>

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.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 fs/xfs/xfs_ioctl.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
index 744a55092147..272ee6f037ff 100644
--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@ -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);

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] xfs: unlock inode when xfs_ioctl_setattr_get_trans can't get transaction
  2019-04-22 18:25 [PATCH] xfs: unlock inode when xfs_ioctl_setattr_get_trans can't get transaction Darrick J. Wong
@ 2019-04-22 23:20 ` Dave Chinner
  2019-04-22 23:46   ` Darrick J. Wong
  2019-04-23  6:19 ` Christoph Hellwig
  1 sibling, 1 reply; 4+ messages in thread
From: Dave Chinner @ 2019-04-22 23:20 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: xfs

On Mon, Apr 22, 2019 at 11:25:41AM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> 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.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Yup, that's a problem, and the function header comment says "we now
take full responsibility for unlocking the inode" so this looks
fine.

Reviewed-by: Dave Chinner <dchinner@redhat.com>

-- 
Dave Chinner
david@fromorbit.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xfs: unlock inode when xfs_ioctl_setattr_get_trans can't get transaction
  2019-04-22 23:20 ` Dave Chinner
@ 2019-04-22 23:46   ` Darrick J. Wong
  0 siblings, 0 replies; 4+ messages in thread
From: Darrick J. Wong @ 2019-04-22 23:46 UTC (permalink / raw)
  To: Dave Chinner; +Cc: xfs

On Tue, Apr 23, 2019 at 09:20:25AM +1000, Dave Chinner wrote:
> On Mon, Apr 22, 2019 at 11:25:41AM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> > 
> > 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.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> 
> 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

> Reviewed-by: Dave Chinner <dchinner@redhat.com>
> 
> -- 
> Dave Chinner
> david@fromorbit.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xfs: unlock inode when xfs_ioctl_setattr_get_trans can't get transaction
  2019-04-22 18:25 [PATCH] xfs: unlock inode when xfs_ioctl_setattr_get_trans can't get transaction Darrick J. Wong
  2019-04-22 23:20 ` Dave Chinner
@ 2019-04-23  6:19 ` Christoph Hellwig
  1 sibling, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2019-04-23  6:19 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: xfs

On Mon, Apr 22, 2019 at 11:25:41AM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> 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.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-04-23  6:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-22 18:25 [PATCH] xfs: unlock inode when xfs_ioctl_setattr_get_trans can't get transaction Darrick J. Wong
2019-04-22 23:20 ` Dave Chinner
2019-04-22 23:46   ` Darrick J. Wong
2019-04-23  6:19 ` Christoph Hellwig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.