diff options
| -rw-r--r-- | drivers/md/raid1.c | 12 | ||||
| -rw-r--r-- | drivers/md/raid10.c | 12 |
2 files changed, 22 insertions, 2 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 851023e2ba5d..f2db7a9d5964 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
| @@ -427,7 +427,17 @@ static void raid1_end_write_request(struct bio *bio, int error) | |||
| 427 | 427 | ||
| 428 | r1_bio->bios[mirror] = NULL; | 428 | r1_bio->bios[mirror] = NULL; |
| 429 | to_put = bio; | 429 | to_put = bio; |
| 430 | set_bit(R1BIO_Uptodate, &r1_bio->state); | 430 | /* |
| 431 | * Do not set R1BIO_Uptodate if the current device is | ||
| 432 | * rebuilding or Faulty. This is because we cannot use | ||
| 433 | * such device for properly reading the data back (we could | ||
| 434 | * potentially use it, if the current write would have felt | ||
| 435 | * before rdev->recovery_offset, but for simplicity we don't | ||
| 436 | * check this here. | ||
| 437 | */ | ||
| 438 | if (test_bit(In_sync, &conf->mirrors[mirror].rdev->flags) && | ||
| 439 | !test_bit(Faulty, &conf->mirrors[mirror].rdev->flags)) | ||
| 440 | set_bit(R1BIO_Uptodate, &r1_bio->state); | ||
| 431 | 441 | ||
| 432 | /* Maybe we can clear some bad blocks. */ | 442 | /* Maybe we can clear some bad blocks. */ |
| 433 | if (is_badblock(conf->mirrors[mirror].rdev, | 443 | if (is_badblock(conf->mirrors[mirror].rdev, |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 018741ba9310..8000ee25650d 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
| @@ -490,7 +490,17 @@ static void raid10_end_write_request(struct bio *bio, int error) | |||
| 490 | sector_t first_bad; | 490 | sector_t first_bad; |
| 491 | int bad_sectors; | 491 | int bad_sectors; |
| 492 | 492 | ||
| 493 | set_bit(R10BIO_Uptodate, &r10_bio->state); | 493 | /* |
| 494 | * Do not set R10BIO_Uptodate if the current device is | ||
| 495 | * rebuilding or Faulty. This is because we cannot use | ||
| 496 | * such device for properly reading the data back (we could | ||
| 497 | * potentially use it, if the current write would have felt | ||
| 498 | * before rdev->recovery_offset, but for simplicity we don't | ||
| 499 | * check this here. | ||
| 500 | */ | ||
| 501 | if (test_bit(In_sync, &rdev->flags) && | ||
| 502 | !test_bit(Faulty, &rdev->flags)) | ||
| 503 | set_bit(R10BIO_Uptodate, &r10_bio->state); | ||
| 494 | 504 | ||
| 495 | /* Maybe we can clear some bad blocks. */ | 505 | /* Maybe we can clear some bad blocks. */ |
| 496 | if (is_badblock(rdev, | 506 | if (is_badblock(rdev, |
