[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250520064425.1726564-1-yukuai1@huaweicloud.com>
Date: Tue, 20 May 2025 14:44:25 +0800
From: Yu Kuai <yukuai1@...weicloud.com>
To: mpatocka@...hat.com,
zdenek.kabelac@...il.com,
song@...nel.org,
yukuai3@...wei.com
Cc: linux-raid@...r.kernel.org,
dm-devel@...ts.linux.dev,
linux-kernel@...r.kernel.org,
yukuai1@...weicloud.com,
yi.zhang@...wei.com,
yangerkun@...wei.com,
johnny.chenyi@...wei.com
Subject: [PATCH] md/raid1,raid10: don't handle read ahead error
From: Yu Kuai <yukuai3@...wei.com>
Read ahead IO can fail early in the driver, even if the storage medium
is fine, hence record badblocks or remove the disk from array does not
make sense.
This problem if found by lvm2 test lvcreate-large-raid, where dm-zero
will fail read ahead IO directly.
Reported-and-tested-by: Mikulas Patocka <mpatocka@...hat.com>
Closes: https://lore.kernel.org/all/34fa755d-62c8-4588-8ee1-33cb1249bdf2@redhat.com/
Signed-off-by: Yu Kuai <yukuai3@...wei.com>
---
drivers/md/raid1.c | 11 +++++++----
drivers/md/raid10.c | 3 +++
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 657d481525be..2e4e9de2cfd7 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -373,14 +373,17 @@ static void raid1_end_read_request(struct bio *bio)
*/
update_head_pos(r1_bio->read_disk, r1_bio);
- if (uptodate)
+ if (uptodate) {
set_bit(R1BIO_Uptodate, &r1_bio->state);
- else if (test_bit(FailFast, &rdev->flags) &&
- test_bit(R1BIO_FailFast, &r1_bio->state))
+ } else if (test_bit(FailFast, &rdev->flags) &&
+ test_bit(R1BIO_FailFast, &r1_bio->state)) {
/* This was a fail-fast read so we definitely
* want to retry */
;
- else {
+ } else if (bio->bi_opf & REQ_RAHEAD) {
+ /* don't handle readahead error, which can fail at anytime. */
+ uptodate = 1;
+ } else {
/* If all other devices have failed, we want to return
* the error upwards rather than fail the last device.
* Here we redefine "uptodate" to mean "Don't want to retry"
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index dce06bf65016..4d51aaf3b39b 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -399,6 +399,9 @@ static void raid10_end_read_request(struct bio *bio)
* wait for the 'master' bio.
*/
set_bit(R10BIO_Uptodate, &r10_bio->state);
+ } else if (bio->bi_opf & REQ_RAHEAD) {
+ /* don't handle readahead error, which can fail at anytime. */
+ uptodate = 1;
} else {
/* If all other devices that store this block have
* failed, we want to return the error upwards rather
--
2.39.2
Powered by blists - more mailing lists