All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/4] btrfs: zoned: fix active-zone accounting and transitions
@ 2026-08-28  3:51 Dongjiang Zhu
  2026-08-28  3:51 ` [PATCH v3 1/4] btrfs: zoned: track only sequential zones as active Dongjiang Zhu
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Dongjiang Zhu @ 2026-08-28  3:51 UTC (permalink / raw)
  To: linux-btrfs; +Cc: johannes.thumshirn, naohiro.aota

After systems using HC620 host-managed zoned devices were upgraded to
Linux 6.18, multiple users reported transaction writeback failures with
-EAGAIN that forced filesystems read-only, as well as hung tasks.

Enforcing the device's max_active_zones=128 limit exposed existing
active-zone handling problems.  We reproduced representative cases
locally, including an -EAGAIN transaction abort that forced the filesystem
read-only and a balance self-deadlock that stalled transaction commit and
data writers.

Further investigation traced these failures to several related gaps in
Btrfs active-zone handling around mount recovery, non-data block group
activation and zone finishing:

- Conventional zones participate in runtime active-zone accounting, but
  that state cannot be reconstructed from device zone conditions at mount.
- Active metadata and system block groups are reconstructed at mount, but
  their runtime write roles are not.
- An obsolete allocation-time activation helper bypasses the write-time
  role pivot and can recursively enter zone finishing.
- do_zone_finish() clears the active state before the device operation has
  released the active-zone slot.

Together, these bugs can leave no active-zone slot available to metadata
or system writeback, or recursively enter zone finishing while holding
ro_block_group_mutex, resulting in the two failure modes described above.

Fix the active-zone model and its state transitions as follows:

1. Track only sequential zones as active.
2. Recover the normal metadata and system write roles on mount, and finish
   extra active block groups left by the old behavior.
3. Remove the obsolete allocation-time non-data activation helper so
   metadata and system activation goes through the write-time role pivot.
4. Serialize concurrent finish operations on the same block group and keep
   it active until the device operation and software cleanup complete.

The individual commits contain the corresponding reproduction conditions,
kernel stacks and state-transition traces.

Changes in v3:
- Dropped the block-group flag comment changes from patch 1; no functional
  changes.

Changes in v2:
- Removed the [BUG], [CAUSE] and [FIX] headings from the commit messages.
- Added a helper for identifying zones that need active-zone tracking.
- Added block group locking around alloc_offset and zone_unusable accesses
  during mount recovery.
- Explained why moving the active-bit clear alone does not serialize
  concurrent zone finish operations.

Previous versions:
v2:
https://lore.kernel.org/linux-btrfs/cover.1787717573.git.zhudongjiang@fygo.io/
v1:
https://lore.kernel.org/linux-btrfs/cover.1787551793.git.zhudongjiang@fygo.io/

Dongjiang Zhu (4):
  btrfs: zoned: track only sequential zones as active
  btrfs: zoned: recover active non-data block group roles on mount
  btrfs: zoned: remove obsolete non-data block group activation helper
  btrfs: zoned: serialize zone finishing per block group

 fs/btrfs/block-group.c |  38 ++------
 fs/btrfs/block-group.h |   1 +
 fs/btrfs/disk-io.c     |   7 +-
 fs/btrfs/zoned.c       | 211 +++++++++++++++++++++++++++++------------
 fs/btrfs/zoned.h       |   9 +-
 5 files changed, 167 insertions(+), 99 deletions(-)

-- 
2.39.5

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

end of thread, other threads:[~2026-08-28 12:07 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-28  3:51 [PATCH v3 0/4] btrfs: zoned: fix active-zone accounting and transitions Dongjiang Zhu
2026-08-28  3:51 ` [PATCH v3 1/4] btrfs: zoned: track only sequential zones as active Dongjiang Zhu
2026-08-28  5:26   ` Naohiro Aota
2026-08-28  3:51 ` [PATCH v3 2/4] btrfs: zoned: recover active non-data block group roles on mount Dongjiang Zhu
2026-08-28  5:43   ` Naohiro Aota
2026-08-28 12:07     ` Dongjiang Zhu
2026-08-28  3:51 ` [PATCH v3 3/4] btrfs: zoned: remove obsolete non-data block group activation helper Dongjiang Zhu
2026-08-28  3:51 ` [PATCH v3 4/4] btrfs: zoned: serialize zone finishing per block group Dongjiang Zhu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.