linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfs: Add the missed xfs_perag_put() for xfs_ifree_cluster()
@ 2020-06-03  9:27 Chuhong Yuan
  2020-06-03 16:26 ` Darrick J. Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Chuhong Yuan @ 2020-06-03  9:27 UTC (permalink / raw)
  Cc: Darrick J . Wong, linux-xfs, Dave Chinner, linux-kernel, Chuhong Yuan

xfs_ifree_cluster() calls xfs_perag_get() at the beginning, but forgets to
call xfs_perag_put() in one failed path.
Add the missed function call to fix it.

Fixes: ce92464c180b ("xfs: make xfs_trans_get_buf return an error code")
Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
---
 fs/xfs/xfs_inode.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index d1772786af29..8845faa8161a 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -2639,8 +2639,10 @@ xfs_ifree_cluster(
 		error = xfs_trans_get_buf(tp, mp->m_ddev_targp, blkno,
 				mp->m_bsize * igeo->blocks_per_cluster,
 				XBF_UNMAPPED, &bp);
-		if (error)
+		if (error) {
+			xfs_perag_put(pag);
 			return error;
+		}
 
 		/*
 		 * This buffer may not have been correctly initialised as we
-- 
2.26.2


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

* Re: [PATCH] xfs: Add the missed xfs_perag_put() for xfs_ifree_cluster()
  2020-06-03  9:27 [PATCH] xfs: Add the missed xfs_perag_put() for xfs_ifree_cluster() Chuhong Yuan
@ 2020-06-03 16:26 ` Darrick J. Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Darrick J. Wong @ 2020-06-03 16:26 UTC (permalink / raw)
  To: Chuhong Yuan; +Cc: linux-xfs, Dave Chinner, linux-kernel

On Wed, Jun 03, 2020 at 05:27:07PM +0800, Chuhong Yuan wrote:
> xfs_ifree_cluster() calls xfs_perag_get() at the beginning, but forgets to
> call xfs_perag_put() in one failed path.
> Add the missed function call to fix it.
> 
> Fixes: ce92464c180b ("xfs: make xfs_trans_get_buf return an error code")
> Signed-off-by: Chuhong Yuan <hslester96@gmail.com>

Yeah, that looks like a bug, will test.
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  fs/xfs/xfs_inode.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
> index d1772786af29..8845faa8161a 100644
> --- a/fs/xfs/xfs_inode.c
> +++ b/fs/xfs/xfs_inode.c
> @@ -2639,8 +2639,10 @@ xfs_ifree_cluster(
>  		error = xfs_trans_get_buf(tp, mp->m_ddev_targp, blkno,
>  				mp->m_bsize * igeo->blocks_per_cluster,
>  				XBF_UNMAPPED, &bp);
> -		if (error)
> +		if (error) {
> +			xfs_perag_put(pag);
>  			return error;
> +		}
>  
>  		/*
>  		 * This buffer may not have been correctly initialised as we
> -- 
> 2.26.2
> 

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

end of thread, other threads:[~2020-06-03 16:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-03  9:27 [PATCH] xfs: Add the missed xfs_perag_put() for xfs_ifree_cluster() Chuhong Yuan
2020-06-03 16:26 ` Darrick J. Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).