summaryrefslogtreecommitdiff
path: root/drivers/md/raid1-10.c
diff options
context:
space:
mode:
authorYu Kuai <yukuai3@huawei.com>2025-05-27 16:14:07 +0800
committerYu Kuai <yukuai3@huawei.com>2025-05-30 15:46:45 +0800
commit9f346f7d4ea73692b82f5102ca8698e4040469ea (patch)
tree63273890112da528f8baebe0f7d2ed261c5e4d08 /drivers/md/raid1-10.c
parent39d86db34e41b96bd86f1955cd0ce6cd9c5fca4c (diff)
md/raid1,raid10: don't handle IO error for REQ_RAHEAD and REQ_NOWAIT
IO with REQ_RAHEAD or REQ_NOWAIT can fail early, 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. Fixes: e879a0d9cb08 ("md/raid1,raid10: don't ignore IO flags") Reported-and-tested-by: Mikulas Patocka <mpatocka@redhat.com> Closes: https://lore.kernel.org/all/34fa755d-62c8-4588-8ee1-33cb1249bdf2@redhat.com/ Link: https://lore.kernel.org/linux-raid/20250527081407.3004055-1-yukuai1@huaweicloud.com Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Diffstat (limited to 'drivers/md/raid1-10.c')
-rw-r--r--drivers/md/raid1-10.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/md/raid1-10.c b/drivers/md/raid1-10.c
index c7efd8aab675..b8b3a9069701 100644
--- a/drivers/md/raid1-10.c
+++ b/drivers/md/raid1-10.c
@@ -293,3 +293,13 @@ static inline bool raid1_should_read_first(struct mddev *mddev,
return false;
}
+
+/*
+ * bio with REQ_RAHEAD or REQ_NOWAIT can fail at anytime, before such IO is
+ * submitted to the underlying disks, hence don't record badblocks or retry
+ * in this case.
+ */
+static inline bool raid1_should_handle_error(struct bio *bio)
+{
+ return !(bio->bi_opf & (REQ_RAHEAD | REQ_NOWAIT));
+}