mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/3] btrfs: zoned: unwritten copies of mirrored data writes
@ 2026-11-29 23:52 Miroslav Cimerman
  2026-11-29 23:52 ` [PATCH v2 1/3] btrfs: zoned: use zone append for every copy of a mirrored write Miroslav Cimerman
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Miroslav Cimerman @ 2026-11-29 23:52 UTC (permalink / raw)
  To: linux-btrfs
  Cc: David Sterba, Chris Mason, Naohiro Aota, Johannes Thumshirn,
	Qu Wenruo, linux-kernel

On a zoned filesystem, a mirrored data write can lose a copy, or fail,
without any problem on the devices. The bugs fixed by 1/3 and 3/3 need
writes to one zone to arrive out of allocation order, which parallel
writers do.

1/3: since 7.0, every copy but the last is a regular write. A regular
write that arrives before an earlier one fails.

2/3: since 5.19, unmount does not wait for the work that finishes the
zones of a full metadata block group. 3/3 uses that work for data too.

3/3: since 6.7, with the raid stripe tree, the zones of a block group
are finished when the extent at its end completes. Zone append writes of
other extents that are still queued then fail.

Changes in v2:
- 1/3: Reviewed-by from Johannes. Stable tag 6.18+: the fixed commit
  is in 6.18.y too. Rebased on for-next.
- 2/3: new.
- 3/3: no new field in btrfs_block_group (Johannes). zone_finish_work
  finishes the zones once every extent that zone append writes to the
  block group is written or freed. Rebased on for-next.

Tested on for-next 1adb6f14ca90 as in v1 [1], with 8 active zones per
device. With 1/3 alone, zone append writes failed in 10 of 10 runs with
8 direct writers. With the series, 31 runs showed no failed write. A
test-only print showed the work waiting for other writes before 82 of
160 zone finishes. With a test-only delay in the work, an unmount right
after the writes hit an assertion in 9 of 9 runs without 2/3 and in
none of 6 runs with it.

Found by an LLM while testing a fix on zoned RAID1. The analysis, the
fixes and the tests were done with the help of an LLM. I reviewed
everything.

[1] https://lore.kernel.org/linux-btrfs/20261122034826.2333981-1-mc@raidlab.org/

Miroslav Cimerman (3):
  btrfs: zoned: use zone append for every copy of a mirrored write
  btrfs: zoned: wait for zone finish works at unmount
  btrfs: zoned: finish raid stripe tree zones once all data is written

 fs/btrfs/bio.c         |  1 +
 fs/btrfs/block-group.c | 16 ++++++++--
 fs/btrfs/disk-io.c     |  7 +++++
 fs/btrfs/inode.c       |  3 ++
 fs/btrfs/zoned.c       | 71 ++++++++++++++++++++++++++++++++++++++++--
 fs/btrfs/zoned.h       |  3 ++
 6 files changed, 96 insertions(+), 5 deletions(-)


base-commit: 1adb6f14ca90851ae4a8279ee90442589c312ba3
-- 
2.53.0


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

end of thread, other threads:[~2026-11-30 16:55 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-29 23:52 [PATCH v2 0/3] btrfs: zoned: unwritten copies of mirrored data writes Miroslav Cimerman
2026-11-29 23:52 ` [PATCH v2 1/3] btrfs: zoned: use zone append for every copy of a mirrored write Miroslav Cimerman
2026-11-29 23:52 ` [PATCH v2 2/3] btrfs: zoned: wait for zone finish works at unmount Miroslav Cimerman
2026-11-30 10:27   ` Johannes Thumshirn
2026-11-30 11:07     ` Miroslav Cimerman
2026-11-30 14:04       ` Johannes Thumshirn
2026-11-29 23:52 ` [PATCH v2 3/3] btrfs: zoned: finish raid stripe tree zones once all data is written Miroslav Cimerman
2026-11-30 14:31   ` Johannes Thumshirn
2026-11-30 16:55     ` Miroslav Cimerman

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

all inboxes | Powered by JetHome®