Skip to contentSkip to conversation

FAILED: patch "[PATCH] xfs: add newly added RTGs to the free pool in growfs" failed to apply to 7.1-stable tree

PATCH New [email protected] 2 participants 3 messages Jul 14 – Jul 18

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 7.1-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-7.1.y
git checkout FETCH_HEAD
git cherry-pick -x ae3692c7f440c1ff577aae1a51202415ec4a794b
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026071416-friend-sanctuary-1a9b@gregkh' --subject-prefix 'PATCH 7.1.y' 'HEAD^..'

Possible dependencies:

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From ae3692c7f440c1ff577aae1a51202415ec4a794b Mon Sep 17 00:00:00 2001
From: Christoph Hellwig <[email protected]>
Date: Wed, 10 Jun 2026 07:07:20 +0200
Subject: [PATCH] xfs: add newly added RTGs to the free pool in growfs

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")
fs/xfs/xfs_rtalloc.c +8 -0
index 153f3c378f9f..debbcefdf07f 100644
@@ -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);
maintainer
#1 lore raw

PATCH 1/2 xfs: factor out a xfs_zone_mark_free helper

From: Christoph Hellwig <[email protected]>

[ Upstream commit 16fc9d358d12e6e9cc553162b4064ad58e7fa869 ]

Add a helper for adding a zone to the free pool in preparation of adding another caller.

Stable-dep-of: ae3692c7f440 ("xfs: add newly added RTGs to the free pool in growfs")

---
 fs/xfs/xfs_zone_alloc.c | 11 +++++++++--
 fs/xfs/xfs_zone_alloc.h |  1 +
 fs/xfs/xfs_zone_gc.c    |  4 +---
 3 files changed, 11 insertions(+), 5 deletions(-)
fs/xfs/xfs_zone_alloc.c +9 -2
index 5e297b75a85f63..08d8b34f467e72 100644
@@ -944,6 +944,14 @@ xfs_zone_rgbno_is_valid(
 			rtg_rgno(rtg), XFS_RTG_FREE);
 }
 
+void
+xfs_zone_mark_free(
+	struct xfs_rtgroup	*rtg)
+{
+	xfs_group_set_mark(rtg_group(rtg), XFS_RTG_FREE);
+	atomic_inc(&rtg_mount(rtg)->m_zone_info->zi_nr_free_zones);
+}
+
 static void
 xfs_free_open_zones(
 	struct xfs_zone_info	*zi)
@@ -1082,8 +1090,7 @@ xfs_init_zone(
 
 	if (write_pointer == 0) {
 		/* zone is empty */
-		atomic_inc(&zi->zi_nr_free_zones);
-		xfs_group_set_mark(rtg_group(rtg), XFS_RTG_FREE);
+		xfs_zone_mark_free(rtg);
 		iz->available += rtg_blocks(rtg);
 	} else if (write_pointer < rtg_blocks(rtg)) {
 		/* zone is open */
fs/xfs/xfs_zone_alloc.h +1 -0
index 8b2ef98c81eff8..abf8358bb2662e 100644
@@ -42,6 +42,7 @@ void xfs_zoned_wake_all(struct xfs_mount *mp);
 bool xfs_zone_rgbno_is_valid(struct xfs_rtgroup *rtg, xfs_rgnumber_t rgbno);
 void xfs_mark_rtg_boundary(struct iomap_ioend *ioend);
 
+void xfs_zone_mark_free(struct xfs_rtgroup *rtg);
 uint64_t xfs_zoned_default_resblks(struct xfs_mount *mp,
 		enum xfs_free_counter ctr);
 void xfs_zoned_show_stats(struct seq_file *m, struct xfs_mount *mp);
fs/xfs/xfs_zone_gc.c +1 -3
index f03211e4354adc..f76a091308528b 100644
@@ -924,9 +924,7 @@ xfs_zone_gc_finish_reset(
 		goto out;
 	}
 
-	xfs_group_set_mark(rtg_group(rtg), XFS_RTG_FREE);
-	atomic_inc(&zi->zi_nr_free_zones);
-
+	xfs_zone_mark_free(rtg);
 	xfs_zoned_add_available(mp, rtg_blocks(rtg));
 
 	wake_up_all(&zi->zi_zone_wait);
Signature · 1 line
2.53.0
maintainer
#2 lore raw

PATCH 2/2 xfs: add newly added RTGs to the free pool in growfs

From: Christoph Hellwig <[email protected]>

[ Upstream commit ae3692c7f440c1ff577aae1a51202415ec4a794b ]

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")
---
 fs/xfs/xfs_rtalloc.c | 8 ++++++++
 1 file changed, 8 insertions(+)
fs/xfs/xfs_rtalloc.c +8 -0
index 153f3c378f9fb7..debbcefdf07f72 100644
@@ -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);
Signature · 1 line
2.53.0