[PATCH 3/3] btrfs: zoned: do not WARN when zones fail to finish before relocation

From: Miroslav Cimerman

Date: Sun Nov 22 2026 - 18:23:32 EST


btrfs_relocate_block_group() finishes the zones of the block group
before it relocates it. Any error other than -EAGAIN hits a WARN_ON().
However, btrfs_zone_finish() also fails when a device fails ZONE_FINISH.
A device error is not a kernel bug, and relocation continues either way.

Print a warning instead.

Fixes: 7ae9bd18032e ("btrfs: zoned: finish relocating block group")
Signed-off-by: Miroslav Cimerman <mc@xxxxxxxxxxx>
---
fs/btrfs/relocation.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index c7b5a655e89f..b60d9a0c5c1d 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -5538,7 +5538,10 @@ int btrfs_relocate_block_group(struct btrfs_fs_info *fs_info, u64 group_start,
btrfs_wait_ordered_roots(fs_info, U64_MAX, rc->block_group);

ret = btrfs_zone_finish(rc->block_group);
- WARN_ON(ret && ret != -EAGAIN);
+ if (ret && ret != -EAGAIN)
+ btrfs_warn(fs_info,
+ "zoned: failed to finish zones of block group %llu before relocation: %d",
+ rc->block_group->start, ret);

if (should_relocate_using_remap_tree(bg)) {
if (bg->remap_bytes != 0) {
--
2.53.0