From: Hannes Reinecke <hare@suse.de>
To: Neil Brown <neilb@suse.com>
Cc: Shaohua Li <shli@kernel.org>,
linux-raid@vger.kernel.org, Hannes Reinecke <hare@suse.de>
Subject: [PATCH] Abort pending request for RAID10
Date: Tue, 19 Jan 2016 09:55:26 +0100 [thread overview]
Message-ID: <1453193726-4617-1-git-send-email-hare@suse.de> (raw)
RAID10 delays the write until the bitmap has been updated.
So it really should check if the device is still working
before sending requests, otherwise it'll happily sending
I/O to a known faulty device.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
drivers/md/raid10.c | 38 ++++++++++++++++++++++++++++++++++++--
1 file changed, 36 insertions(+), 2 deletions(-)
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index d4efed7..74369c2 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -902,12 +902,29 @@ static void flush_pending_writes(struct r10conf *conf)
while (bio) { /* submit pending writes */
struct bio *next = bio->bi_next;
+ struct r10bio *r10_bio = bio->bi_private;
+ struct md_rdev *rdev = NULL;
+ int dev, slot, repl;
bio->bi_next = NULL;
+ dev = find_bio_disk(conf, r10_bio, bio, &slot, &repl);
+ if (repl)
+ rdev = conf->mirrors[dev].replacement;
+ if (!rdev) {
+ smp_rmb();
+ repl = 0;
+ rdev = conf->mirrors[dev].rdev;
+ }
if (unlikely((bio->bi_rw & REQ_DISCARD) &&
!blk_queue_discard(bdev_get_queue(bio->bi_bdev))))
/* Just ignore it */
bio_endio(bio);
- else
+ else if (test_bit(Faulty, &rdev->flags)) {
+ if (test_bit(Timeout, &rdev->flags))
+ bio->bi_error = -ETIMEDOUT;
+ else
+ bio->bi_error = -EIO;
+ bio_endio(bio);
+ } else
generic_make_request(bio);
bio = next;
}
@@ -1079,12 +1096,29 @@ static void raid10_unplug(struct blk_plug_cb *cb, bool from_schedule)
while (bio) { /* submit pending writes */
struct bio *next = bio->bi_next;
+ struct r10bio *r10_bio = bio->bi_private;
+ struct md_rdev *rdev = NULL;
+ int dev, slot, repl;
bio->bi_next = NULL;
+ dev = find_bio_disk(conf, r10_bio, bio, &slot, &repl);
+ if (repl)
+ rdev = conf->mirrors[dev].replacement;
+ if (!rdev) {
+ smp_rmb();
+ repl = 0;
+ rdev = conf->mirrors[dev].rdev;
+ }
if (unlikely((bio->bi_rw & REQ_DISCARD) &&
!blk_queue_discard(bdev_get_queue(bio->bi_bdev))))
/* Just ignore it */
bio_endio(bio);
- else
+ else if (test_bit(Faulty, &rdev->flags)) {
+ if (test_bit(Timeout, &rdev->flags))
+ bio->bi_error = -ETIMEDOUT;
+ else
+ bio->bi_error = -EIO;
+ bio_endio(bio);
+ } else
generic_make_request(bio);
bio = next;
}
--
1.8.5.6
next reply other threads:[~2016-01-19 8:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-19 8:55 Hannes Reinecke [this message]
2016-01-19 9:05 ` [PATCH] Abort pending request for RAID10 kbuild test robot
2016-01-19 18:53 ` Shaohua Li
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=1453193726-4617-1-git-send-email-hare@suse.de \
--to=hare@suse.de \
--cc=linux-raid@vger.kernel.org \
--cc=neilb@suse.com \
--cc=shli@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