aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorShaohua Li <shli@fb.com>2016-10-06 17:13:52 -0400
committerShaohua Li <shli@fb.com>2016-10-24 18:28:17 -0400
commit579ed34f7b751b8add233cba4cf755258dbdd60a (patch)
tree455b3afa213f757a34a8c325c070498143e06ce5 /drivers/md
parente3f948cd3283e4fbe5907f1f3967c839912f480e (diff)
RAID10: ignore discard error
This is the counterpart of raid10 fix. If a write error occurs, raid10 will try to rewrite the bio in small chunk size. If the rewrite fails, raid10 will record the error in bad block. narrow_write_error will always use WRITE for the bio, but actually it could be a discard. Since discard bio hasn't payload, write the bio will cause different issues. But discard error isn't fatal, we can safely ignore it. This is what this patch does. This issue should exist since discard is added, but only exposed with recent arbitrary bio size feature. Cc: Sitsofe Wheeler <sitsofe@gmail.com> Cc: stable@vger.kernel.org (v3.6) Signed-off-by: Shaohua Li <shli@fb.com>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/raid10.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index be1a9fca3b2d..39fddda2fef2 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -447,6 +447,9 @@ static void raid10_end_write_request(struct bio *bio)
447 struct r10conf *conf = r10_bio->mddev->private; 447 struct r10conf *conf = r10_bio->mddev->private;
448 int slot, repl; 448 int slot, repl;
449 struct md_rdev *rdev = NULL; 449 struct md_rdev *rdev = NULL;
450 bool discard_error;
451
452 discard_error = bio->bi_error && bio_op(bio) == REQ_OP_DISCARD;
450 453
451 dev = find_bio_disk(conf, r10_bio, bio, &slot, &repl); 454 dev = find_bio_disk(conf, r10_bio, bio, &slot, &repl);
452 455
@@ -460,7 +463,7 @@ static void raid10_end_write_request(struct bio *bio)
460 /* 463 /*
461 * this branch is our 'one mirror IO has finished' event handler: 464 * this branch is our 'one mirror IO has finished' event handler:
462 */ 465 */
463 if (bio->bi_error) { 466 if (bio->bi_error && !discard_error) {
464 if (repl) 467 if (repl)
465 /* Never record new bad blocks to replacement, 468 /* Never record new bad blocks to replacement,
466 * just fail it. 469 * just fail it.
@@ -503,7 +506,7 @@ static void raid10_end_write_request(struct bio *bio)
503 if (is_badblock(rdev, 506 if (is_badblock(rdev,
504 r10_bio->devs[slot].addr, 507 r10_bio->devs[slot].addr,
505 r10_bio->sectors, 508 r10_bio->sectors,
506 &first_bad, &bad_sectors)) { 509 &first_bad, &bad_sectors) && !discard_error) {
507 bio_put(bio); 510 bio_put(bio);
508 if (repl) 511 if (repl)
509 r10_bio->devs[slot].repl_bio = IO_MADE_GOOD; 512 r10_bio->devs[slot].repl_bio = IO_MADE_GOOD;