From: Naohiro Aota Date: Tue, 6 Jun 2023 05:36:36 +0000 (+0900) Subject: btrfs: reinsert BGs failed to reclaim X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=7e27180994383b7c741ad87749db01e4989a02ba;p=linux.git btrfs: reinsert BGs failed to reclaim The reclaim process can temporarily fail. For example, if the space is getting tight, it fails to make the block group read-only. If there are no further writes on that block group, the block group will never get back to the reclaim list, and the BG never gets reclaimed. In a certain workload, we can leave many such block groups never reclaimed. So, let's get it back to the list and give it a chance to be reclaimed. Fixes: 18bb8bbf13c1 ("btrfs: zoned: automatically reclaim zones") CC: stable@vger.kernel.org # 5.15+ Signed-off-by: Naohiro Aota Signed-off-by: David Sterba --- diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c index 9d9f09f25f8fe..49e92226f7667 100644 --- a/fs/btrfs/block-group.c +++ b/fs/btrfs/block-group.c @@ -1833,6 +1833,8 @@ void btrfs_reclaim_bgs_work(struct work_struct *work) } next: + if (ret) + btrfs_mark_bg_to_reclaim(bg); btrfs_put_block_group(bg); mutex_unlock(&fs_info->reclaim_bgs_lock);