btrfs: zoned: fix active-zone accounting and transitions
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest4 patches 4 repliesIn review
- v24 patches 5 repliesSuperseded
- v14 patches 10 repliesSuperseded
Changes in v3 from the cover letter
- Dropped the block-group flag comment changes from patch 1; no functional changes.
Patches in v3 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/4 | btrfs: zoned: track only sequential zones as activefs/ | +42 | 1 reply | |
| 2/4 | btrfs: zoned: recover active non-data block group roles on mountfs/ fs/ fs/ | +101 | 3 replies | |
| 3/4 | btrfs: zoned: remove obsolete non-data block group activation helperfs/ fs/ fs/ | +10 | 0 replies | |
| 4/4 | btrfs: zoned: serialize zone finishing per block groupfs/ fs/ | +29 | 0 replies |
Reviews trailers per patch
2 of 4 patches have a Reviewed-by or Acked-by.
| Patch | Johannes Thumshirn |
|---|---|
| 1/4 | R-b |
| 2/4 | |
| 3/4 | R-b |
| 4/4 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v3 0/4] btrfs: zoned: fix active-zone accounting and transitions
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/[email protected]/
v1:
https://lore.kernel.org/linux-btrfs/[email protected]/
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(-)
Signature · 1 line
2.39.5