From: Greg Kroah-Hartman Date: Fri, 24 Apr 2026 12:34:39 +0000 (+0200) Subject: 6.6-stable patches X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=5903683041c7da9fdd6b7e616acd4d2ac7a8acfa;p=thirdparty%2Fkernel%2Fstable-queue.git 6.6-stable patches added patches: md-raid1-fix-data-lost-for-writemostly-rdev.patch --- 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 index 0000000000..918ff6bb7b --- /dev/null +++ b/queue-6.6/md-raid1-fix-data-lost-for-writemostly-rdev.patch @@ -0,0 +1,39 @@ +From 93dec51e716db88f32d770dc9ab268964fff320b Mon Sep 17 00:00:00 2001 +From: Yu Kuai +Date: Wed, 3 Sep 2025 09:41:40 +0800 +Subject: md/raid1: fix data lost for writemostly rdev + +From: Yu Kuai + +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 +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 +Reviewed-by: Li Nan +Signed-off-by: Greg Kroah-Hartman +--- + 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; diff --git a/queue-6.6/series b/queue-6.6/series index 6e07f32c53..2563c81c8a 100644 --- a/queue-6.6/series +++ b/queue-6.6/series @@ -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