[4/4] btrfs: relocation: Work around dead relocation stage loop
diff mbox series

Message ID 20191203064254.22683-5-wqu@suse.com
State New
Headers show
  • btrfs: Make balance cancelling response faster
Related show

Commit Message

Qu Wenruo Dec. 3, 2019, 6:42 a.m. UTC
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

Signed-off-by: Qu Wenruo <wqu@suse.com>
 fs/btrfs/relocation.c | 4 ++++
 1 file changed, 4 insertions(+)

diff mbox series

diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 161d66f70190..23aa630f04c9 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -4417,6 +4417,10 @@  int btrfs_relocate_block_group(struct btrfs_fs_info *fs_info, u64 group_start)
 		btrfs_info(fs_info, "found %llu extents", rc->extents_found);
+		if (should_cancel_balance(fs_info)) {
+			err = -ECANCELED;
+			goto out;
+		}
 	WARN_ON(rc->block_group->pinned > 0);