public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] xfs: Fix xfs_grow_last_rtg()
@ 2025-12-03 12:45 Nirjhar Roy (IBM)
  2025-12-04  9:36 ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: Nirjhar Roy (IBM) @ 2025-12-03 12:45 UTC (permalink / raw)
  To: linux-xfs; +Cc: ritesh.list, ojaswin, djwong, hch, nirjhar.roy.lists

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)

Signed-off-by: Nirjhar Roy (IBM) <nirjhar.roy.lists@gmail.com>
---
 fs/xfs/xfs_rtalloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c
index 6907e871fa15..2666923a9b40 100644
--- a/fs/xfs/xfs_rtalloc.c
+++ b/fs/xfs/xfs_rtalloc.c
@@ -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;
 }
 
-- 
2.43.5


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

* Re: [PATCH v1] xfs: Fix xfs_grow_last_rtg()
  2025-12-03 12:45 [PATCH v1] xfs: Fix xfs_grow_last_rtg() Nirjhar Roy (IBM)
@ 2025-12-04  9:36 ` Christoph Hellwig
  2025-12-04  9:47   ` Nirjhar Roy (IBM)
  2025-12-17 16:48   ` Nirjhar Roy (IBM)
  0 siblings, 2 replies; 4+ messages in thread
From: Christoph Hellwig @ 2025-12-04  9:36 UTC (permalink / raw)
  To: Nirjhar Roy (IBM); +Cc: linux-xfs, ritesh.list, ojaswin, djwong, hch

On Wed, Dec 03, 2025 at 06:15:45PM +0530, Nirjhar Roy (IBM) wrote:
> 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:

Reviewed-by: Christoph Hellwig <hch@lst.de>

Can you submit a test case for this to xfstests?


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

* Re: [PATCH v1] xfs: Fix xfs_grow_last_rtg()
  2025-12-04  9:36 ` Christoph Hellwig
@ 2025-12-04  9:47   ` Nirjhar Roy (IBM)
  2025-12-17 16:48   ` Nirjhar Roy (IBM)
  1 sibling, 0 replies; 4+ messages in thread
From: Nirjhar Roy (IBM) @ 2025-12-04  9:47 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-xfs, ritesh.list, ojaswin, djwong


On 12/4/25 15:06, Christoph Hellwig wrote:
> On Wed, Dec 03, 2025 at 06:15:45PM +0530, Nirjhar Roy (IBM) wrote:
>> 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.
>
> The change looks good:
>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
Thank you.
>
> Can you submit a test case for this to xfstests?

Yes, I can do that.

--NR

>
-- 
Nirjhar Roy
Linux Kernel Developer
IBM, Bangalore


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

* Re: [PATCH v1] xfs: Fix xfs_grow_last_rtg()
  2025-12-04  9:36 ` Christoph Hellwig
  2025-12-04  9:47   ` Nirjhar Roy (IBM)
@ 2025-12-17 16:48   ` Nirjhar Roy (IBM)
  1 sibling, 0 replies; 4+ messages in thread
From: Nirjhar Roy (IBM) @ 2025-12-17 16:48 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-xfs, ritesh.list, ojaswin, djwong


On 12/4/25 15:06, Christoph Hellwig wrote:
> On Wed, Dec 03, 2025 at 06:15:45PM +0530, Nirjhar Roy (IBM) wrote:
>> 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:
>
> Reviewed-by: Christoph Hellwig <hch@lst.de>

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

>
> Can you submit a test case for this to xfstests?
>
-- 
Nirjhar Roy
Linux Kernel Developer
IBM, Bangalore


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

end of thread, other threads:[~2025-12-17 16:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-03 12:45 [PATCH v1] xfs: Fix xfs_grow_last_rtg() Nirjhar Roy (IBM)
2025-12-04  9:36 ` Christoph Hellwig
2025-12-04  9:47   ` Nirjhar Roy (IBM)
2025-12-17 16:48   ` Nirjhar Roy (IBM)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox