]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
xfs: add newly added RTGs to the free pool in growfs
authorChristoph Hellwig <hch@lst.de>
Wed, 10 Jun 2026 05:07:20 +0000 (07:07 +0200)
committerCarlos Maiolino <cem@kernel.org>
Wed, 10 Jun 2026 06:25:13 +0000 (08:25 +0200)
When growing a zoned RT section, the newly added RTGs also need to be
tagged as free in the radix tree and add to the nr_free_zones counters.
Call xfs_add_free_zone to do that, otherwise using up the newly added
space will wait for free zones forever.

Fixes: 01b71e64bb87 ("xfs: support growfs on zoned file systems")
Cc: stable@vger.kernel.org # v6.15
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
fs/xfs/xfs_rtalloc.c

index 153f3c378f9fb7ff91586bf7e552d63b1513b058..debbcefdf07f725edf9726cb0fe9b1adc7025166 100644 (file)
@@ -933,6 +933,14 @@ xfs_growfs_rt_zoned(
        mp->m_features |= XFS_FEAT_REALTIME;
        xfs_rtrmapbt_compute_maxlevels(mp);
        xfs_rtrefcountbt_compute_maxlevels(mp);
+
+       /*
+        * Finally add the newly added zone to the freelist and add the space
+        * to the available counter.  The order is important here: only add
+        * the available space after the zones, as available space guarantees
+        * that zones to back it are available.
+        */
+       xfs_zone_mark_free(rtg);
        xfs_zoned_add_available(mp, freed_rtx);
 out_free:
        kfree(nmp);