diff mbox series

[v2,4/4] btrfs: relocation: Work around dead relocation stage loop

Message ID 20200211053729.20807-5-wqu@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs: Make balance cancelling response faster | expand

Commit Message

Qu Wenruo Feb. 11, 2020, 5:37 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
loop.

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

Comments

Josef Bacik Feb. 13, 2020, 8:08 p.m. UTC | #1
On 2/11/20 12:37 AM, Qu Wenruo wrote:
> 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>
> ---

Why?  It'll get picked up by one of the other cancel checks right?  I'd rather 
know why things are going wrong than put something in for a just in case 
scenario, especially since the other cancel points actually make sense and will 
accomplish the same goal.  Thanks,

Josef
Qu Wenruo Feb. 14, 2020, 12:33 a.m. UTC | #2
On 2020/2/14 上午4:08, Josef Bacik wrote:
> On 2/11/20 12:37 AM, Qu Wenruo wrote:
>> 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>
>> ---
> 
> Why?  It'll get picked up by one of the other cancel checks right?  I'd
> rather know why things are going wrong than put something in for a just
> in case scenario, especially since the other cancel points actually make
> sense and will accomplish the same goal.  Thanks,

Yes, you're right.

Please discard this one, as there aren't that many reports allowing us
to investigate it further.

Thanks,
Qu
> 
> Josef
diff mbox series

Patch

diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 3379850d7695..b31d582a2ca1 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -4470,6 +4470,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);