]> 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>
Sun, 8 Dec 2019 19:10:42 +0000 (14:10 -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)
(cherry picked from commit 3fef15d04226a183051b29a9d956eb6a3a0f6c9d)
(cherry picked from commit 22c00c2f89ee2732c4cdbf2d9eb43259d502cc63)

fs/btrfs/relocation.c

index 09869defc08548a40bc11d3cc60f19b7dcb57357..66ce8922e047d038fa719416a9e6d2863513c0df 100644 (file)
@@ -4391,6 +4391,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);