linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH v2 4/4] btrfs: relocation: Work around dead relocation stage loop
Date: Tue, 11 Feb 2020 13:37:29 +0800	[thread overview]
Message-ID: <20200211053729.20807-5-wqu@suse.com> (raw)
In-Reply-To: <20200211053729.20807-1-wqu@suse.com>

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(+)

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);
-- 
2.25.0


  parent reply	other threads:[~2020-02-11  5:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-11  5:37 [PATCH v2 0/4] btrfs: Make balance cancelling response faster Qu Wenruo
2020-02-11  5:37 ` [PATCH v2 1/4] btrfs: relocation: Introduce error injection points for cancelling balance Qu Wenruo
2020-02-13 20:00   ` Josef Bacik
2020-02-11  5:37 ` [PATCH v2 2/4] btrfs: relocation: Check cancel request after each data page read Qu Wenruo
2020-02-13 20:03   ` Josef Bacik
2020-02-14 17:10     ` David Sterba
2020-02-11  5:37 ` [PATCH v2 3/4] btrfs: relocation: Check cancel request after each extent found Qu Wenruo
2020-02-13 20:05   ` Josef Bacik
2020-02-11  5:37 ` Qu Wenruo [this message]
2020-02-13 20:08   ` [PATCH v2 4/4] btrfs: relocation: Work around dead relocation stage loop Josef Bacik
2020-02-14  0:33     ` Qu Wenruo
2020-02-14 17:12 ` [PATCH v2 0/4] btrfs: Make balance cancelling response faster David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200211053729.20807-5-wqu@suse.com \
    --to=wqu@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).