diff options
Diffstat (limited to 'drivers/md/raid10.c')
-rw-r--r-- | drivers/md/raid10.c | 7 |
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; |