public inbox for linux-raid@vger.kernel.org
 help / color / mirror / Atom feed
From: Paul Clements <paul.clements@us.sios.com>
To: linux-raid@vger.kernel.org
Cc: Song Liu <song@kernel.org>
Subject: [PATCH] md/raid1: properly indicate failure when ending a failed write request
Date: Thu, 15 Apr 2021 17:17:57 -0400	[thread overview]
Message-ID: <607f4fd0.1c69fb81.9f7e7.05ef@mx.google.com> (raw)

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).

Signed-off-by: Paul Clements <paul.clements@us.sios.com>

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

diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index d2378765dc15..ced076ba560e 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -478,6 +478,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;
-- 
2.17.1


             reply	other threads:[~2021-04-20 22:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-15 21:17 Paul Clements [this message]
2021-04-20 23:48 ` [PATCH] md/raid1: properly indicate failure when ending a failed write request Song Liu
2021-04-21 17:38   ` Paul Clements
2021-04-22  5:58     ` Song Liu

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=607f4fd0.1c69fb81.9f7e7.05ef@mx.google.com \
    --to=paul.clements@us.sios.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=song@kernel.org \
    /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