mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] btrfs: zoned: unwritten copies of mirrored data writes
@ 2026-11-22  3:48 Miroslav Cimerman
  2026-11-22  3:48 ` [PATCH 1/2] btrfs: zoned: use zone append for every copy of a mirrored write Miroslav Cimerman
  2026-11-22  3:48 ` [PATCH 2/2] btrfs: zoned: finish raid stripe tree zones once all data is written Miroslav Cimerman
  0 siblings, 2 replies; 3+ messages in thread
From: Miroslav Cimerman @ 2026-11-22  3:48 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. Two bugs cause it. Both need writes
to one zone to arrive in a different order than they were allocated,
which parallel writers do.

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

2/2: 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.

Tested in QEMU with KASAN on for-next 184fa2c40f5c, with two zoned
null_blk devices (1 GiB, 16 MiB zones, 8 active zones) and RAID1 data
and metadata on the raid stripe tree. 8 direct writers each wrote 4
files of 8 MiB, and 16 buffered writers did the same with fsync. At
least two runs each:

                direct, 8 writers          buffered, 16 writers
  for-next      5 to 8 of 32 writes        writes succeed, but some
                fail with EIO              copies are not written
  with 1/2      writes succeed, but some   no errors
                copies are not written
  with 2/2      writes succeed, but some   writes succeed, but some
                copies are not written     copies are not written
  with both     no errors                  no errors

A copy that is not written shows up as a write error in the device
statistics ("errs: wr").

The series is based on 6b72ea3e75f4, which differs from the tested
commit only in qgroup.c.

On for-next, the next mount failed in 3 of 4 runs with "write pointer
offset mismatch". With both patches, it worked in every run. With the
single data profile, for-next shows no failure in the same tests. A set
of degraded-mount tests and the btrfs self-tests show no new failure
with the patches, also on top of my RAID1 series [1].

Each patch alone leaves the failures of the other, so they are sent
together. They apply to for-next without [1].

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.

FuzzyRAID, a fault-injection tester for RAID that is not public at the
moment, reproduced both bugs on its own and found no error with the
patches. With 1/2 missing, a scrub found the copy on one device corrupt
after the writes had succeeded.

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

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

 fs/btrfs/bio.c         |  1 +
 fs/btrfs/block-group.h |  6 ++++++
 fs/btrfs/zoned.c       | 33 +++++++++++++++++++++++++++++----
 3 files changed, 36 insertions(+), 4 deletions(-)


base-commit: 6b72ea3e75f4d20a0ad1e9c95d7f9f1b8f192b92
-- 
2.53.0


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

end of thread, other threads:[~2026-11-22  3:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-22  3:48 [PATCH 0/2] btrfs: zoned: unwritten copies of mirrored data writes Miroslav Cimerman
2026-11-22  3:48 ` [PATCH 1/2] btrfs: zoned: use zone append for every copy of a mirrored write Miroslav Cimerman
2026-11-22  3:48 ` [PATCH 2/2] btrfs: zoned: finish raid stripe tree zones once all data is written 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®