Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH v2 0/3] btrfs: make qgroup rescan work to handle fs freezing
Date: Mon, 21 Sep 2026 18:46:43 +0930	[thread overview]
Message-ID: <cover.1789981860.git.wqu@suse.com> (raw)

[CHANGELOG]
v2:
- Add a new patch to slightly change when RESCAN bit should be cleared

- Add a new small patch to always output the rescan ending message
  This is split from the original patch.

- Save if the rescan is cancelled or not when still holding
  qgroup_rescan_lock
  To reduce possible races affecting the output message

- Also clear the RESCAN bit if btrfs_try_start_transaction() failed

There is a user report about a running qgroup rescan failed the pm
suspension.

It turns out that if we sleep inside a work item, the workqueue still
counts as active during suspension, thus suspension can not continue.

The fix is to:

- Check if the fs is frozen in rescan_should_stop()
  To cover the common case.

- Use a trylock version o btrfs_start_transaction()
  So it won't sleep on sb_start_intwrite(). This is to cover
  the minor cases where fs is frozen between rescan_should_stop() and
  btrfs_start_transaction().

And two small patches to clean up the rescan code before the proper fix.

Qu Wenruo (3):
  btrfs: let rescan_should_stop() decide if the rescan flag is cleared
  btrfs: always show the message when qgroup rescan ended
  btrfs: make qgroup rescan work handle fs freezing

 fs/btrfs/qgroup.c      | 59 ++++++++++++++++++++++++++++++------------
 fs/btrfs/transaction.c | 22 +++++++++++++---
 fs/btrfs/transaction.h |  4 +++
 3 files changed, 65 insertions(+), 20 deletions(-)

-- 
2.55.0


             reply	other threads:[~2026-09-21  9:17 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-21  9:16 Qu Wenruo [this message]
2026-09-21  7:03 ` [PATCH] btrfs: make qgroup rescan work to handle fs freezing Qu Wenruo
2026-09-21  8:36   ` Dongjiang Zhu
2026-09-21 13:12     ` David Sterba
2026-09-21 13:34       ` Dongjiang Zhu
2026-09-21 21:46       ` Qu Wenruo
2026-09-22  6:30         ` Andrei Borzenkov
2026-09-22  6:57           ` Qu Wenruo
2026-09-22  6:24       ` Andrei Borzenkov
2026-09-21  9:16   ` Qu Wenruo
2026-09-21 13:18   ` David Sterba
2026-09-21 21:48     ` Qu Wenruo
2026-09-21  9:16 ` [PATCH v2 1/3] btrfs: let rescan_should_stop() decide if the rescan flag is cleared Qu Wenruo
2026-09-21 10:14   ` Dongjiang Zhu
2026-09-21 10:26     ` Qu Wenruo
2026-09-21 10:39       ` Dongjiang Zhu
2026-09-21  9:16 ` [PATCH v2 2/3] btrfs: always show the message when qgroup rescan ended Qu Wenruo
2026-09-21  9:16 ` [PATCH v2 3/3] btrfs: make qgroup rescan work handle fs freezing Qu Wenruo

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=cover.1789981860.git.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