]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.6-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 24 Apr 2026 12:34:39 +0000 (14:34 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 24 Apr 2026 12:34:39 +0000 (14:34 +0200)
added patches:
md-raid1-fix-data-lost-for-writemostly-rdev.patch

queue-6.6/md-raid1-fix-data-lost-for-writemostly-rdev.patch [new file with mode: 0644]
queue-6.6/series

diff --git a/queue-6.6/md-raid1-fix-data-lost-for-writemostly-rdev.patch b/queue-6.6/md-raid1-fix-data-lost-for-writemostly-rdev.patch
new file mode 100644 (file)
index 0000000..918ff6b
--- /dev/null
@@ -0,0 +1,39 @@
+From 93dec51e716db88f32d770dc9ab268964fff320b Mon Sep 17 00:00:00 2001
+From: Yu Kuai <yukuai3@huawei.com>
+Date: Wed, 3 Sep 2025 09:41:40 +0800
+Subject: md/raid1: fix data lost for writemostly rdev
+
+From: Yu Kuai <yukuai3@huawei.com>
+
+commit 93dec51e716db88f32d770dc9ab268964fff320b upstream.
+
+If writemostly is enabled, alloc_behind_master_bio() will allocate a new
+bio for rdev, with bi_opf set to 0. Later, raid1_write_request() will
+clone from this bio, hence bi_opf is still 0 for the cloned bio. Submit
+this cloned bio will end up to be read, causing write data lost.
+
+Fix this problem by inheriting bi_opf from original bio for
+behind_mast_bio.
+
+Fixes: e879a0d9cb08 ("md/raid1,raid10: don't ignore IO flags")
+Reported-and-tested-by: Ian Dall <ian@beware.dropbear.id.au>
+Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220507
+Link: https://lore.kernel.org/linux-raid/20250903014140.3690499-1-yukuai1@huaweicloud.com
+Signed-off-by: Yu Kuai <yukuai3@huawei.com>
+Reviewed-by: Li Nan <linan122@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/md/raid1.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/md/raid1.c
++++ b/drivers/md/raid1.c
+@@ -1119,7 +1119,7 @@ static void alloc_behind_master_bio(stru
+       int i = 0;
+       struct bio *behind_bio = NULL;
+-      behind_bio = bio_alloc_bioset(NULL, vcnt, 0, GFP_NOIO,
++      behind_bio = bio_alloc_bioset(NULL, vcnt, bio->bi_opf, GFP_NOIO,
+                                     &r1_bio->mddev->bio_set);
+       if (!behind_bio)
+               return;
index 6e07f32c53b084dd069e306223d124af1c91a873..2563c81c8a8dc5299d22d9e25523ae58c6791524 100644 (file)
@@ -163,3 +163,4 @@ crypto-ccp-don-t-attempt-to-copy-csr-to-userspace-if-psp-command-failed.patch
 crypto-ccp-don-t-attempt-to-copy-pdh-cert-to-userspace-if-psp-command-failed.patch
 crypto-ccp-don-t-attempt-to-copy-id-to-userspace-if-psp-command-failed.patch
 rxrpc-fix-missing-validation-of-ticket-length-in-non-xdr-key-preparsing.patch
+md-raid1-fix-data-lost-for-writemostly-rdev.patch