This is a note to let you know that I've just added the patch titled md/raid1: properly indicate failure when ending a failed write request to the 5.12-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: md-raid1-properly-indicate-failure-when-ending-a-failed-write-request.patch and it can be found in the queue-5.12 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 2417b9869b81882ab90fd5ed1081a1cb2d4db1dd Mon Sep 17 00:00:00 2001 From: Paul Clements <paul.clements@xxxxxxxxxxx> Date: Thu, 15 Apr 2021 17:17:57 -0400 Subject: md/raid1: properly indicate failure when ending a failed write request From: Paul Clements <paul.clements@xxxxxxxxxxx> commit 2417b9869b81882ab90fd5ed1081a1cb2d4db1dd upstream. This patch addresses a data corruption bug in raid1 arrays using bitmaps. Without this fix, the bitmap bits for the failed I/O end up being cleared. Since we are in the failure leg of raid1_end_write_request, the request either needs to be retried (R1BIO_WriteError) or failed (R1BIO_Degraded). Fixes: eeba6809d8d5 ("md/raid1: end bio when the device faulty") Cc: stable@xxxxxxxxxxxxxxx # v5.2+ Signed-off-by: Paul Clements <paul.clements@xxxxxxxxxxx> Signed-off-by: Song Liu <song@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/md/raid1.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -478,6 +478,8 @@ static void raid1_end_write_request(stru if (!test_bit(Faulty, &rdev->flags)) set_bit(R1BIO_WriteError, &r1_bio->state); else { + /* Fail the request */ + set_bit(R1BIO_Degraded, &r1_bio->state); /* Finished with this branch */ r1_bio->bios[mirror] = NULL; to_put = bio; Patches currently in stable-queue which might be from paul.clements@xxxxxxxxxxx are queue-5.12/md-raid1-properly-indicate-failure-when-ending-a-failed-write-request.patch