Skip to contentSkip to conversation

xfs: Add the missed xfs_perag_put() for xfs_ifree_cluster()

PATCH In review Chuhong Yuan 2 participants 2 messages Jun 3, 2020 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: Add the missed xfs_perag_put() for xfs_ifree_cluster()

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")
---
 fs/xfs/xfs_inode.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/xfs/xfs_inode.c +3 -1
index d1772786af29..8845faa8161a 100644
@@ -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
Signature · 1 line
2.26.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · 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")

Yeah, that looks like a bug, will test.

--D

Quoted 23 lines
---
 fs/xfs/xfs_inode.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/xfs/xfs_inode.c +3 -1
index d1772786af29..8845faa8161a 100644
@@ -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
Signature · 1 line
2.26.2