]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
btrfs: zoned: do not select metadata BG as finish target
authorNaohiro Aota <naohiro.aota@wdc.com>
Wed, 16 Jul 2025 07:59:52 +0000 (16:59 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Aug 2025 16:36:31 +0000 (18:36 +0200)
commit 3a931e9b39c7ff8066657042f5f00d3b7e6ad315 upstream.

We call btrfs_zone_finish_one_bg() to zone finish one block group and make
room to activate another block group. Currently, we can choose a metadata
block group as a target. But, as we reserve an active metadata block group,
we no longer want to select a metadata block group. So, skip it in the
loop.

CC: stable@vger.kernel.org # 6.6+
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/zoned.c

index 7e4250c73b67a3156d2cc4a741fd69c07d47c66b..b66242f080265eae04f67eae85711f4f2713745b 100644 (file)
@@ -2544,7 +2544,7 @@ int btrfs_zone_finish_one_bg(struct btrfs_fs_info *fs_info)
 
                spin_lock(&block_group->lock);
                if (block_group->reserved || block_group->alloc_offset == 0 ||
-                   (block_group->flags & BTRFS_BLOCK_GROUP_SYSTEM) ||
+                   !(block_group->flags & BTRFS_BLOCK_GROUP_DATA) ||
                    test_bit(BLOCK_GROUP_FLAG_ZONED_DATA_RELOC, &block_group->runtime_flags)) {
                        spin_unlock(&block_group->lock);
                        continue;