* [PATCH] md/raid10: Prevent data corruption after a rejected backwards reshape
@ 2026-11-08 8:47 Chris Down
0 siblings, 0 replies; only message in thread
From: Chris Down @ 2026-11-08 8:47 UTC (permalink / raw)
To: Song Liu, Yu Kuai; +Cc: Li Nan, Xiao Ni, linux-raid, linux-kernel, kernel-team
A rejected backwards RAID10 reshape can leave the array using the
requested geometry because raid10_start_reshape() updates conf->geo
before checking whether the new geometry can hold the current array
size. If the check fails, we return -EINVAL with the new geometry still
in place. Subsequent I/O then uses a layout the data hasn't been moved
to, so reads can return the wrong data and writes can silently corrupt
the array.
To fix this, let's take the existing abort path to restore the old
geometry.
Fixes: 3ea7daa5d7fd ("md/raid10: add reshape support")
Cc: <stable@vger.kernel.org>
Signed-off-by: Chris Down <chris@chrisdown.name>
---
drivers/md/raid10.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 066c43154497..4ade0cf3281f 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -4393,7 +4393,8 @@ static int raid10_start_reshape(struct mddev *mddev)
spin_unlock_irq(&conf->device_lock);
pr_warn("md/raid10:%s: array size must be reduce before number of disks\n",
mdname(mddev));
- return -EINVAL;
+ ret = -EINVAL;
+ goto abort;
}
mddev->resync_max_sectors = size;
conf->reshape_progress = size;
base-commit: 47e1b18f38d74015cb9fd30b5ff2a1eb88e77d31
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-08 8:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-08 8:47 [PATCH] md/raid10: Prevent data corruption after a rejected backwards reshape Chris Down
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®