mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] md/raid5: skip stripes with bad reads during reshape to avoid stall
@ 2025-01-25  1:26 Doug V Johnson
  2025-01-25  1:26 ` [PATCH 2/2] md/raid5: warn when failing a read due to bad blocks metadata Doug V Johnson
  2025-01-26  6:27 ` [PATCH 1/2] md/raid5: skip stripes with bad reads during reshape to avoid stall Yu Kuai
  0 siblings, 2 replies; 12+ messages in thread
From: Doug V Johnson @ 2025-01-25  1:26 UTC (permalink / raw)
  Cc: Doug Johnson, Doug V Johnson, Song Liu, Yu Kuai,
	open list:SOFTWARE RAID (Multiple Disks) SUPPORT, open list

While adding an additional drive to a raid6 array, the reshape stalled
at about 13% complete and any I/O operations on the array hung,
creating an effective soft lock. The kernel reported a hung task in
mdXX_reshape thread and I had to use magic sysrq to recover as systemd
hung as well.

I first suspected an issue with one of the underlying block devices and
as precaution I recovered the data in read only mode to a new array, but
it turned out to be in the RAID layer as I was able to recreate the
issue from a superblock dump in sparse files.

After poking around some I discovered that I had somehow propagated the
bad block list to several devices in the array such that a few blocks
were unreable. The bad read reported correctly in userspace during
recovery, but it wasn't obvious that it was from a bad block list
metadata at the time and instead confirmed my bias suspecting hardware
issues

I was able to reproduce the issue with a minimal test case using small
loopback devices. I put a script for this in a github repository:

https://github.com/dougvj/md_badblock_reshape_stall_test

This patch handles bad reads during a reshape by unmarking the
STRIPE_EXPANDING and STRIPE_EXPAND_READY bits effectively skipping the
stripe and then reports the issue in dmesg.

Signed-off-by: Doug V Johnson <dougvj@dougvj.net>
---
 drivers/md/raid5.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 5c79429acc64..0ae9ac695d8e 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -4987,6 +4987,14 @@ static void handle_stripe(struct stripe_head *sh)
 			handle_failed_stripe(conf, sh, &s, disks);
 		if (s.syncing + s.replacing)
 			handle_failed_sync(conf, sh, &s);
+		if (test_bit(STRIPE_EXPANDING, &sh->state)) {
+			pr_warn_ratelimited("md/raid:%s: read error during reshape at %lu",
+					    mdname(conf->mddev),
+					    (unsigned long)sh->sector);
+			/* Abort the current stripe */
+			clear_bit(STRIPE_EXPANDING, &sh->state);
+			clear_bit(STRIPE_EXPAND_READY, &sh->state);
+		}
 	}
 
 	/* Now we check to see if any write operations have recently
-- 
2.48.1


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

end of thread, other threads:[~2025-03-05  6:37 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-25  1:26 [PATCH 1/2] md/raid5: skip stripes with bad reads during reshape to avoid stall Doug V Johnson
2025-01-25  1:26 ` [PATCH 2/2] md/raid5: warn when failing a read due to bad blocks metadata Doug V Johnson
2025-01-26  6:27 ` [PATCH 1/2] md/raid5: skip stripes with bad reads during reshape to avoid stall Yu Kuai
2025-01-27  8:51   ` Doug V Johnson
2025-01-27  9:00   ` [PATCH v2 1/2] md/raid5: freeze reshape when encountering a bad read Doug V Johnson
2025-01-27  9:00     ` [PATCH v2 2/2] md/raid5: warn when failing a read due to bad blocks metadata Doug V Johnson
2025-02-08  2:49     ` [PATCH v2 1/2] md/raid5: freeze reshape when encountering a bad read Yu Kuai
2025-02-18  7:20       ` Doug V Johnson
2025-02-24  9:02         ` [PATCH v3 1/3] " Doug V Johnson
2025-02-24  9:02           ` [PATCH v3 2/3] md/raid5: warn when failing a read due to bad blocks metadata Doug V Johnson
2025-02-24  9:02           ` [PATCH v3 3/3] md/raid5: check for overlapping bad blocks before starting reshape Doug V Johnson
2025-03-05  6:36             ` Yu Kuai

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®