Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [PATCH 0/4] btrfs: zoned: fix active-zone accounting and transitions
@ 2026-08-24  6:49 Dongjiang Zhu
  2026-08-24  6:49 ` [PATCH 1/4] btrfs: zoned: track only sequential zones as active Dongjiang Zhu
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Dongjiang Zhu @ 2026-08-24  6:49 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.

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 |   7 +-
 fs/btrfs/disk-io.c     |   7 +-
 fs/btrfs/fs.h          |   4 +
 fs/btrfs/zoned.c       | 193 ++++++++++++++++++++++++++++-------------
 fs/btrfs/zoned.h       |   9 +-
 6 files changed, 160 insertions(+), 98 deletions(-)

-- 
2.39.5

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

end of thread, other threads:[~2026-08-25 10:02 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-24  6:49 [PATCH 0/4] btrfs: zoned: fix active-zone accounting and transitions Dongjiang Zhu
2026-08-24  6:49 ` [PATCH 1/4] btrfs: zoned: track only sequential zones as active Dongjiang Zhu
2026-08-24 13:55   ` Johannes Thumshirn
2026-08-24 22:40     ` Qu Wenruo
2026-08-25  9:10       ` Johannes Thumshirn
2026-08-25  3:01     ` Dongjiang Zhu
2026-08-24  6:49 ` [PATCH 2/4] btrfs: zoned: recover active non-data block group roles on mount Dongjiang Zhu
2026-08-24 14:42   ` Johannes Thumshirn
2026-08-25  3:08     ` Dongjiang Zhu
2026-08-25 10:02       ` Johannes Thumshirn
2026-08-24  6:49 ` [PATCH 3/4] btrfs: zoned: remove obsolete non-data block group activation helper Dongjiang Zhu
2026-08-24 15:51   ` Johannes Thumshirn
2026-08-24  6:49 ` [PATCH 4/4] btrfs: zoned: serialize zone finishing per block group Dongjiang Zhu
2026-08-24 16:00   ` Johannes Thumshirn
2026-08-25  3:16     ` Dongjiang Zhu

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