[PATCH 0/3] btrfs: zoned: handle a failed zone finish on one device
From: Miroslav Cimerman
Date: Sun Nov 22 2026 - 18:23:31 EST
When ZONE_FINISH fails on one device, btrfs can lose a completed write
or turn read-only, even if the profile tolerates the failed device.
1/3: since 7.3, a failed zone finish fails the ordered extent whose
completion started it. The data is written, but the file keeps the old
data in the range of that extent.
2/3: since 6.18, one failed device of a RAID1 metadata block group turns
the filesystem read-only. The patch tolerates the failure when the zones
are full. A partly written block group still stops at the first error.
Finishing its other zones could make the next mount fail.
3/3: relocation hits a WARN_ON() when a device fails ZONE_FINISH.
Tested in QEMU with KASAN on for-next 65101fe10b30, with two zoned
null_blk devices (1 GiB, 16 MiB zones, zone capacity 12 or 16 MiB). A
test-only module parameter fails the next ZONE_FINISH on one device.
Each RAID1 case ran with a failure on each device:
for-next with the series
RAID1 or single data, an last 1 MiB reads all new data
O_DIRECT overwrite fills old data, first
the block group read gets EIO
RAID1 metadata fills forced read-only stays writable,
a block group remount works
relocation, RAID1 or WARN_ON() two warning
single data messages
The relocated block groups are partly written, so 2/3 does not tolerate
the failure there.
The btrfs self-tests pass. Degraded-mount tests and parallel writers
show the same failures as on for-next. These are the bugs fixed by my
pending series [1], [2] and [3]. fstests was not run.
Found with FuzzyRAID, a fault-injection tester for RAID that is not
public at the moment. It ran the series on an older for-next with my
other pending zoned fixes. Its runs showed no lost write and nothing
new. 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/20261121134550.216217-1-mc@xxxxxxxxxxx/
[2] https://lore.kernel.org/linux-btrfs/20261121205657.1108500-1-mc@xxxxxxxxxxx/
[3] https://lore.kernel.org/linux-btrfs/20261122034826.2333981-1-mc@xxxxxxxxxxx/
Miroslav Cimerman (3):
btrfs: zoned: do not fail an ordered extent on a zone finish error
btrfs: zoned: tolerate a failed zone finish on a full block group
btrfs: zoned: do not WARN when zones fail to finish before relocation
fs/btrfs/relocation.c | 5 +++-
fs/btrfs/zoned.c | 59 +++++++++++++++++++++++++++++++++++++------
2 files changed, 55 insertions(+), 9 deletions(-)
base-commit: 65101fe10b3008186b813b628ee3a611b0e70ce6
--
2.53.0