[PATCH v4 0/3] md/raid5: freeze and interrupt reshape when handling failed reshape
From: Doug V Johnson
Date: Fri Oct 16 2026 - 00:25:54 EST
From: Doug Johnson <me@xxxxxxxxx>
Some time ago I had a RAID6 array reshape stall on me creating a hung
kernel thread that I couldn't recover from without a magic SysRq. I
was able to reproduce the issue with a test case:
https://github.com/dougvj/md_badblock_reshape_stall_test
A patch was recently merged that stopped the kernel stall:
Commit 788e4139463f ("md/raid5: fix reshape deadlock while
failed devices more than max degraded"), by Chen Cheng:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=788e4139463f74b945600237f7186411015d996e
Submission and review:
https://lists.openwall.net/linux-kernel/2026/07/11/656
In v3 of this patch series, I had similar reshape failure handling,
but Chen's approach was more correct. However, it doesn't account for
reshape failures that occur even when all devices are active and in
sync, such as when there are more bad blocks in a stripe than can be
recovered at a given RAID level.
I have a test fixture for this published here:
Link: https://github.com/dougvj/md-raid-reshape-badblock-corruption-test
This clearly demonstrates that there are still gaps in handling
unrecoverable reads during a reshape.
In this patch series the gaps are addressed:
1. If an unrecoverable read failure occurs during the reshape, stop the
reshape using Chen's approach but always mark the reshape frozen
and interrupted to improve array recoverability conditions in the
case where devices are online but still produce unrecoverable reads.
2. Detection of known bad read conditions from bad block metadata before
starting a reshape to prevent starting a reshape that will fail.
3. Additional kernel logging for bad block metadata paths for improved
cause tracing.
With these 3 changes, this unusual situation is significantly mitigated.
Claude Opus 4.6 was used early 2026 to assist with the sweep overlap
logic. Codex GPT-6.1-Sol assisted with the upstream rebase, preflight
implementation, regression analysis, QEMU fixtures, testing, and patch
preparation. Claude Fable 5.1 reviewed the series at medium effort;
its findings prompted targeted reproductions and the degraded-member
correction.
I wrote the prose in the code and commits, except for the schematic
example in patch 1, which Codex helped draft. Codex also assisted
with the citations and this disclosure. GPT-6 Astra independently
reviewed the series with an isolated context.
Assisted-by: LLM
Doug V Johnson (3):
md/raid5: freeze and interrupt reshape when handling failed reshape
md/raid5: do not reshape if overlapping rdev bad block ranges prevent
it
md/raid5: warn when a read fails due in some part to bad-block
metadata
drivers/md/raid5.c | 108 +++++++++++++++++++++++++++++++++++++++++++++
drivers/md/raid5.h | 2 +-
2 files changed, 109 insertions(+), 1 deletion(-)
base-commit: 4056b3c9d3c92ea45955641dbafeb9b960e146ef
--
2.54.0