aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNaohiro Aota <[email protected]>2025-06-29 14:18:29 +0000
committerDavid Sterba <[email protected]>2025-07-21 22:09:23 +0000
commit62be7afcc13b2727bdc6a4c91aefed6b452e6ecc (patch)
tree095d7bd501b6cba8a5790ca853a7c8ff27c24340
parentbtrfs: zoned: do not remove unwritten non-data block group (diff)
downloadkernel-62be7afcc13b2727bdc6a4c91aefed6b452e6ecc.tar.gz
kernel-62be7afcc13b2727bdc6a4c91aefed6b452e6ecc.zip
btrfs: zoned: requeue to unused block group list if zone finish failed
btrfs_zone_finish() can fail for several reason. If it is -EAGAIN, we need to try it again later. So, put the block group to the retry list properly. Failing to do so will keep the removable block group intact until remount and can causes unnecessary ENOSPC. Fixes: 74e91b12b115 ("btrfs: zoned: zone finish unused block group") CC: [email protected] # 6.1+ Reviewed-by: Johannes Thumshirn <[email protected]> Signed-off-by: Naohiro Aota <[email protected]> Signed-off-by: David Sterba <[email protected]>
-rw-r--r--fs/btrfs/block-group.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
index 3ddf9fe52b9d..47c6d040176c 100644
--- a/fs/btrfs/block-group.c
+++ b/fs/btrfs/block-group.c
@@ -1639,8 +1639,10 @@ void btrfs_delete_unused_bgs(struct btrfs_fs_info *fs_info)
ret = btrfs_zone_finish(block_group);
if (ret < 0) {
btrfs_dec_block_group_ro(block_group);
- if (ret == -EAGAIN)
+ if (ret == -EAGAIN) {
+ btrfs_link_bg_list(block_group, &retry_list);
ret = 0;
+ }
goto next;
}