]> git.hungrycats.org Git - linux/commitdiff
btrfs: relocation: Work around dead relocation stage loop
authorQu Wenruo <wqu@suse.com>
Tue, 3 Dec 2019 06:42:54 +0000 (14:42 +0800)
committerZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Thu, 5 Dec 2019 19:39:54 +0000 (14:39 -0500)
There are some reports of dead relocation stage loop, where dmesg is
flooded by "Found X extents".

The root cause of it is still uncertain, but we can work around such bug
by checking cancelling request so user can at least cancel such dead
loop.

Signed-off-by: Qu Wenruo <wqu@suse.com>
(cherry picked from commit 51e1987039e8138615d7da1e52aa53a3fb332612)

fs/btrfs/relocation.c

index 34c7b3da3852956021a846fd89c74d2c0c43cfda..c635bc2e04842977d005af89eabdbb09f550d469 100644 (file)
@@ -4416,6 +4416,11 @@ int btrfs_relocate_block_group(struct btrfs_fs_info *fs_info, u64 group_start)
 
                btrfs_info(fs_info, "found %llu extents, stage: %s",
                           rc->extents_found, stage_to_string(finishes_stage));
+
+               if (should_cancel_balance(fs_info)) {
+                       err = -ECANCELED;
+                       goto out;
+               }
        }
 
        WARN_ON(rc->block_group->pinned > 0);