btrfs: zoned: unwritten copies of mirrored data writes
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest2 patches 0 repliesNew
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | btrfs: zoned: use zone append for every copy of a mirrored writefs/ | +1 | 0 replies | |
| 2/2 | btrfs: zoned: finish raid stripe tree zones once all data is writtenfs/ fs/ | +35 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/2] btrfs: zoned: unwritten copies of mirrored data writes
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 errorsA 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/[email protected]/
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
Signature · 1 line
2.53.0