summaryrefslogtreecommitdiff
path: root/drivers/md
diff options
context:
space:
mode:
authorPaul Clements <paul.clements@us.sios.com>2021-04-15 17:17:57 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-05-11 14:04:15 +0200
commit6920cef604fa57f9409e3960413e9cc11f5c5a40 (patch)
tree62186ba54498eb7ff2e568484acb88999758a01f /drivers/md
parent5f2d256875a5288b89b39b4f0d316ecb2306bf48 (diff)
md/raid1: properly indicate failure when ending a failed write request
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@vger.kernel.org # v5.2+ Signed-off-by: Paul Clements <paul.clements@us.sios.com> Signed-off-by: Song Liu <song@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/raid1.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index c7137f50bd1d..a715cb88052c 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -458,6 +458,8 @@ static void raid1_end_write_request(struct bio *bio)
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;