linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mikulas Patocka <mpatocka@redhat.com>
To: Yu Kuai <yukuai1@huaweicloud.com>
Cc: Song Liu <song@kernel.org>,
	zkabelac@redhat.com,  linux-raid@vger.kernel.org,
	dm-devel@lists.linux.dev,  "yukuai (C)" <yukuai3@huawei.com>
Subject: [PATCH] md/raid1,raid10: don't pass down the REQ_RAHEAD flag
Date: Mon, 19 May 2025 12:09:28 +0200 (CEST)	[thread overview]
Message-ID: <c561484d-f056-2531-8fd6-27be0dabca05@redhat.com> (raw)
In-Reply-To: <04231d91-cf1f-a932-f24f-996f888f0dd7@redhat.com>

The commit e879a0d9cb08 ("md/raid1,raid10: don't ignore IO flags") breaks
the lvm2 test shell/lvcreate-large-raid.sh. The commit changes raid1 and
raid10 to pass down all the flags from the incoming bio. The problem is
when we pass down the REQ_RAHEAD flag - bios with this flag may fail
anytime and md-raid is not prepared to handle this failure.

This commit fixes the code, so that the REQ_RAHEAD flag is not passed
down.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Fixes: e879a0d9cb08 ("md/raid1,raid10: don't ignore IO flags")

---
 drivers/md/raid1.c  |    1 +
 drivers/md/raid10.c |    1 +
 2 files changed, 2 insertions(+)

Index: linux-2.6/drivers/md/raid1.c
===================================================================
--- linux-2.6.orig/drivers/md/raid1.c
+++ linux-2.6/drivers/md/raid1.c
@@ -1404,6 +1404,7 @@ static void raid1_read_request(struct md
 	read_bio->bi_iter.bi_sector = r1_bio->sector +
 		mirror->rdev->data_offset;
 	read_bio->bi_end_io = raid1_end_read_request;
+	read_bio->bi_opf &= ~REQ_RAHEAD;
 	if (test_bit(FailFast, &mirror->rdev->flags) &&
 	    test_bit(R1BIO_FailFast, &r1_bio->state))
 	        read_bio->bi_opf |= MD_FAILFAST;
Index: linux-2.6/drivers/md/raid10.c
===================================================================
--- linux-2.6.orig/drivers/md/raid10.c
+++ linux-2.6/drivers/md/raid10.c
@@ -1263,6 +1263,7 @@ static void raid10_write_one_disk(struct
 	mbio->bi_iter.bi_sector	= (r10_bio->devs[n_copy].addr +
 				   choose_data_offset(r10_bio, rdev));
 	mbio->bi_end_io	= raid10_end_write_request;
+	mbio->bi_opf &= ~REQ_RAHEAD;
 	if (!replacement && test_bit(FailFast,
 				     &conf->mirrors[devnum].rdev->flags)
 			 && enough(conf, devnum))


  reply	other threads:[~2025-05-19 10:09 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-16 16:00 LVM2 test breakage Mikulas Patocka
2025-05-19  1:11 ` Yu Kuai
2025-05-19  6:41   ` Yu Kuai
2025-05-19 10:10     ` Mikulas Patocka
     [not found]       ` <81c5847a-cfd8-4f9f-892c-62cca3d17e63@redhat.com>
2025-05-19 11:07         ` Yu Kuai
2025-05-19 13:55           ` Zdenek Kabelac
2025-05-20  1:45             ` Yu Kuai
2025-05-20  1:53               ` Yu Kuai
2025-05-20  3:47                 ` Su Yue
2025-05-20  6:12                   ` Yu Kuai
2025-05-19 10:08   ` Mikulas Patocka
2025-05-19 10:09     ` Mikulas Patocka [this message]
2025-05-19 11:19       ` [PATCH] md/raid1,raid10: don't pass down the REQ_RAHEAD flag Yu Kuai
2025-05-19 11:39         ` Yu Kuai
2025-05-19 12:05           ` Mikulas Patocka
2025-05-19 12:34             ` Yu Kuai
2025-05-20  6:28               ` Yu Kuai
2025-05-19 12:15           ` Mikulas Patocka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c561484d-f056-2531-8fd6-27be0dabca05@redhat.com \
    --to=mpatocka@redhat.com \
    --cc=dm-devel@lists.linux.dev \
    --cc=linux-raid@vger.kernel.org \
    --cc=song@kernel.org \
    --cc=yukuai1@huaweicloud.com \
    --cc=yukuai3@huawei.com \
    --cc=zkabelac@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).