xfs: Add the missed xfs_perag_put() for xfs_ifree_cluster()
diff mbox series

Message ID 20200603092707.1424619-1-hslester96@gmail.com
State Accepted
Headers show
Series
  • xfs: Add the missed xfs_perag_put() for xfs_ifree_cluster()
Related show

Commit Message

Chuhong Yuan June 3, 2020, 9:27 a.m. UTC
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(-)

Comments

Darrick J. Wong June 3, 2020, 4:26 p.m. UTC | #1
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
>

Patch
diff mbox series

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