Skip to contentSkip to conversation

xfs: fix a rtgroup leak when xfs_init_zone fails

PATCH Applied Christoph Hellwig 3 participants 3 messages Nov 4, 2025 – Nov 6, 2025 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: fix a rtgroup leak when xfs_init_zone fails

Drop the rtgrop reference when xfs_init_zone fails for a conventional device.

Fixes 4e4d52075577 ("xfs: add the zoned space allocator")
---
 fs/xfs/xfs_zone_alloc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/xfs/xfs_zone_alloc.c +3 -1
index 9c8587622692..e123d8345d8b 100644
@@ -1249,8 +1249,10 @@ xfs_mount_zones(
 
 		while ((rtg = xfs_rtgroup_next(mp, rtg))) {
 			error = xfs_init_zone(&iz, rtg, NULL);
-			if (error)
+			if (error) {
+				xfs_rtgroup_rele(rtg);
 				goto out_free_zone_info;
+			}
 		}
 	}
 
Signature · 1 line
2.47.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · Christoph Hellwig

Drop the rtgrop reference when xfs_init_zone fails for a conventional device.

Fixes 4e4d52075577 ("xfs: add the zoned space allocator")
---
 fs/xfs/xfs_zone_alloc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/xfs/xfs_zone_alloc.c +0 -0
index 9c8587622692..e123d8345d8b 100644
@@ -1249,8 +1249,10 @@ xfs_mount_zones(
 

fs/xfs/xfs_zone_alloc.c xfs_mount_zones( · line 1258

Quoted 10 lines
fs/xfs/xfs_zone_alloc.c +3 -1
 		while ((rtg = xfs_rtgroup_next(mp, rtg))) {
 			error = xfs_init_zone(&iz, rtg, NULL);
-			if (error)
+			if (error) {
+				xfs_rtgroup_rele(rtg);
 				goto out_free_zone_info;
+			}
 		}
 	}
 

Looks good,

maintainer Applied
#2 lore raw
In reply to Christoph Hellwig
Quoted 4 lines · Christoph Hellwig

Drop the rtgrop reference when xfs_init_zone fails for a conventional device.

Applied to for-next, thanks!

[1/1] xfs: fix a rtgroup leak when xfs_init_zone fails

      commit: f5714a3c1a5658251360603231efe1bee21f9c2c

Best regards,

Signature · 1 line
Carlos Maiolino <[email protected]>