Skip to contentSkip to conversation

xfs: Fix xfs_grow_last_rtg()

PATCH Superseded Nirjhar Roy (IBM) 2 participants 4 messages Dec 3, 2025 – Dec 17, 2025 XFS filesystem

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: Fix xfs_grow_last_rtg()

The last rtg should be able to grow when the size of the last is less than (and not equal to) sb_rgextents. xfs_growfs with realtime groups fails without this patch. The reason is that, xfs_growfs_rtg() tries to grow the last rt group even when the last rt group is at its maximal size i.e, sb_rgextents. It fails with the following messages:

XFS (loop0): Internal error block >= mp->m_rsumblocks at line 253 of file fs/xfs/libxfs/xfs_rtbitmap.c. Caller xfs_rtsummary_read_buf+0x20/0x80 XFS (loop0): Corruption detected. Unmount and run xfs_repair
XFS (loop0): Internal error xfs_trans_cancel at line 976 of file fs/xfs/xfs_trans.c. Caller xfs_growfs_rt_bmblock+0x402/0x450 XFS (loop0): Corruption of in-memory data (0x8) detected at xfs_trans_cancel+0x10a/0x1f0 (fs/xfs/xfs_trans.c:977). Shutting down filesystem. XFS (loop0): Please unmount the filesystem and rectify the problem(s)

---
 fs/xfs/xfs_rtalloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_rtalloc.c +1 -1
index 6907e871fa15..2666923a9b40 100644
@@ -1324,7 +1324,7 @@ xfs_grow_last_rtg(
 		return true;
 	if (mp->m_sb.sb_rgcount == 0)
 		return false;
-	return xfs_rtgroup_extents(mp, mp->m_sb.sb_rgcount - 1) <=
+	return xfs_rtgroup_extents(mp, mp->m_sb.sb_rgcount - 1) <
 			mp->m_sb.sb_rgextents;
 }
 
Signature · 1 line
2.43.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Nirjhar Roy (IBM)

The last rtg should be able to grow when the size of the last is less than (and not equal to) sb_rgextents. xfs_growfs with realtime groups fails without this patch. The reason is that, xfs_growfs_rtg() tries to grow the last rt group even when the last rt group is at its maximal size i.e, sb_rgextents. It fails with the following messages:

Please use up all 73 characters of the commit log to improve readability.

The change looks good:

Can you submit a test case for this to xfstests?

#2 lore raw
Quoted 10 lines · Christoph Hellwig
Quoted 7 lines · Nirjhar Roy (IBM)

The last rtg should be able to grow when the size of the last is less than (and not equal to) sb_rgextents. xfs_growfs with realtime groups fails without this patch. The reason is that, xfs_growfs_rtg() tries to grow the last rt group even when the last rt group is at its maximal size i.e, sb_rgextents. It fails with the following messages:

Please use up all 73 characters of the commit log to improve readability.

Okay.

Quoted 4 lines

The change looks good:

Thank you.

Quoted 2 lines

Can you submit a test case for this to xfstests?

Yes, I can do that.

--NR

Quoted 1 line
Signature · 3 lines
Nirjhar Roy
Linux Kernel Developer
IBM, Bangalore
#3 lore raw
In reply to Christoph Hellwig
Quoted 8 lines · Christoph Hellwig
Quoted 7 lines · Nirjhar Roy (IBM)

The last rtg should be able to grow when the size of the last is less than (and not equal to) sb_rgextents. xfs_growfs with realtime groups fails without this patch. The reason is that, xfs_growfs_rtg() tries to grow the last rt group even when the last rt group is at its maximal size i.e, sb_rgextents. It fails with the following messages:

Quoted 6 lines

Please use up all 73 characters of the commit log to improve readability.

The change looks good:

Should I have any fixes tag for this fix? I have made the change on top of the very first version of the function (xfs_grow_last_rtg()), so should I put

Fixes ee321351487ae ("xfs: grow the realtime section when realtime groups are enabled") ?

Also, which Cc tag should I put here?

--NR

Quoted 3 lines

Can you submit a test case for this to xfstests?

Signature · 3 lines
Nirjhar Roy
Linux Kernel Developer
IBM, Bangalore