mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/8] md/raid1,raid10: fix writes acknowledged before a failure is recorded
@ 2026-11-27  0:32 Miroslav Cimerman
  2026-11-27  0:32 ` [PATCH 1/8] md/raid1,raid10: fail held writes when the array fails Miroslav Cimerman
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Miroslav Cimerman @ 2026-11-27  0:32 UTC (permalink / raw)
  To: Song Liu, Yu Kuai
  Cc: Li Nan, Xiao Ni, NeilBrown, Mariusz Tkaczyk, Kenta Akagi,
	linux-raid, linux-kernel

raid1 and raid10 hold a write that failed on one device until the
superblock records that failure. This series fixes cases where a write
still completes with success, although its data is not safe:

1/8: the superblock write fails on the last working device, and reads
     can return old data after a restart.
2/8: raid10 waits for blocked devices by copy index, not by device.
3/8: as 1/8, for a write that waited for the superblock update.
4/8: with a bad block log, the device with the only good copy fails,
     and reads of the write return EIO.
5/8: a write whose copy fails on a device that is already faulty is
     not held at all.
6/8: raid1 can release a held write after it marks the device faulty
     and before it requests the superblock update.
7/8: a device that fails between the wait for blocked devices and the
     selection of the devices for a write is skipped, and the write is
     not held.
8/8: with write-behind, a write whose copy failed on a device completes
     once its write-mostly copy is done.

The MD_BROKEN checks skip dm-raid, which does not reject writes when
MD_BROKEN is set, so dm-raid can still acknowledge such writes. I have a
fix for dm-raid and a follow-up that drops these exceptions, both
tested, and will send them to dm-devel on top of this series. The other
changes apply to dm-raid too.

Patch 1 fixes a bug found with FuzzyRAID, a fault injection fuzzer for
RAID implementations. Patches 2 to 8 fix related cases found while
analyzing it. I used an LLM (Claude) for this series: it found the bugs
fixed by patches 2 to 8, drafted the code of patches 2, 4, 5, 6, 7 and 8
and the changelogs, and wrote and ran the tests. I reviewed everything.

Tested on md-7.5 with RAID1 (2 disks; 3 disks in controls) and RAID10 (2
and 4 disks, near and far), with and without a bad block log, RAID1 also
with a bitmap and with write-behind, and with failfast: 30 fault cases
in which an acknowledged write was lost or read back old data now fail
the write, and 20 controls give the same results as before (some now
wait for the superblock update). The cases for patches 6, 7 and 8
compare with the series without that patch, those for 6 and 7 with
delays added only for the test. All others compare with stock md-7.5. A
raid10 smoke test without faults (4-disk and 3-disk near, 2-disk far and
offset, with discards) passes too. Not tested: the race that patch 2
closes, MD_FAILLAST_DEV, dm-raid, replacements and reshape.

Miroslav Cimerman (8):
  md/raid1,raid10: fail held writes when the array fails
  md/raid10: wait for the devices of the write in wait_blocked_dev()
  md/raid1,raid10: fail writes that waited while the array failed
  md/raid1,raid10: fail held writes that no working device has
  md/raid1,raid10: hold writes that fail on a faulty device
  md/raid1: set MD_SB_CHANGE_PENDING under device_lock in raid1_error()
  md/raid1,raid10: hold writes that skip a newly failed device
  md/raid1: hold write-behind writes that failed on a device

 drivers/md/raid1-10.c | 12 ++++++
 drivers/md/raid1.c    | 83 +++++++++++++++++++++++++++++++-------
 drivers/md/raid10.c   | 92 +++++++++++++++++++++++++++++++++----------
 3 files changed, 152 insertions(+), 35 deletions(-)


base-commit: c526b7cd32f75fea6021ffdab287b81cf38ddeb7
-- 
2.53.0


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

end of thread, other threads:[~2026-11-27  0:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-27  0:32 [PATCH 0/8] md/raid1,raid10: fix writes acknowledged before a failure is recorded Miroslav Cimerman
2026-11-27  0:32 ` [PATCH 1/8] md/raid1,raid10: fail held writes when the array fails Miroslav Cimerman
2026-11-27  0:32 ` [PATCH 2/8] md/raid10: wait for the devices of the write in wait_blocked_dev() Miroslav Cimerman
2026-11-27  0:32 ` [PATCH 3/8] md/raid1,raid10: fail writes that waited while the array failed Miroslav Cimerman
2026-11-27  0:32 ` [PATCH 4/8] md/raid1,raid10: fail held writes that no working device has Miroslav Cimerman
2026-11-27  0:32 ` [PATCH 5/8] md/raid1,raid10: hold writes that fail on a faulty device Miroslav Cimerman
2026-11-27  0:32 ` [PATCH 6/8] md/raid1: set MD_SB_CHANGE_PENDING under device_lock in raid1_error() Miroslav Cimerman
2026-11-27  0:32 ` [PATCH 7/8] md/raid1,raid10: hold writes that skip a newly failed device Miroslav Cimerman
2026-11-27  0:32 ` [PATCH 8/8] md/raid1: hold write-behind writes that failed on a device 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®