Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [PATCH v2 0/3] btrfs: make qgroup rescan work to handle fs freezing
@ 2026-09-21  9:16 Qu Wenruo
  2026-09-21  7:03 ` [PATCH] " Qu Wenruo
                   ` (3 more replies)
  0 siblings, 4 replies; 18+ messages in thread
From: Qu Wenruo @ 2026-09-21  9:16 UTC (permalink / raw)
  To: linux-btrfs

[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


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2026-09-22  6:57 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-21  9:16 [PATCH v2 0/3] btrfs: make qgroup rescan work to handle fs freezing Qu Wenruo
2026-09-21  7:03 ` [PATCH] " 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox