From 6740f37d2edb169a5019229ad676593880ad4441 Mon Sep 17 00:00:00 2001
From: Qu Wenruo <wqu@suse.com>
Date: Mon, 11 May 2020 13:10:06 +0800
Patch-mainline: Never, will fix the root cause in upstream
References: bsc#1171417
Subject: [PATCH] btrfs: relocation: Work around dead relocation stage loop
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>
---
fs/btrfs/relocation.c | 5 +++++
1 file changed, 5 insertions(+)
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -4468,6 +4468,11 @@ int btrfs_relocate_block_group(struct bt
btrfs_info(fs_info, "found %llu extents, stage: %s",
rc->extents_found, stage_to_string(finishes_stage));
+
+ if (btrfs_should_cancel_balance(fs_info)) {
+ err = -ECANCELED;
+ goto out;
+ }
}
WARN_ON(rc->block_group->pinned > 0);