Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [PATCH v3 0/5] btrfs: zoned: fix deadlock and space reporting issues for zoned filesystems
@ 2026-05-22  9:02 Johannes Thumshirn
  2026-05-22  9:02 ` [PATCH v3 1/5] btrfs: zoned: document RECLAIM_ZONES flush state Johannes Thumshirn
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Johannes Thumshirn @ 2026-05-22  9:02 UTC (permalink / raw)
  To: linux-btrfs
  Cc: Filipe Manana, David Sterba, Hans Holmberg, Boris Burkov,
	Damien Le Moal, Naohiro Aota, Christoph Hellwig,
	Johannes Thumshirn

This series fixes premature ENOSPC errors and deadlock issues on zoned BTRFS
filesystems when running xfstest generic/747, which tests garbage collection
on zoned block devices using direct and buffered I/O.

There where two issues revealed in the investigation:

Async reclaim deadlock: On zoned filesystems, the flush state machine
only executes RECLAIM_ZONES and RESET_ZONES in later flush states
(FLUSH_DELALLOC and beyond). By the time these states are reached,
ticket waiters can deadlock waiting for space that can only be freed by
zone reset. The fix adds RECLAIM_ZONES and RESET_ZONES to the first
async reclaim loop (FLUSH_ALLOC) specifically for zoned filesystems,
ensuring zone reset happens early enough to free space for pending
allocation tickets.

Additionally, the series fixes a bug in data relocation block group selection
where the first block group was incorrectly skipped, and adds a new flush
state (BTRFS_RESERVE_FLUSH_DATA_RELOCATION) to use priority reclaim for
zoned data relocation operations.

Using this, generic/747 passes when lowering the fill_percent variable
to 80% (from the 95%) that XFS uses. I'm still examining if this is due
to XFS not having metadata on zoned or other statfs space estimation
bugs or something else.

Changes to v2:
- Re-do the data-relocation block-group selection algorithm

Changes to v1:
- Removed the zone_unusable statfs patch
- Removed the heavy handed flushing patch
- Added fixes tags where needed
- Added more comments

Johannes Thumshirn (5):
  btrfs: zoned: document RECLAIM_ZONES flush state
  btrfs: zoned: decode 'RECLAIM_ZONES' state in tracepoints
  btrfs: zoned: always set data_relocation_bg
  btrfs: zoned: don't account data relocation space-info in statfs free
    space
  btrfs: zoned: fix deadlock waiting for ticket during data relocation

 fs/btrfs/delalloc-space.c    |  2 ++
 fs/btrfs/space-info.c        |  9 +++++++++
 fs/btrfs/space-info.h        | 11 +++++++++++
 fs/btrfs/super.c             |  3 ++-
 fs/btrfs/zoned.c             |  8 +-------
 include/trace/events/btrfs.h |  1 +
 6 files changed, 26 insertions(+), 8 deletions(-)

-- 
2.54.0


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

end of thread, other threads:[~2026-05-25 11:35 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-22  9:02 [PATCH v3 0/5] btrfs: zoned: fix deadlock and space reporting issues for zoned filesystems Johannes Thumshirn
2026-05-22  9:02 ` [PATCH v3 1/5] btrfs: zoned: document RECLAIM_ZONES flush state Johannes Thumshirn
2026-05-22  9:02 ` [PATCH v3 2/5] btrfs: zoned: decode 'RECLAIM_ZONES' state in tracepoints Johannes Thumshirn
2026-05-22  9:02 ` [PATCH v3 3/5] btrfs: zoned: always set data_relocation_bg Johannes Thumshirn
2026-05-22 18:27   ` Boris Burkov
2026-05-25  2:36   ` Naohiro Aota
2026-05-22  9:02 ` [PATCH v3 4/5] btrfs: zoned: don't account data relocation space-info in statfs free space Johannes Thumshirn
2026-05-22  9:02 ` [PATCH v3 5/5] btrfs: zoned: fix deadlock waiting for ticket during data relocation Johannes Thumshirn
2026-05-25  3:57 ` [PATCH v3 0/5] btrfs: zoned: fix deadlock and space reporting issues for zoned filesystems Naohiro Aota
2026-05-25 11:35 ` David Sterba

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