aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2011-07-27 21:39:22 -0400
committerNeilBrown <neilb@suse.de>2011-07-27 21:39:22 -0400
commit73e92e51b7969ef5477dd28fe2ae4d77675896f4 (patch)
tree05f3d45d6c686abed79c0e5fac1d0b61ae9f93bd /drivers/md
parentbc2607f393bd4fb844c1886a02af929ca0372056 (diff)
md/raid5. Don't write to known bad block on doubtful devices.
If a device has seen write errors, don't write to any known bad blocks on that device. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/raid5.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 9768a7d67148..3fa3f20dc5f5 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -526,6 +526,36 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s)
526 atomic_inc(&rdev->nr_pending); 526 atomic_inc(&rdev->nr_pending);
527 rcu_read_unlock(); 527 rcu_read_unlock();
528 528
529 /* We have already checked bad blocks for reads. Now
530 * need to check for writes.
531 */
532 while ((rw & WRITE) && rdev &&
533 test_bit(WriteErrorSeen, &rdev->flags)) {
534 sector_t first_bad;
535 int bad_sectors;
536 int bad = is_badblock(rdev, sh->sector, STRIPE_SECTORS,
537 &first_bad, &bad_sectors);
538 if (!bad)
539 break;
540
541 if (bad < 0) {
542 set_bit(BlockedBadBlocks, &rdev->flags);
543 if (!conf->mddev->external &&
544 conf->mddev->flags) {
545 /* It is very unlikely, but we might
546 * still need to write out the
547 * bad block log - better give it
548 * a chance*/
549 md_check_recovery(conf->mddev);
550 }
551 md_wait_for_blocked_rdev(rdev, conf->mddev);
552 } else {
553 /* Acknowledged bad block - skip the write */
554 rdev_dec_pending(rdev, conf->mddev);
555 rdev = NULL;
556 }
557 }
558
529 if (rdev) { 559 if (rdev) {
530 if (s->syncing || s->expanding || s->expanded) 560 if (s->syncing || s->expanding || s->expanded)
531 md_sync_acct(rdev->bdev, STRIPE_SECTORS); 561 md_sync_acct(rdev->bdev, STRIPE_SECTORS);
@@ -3317,7 +3347,6 @@ finish:
3317 3347
3318 ops_run_io(sh, &s); 3348 ops_run_io(sh, &s);
3319 3349
3320
3321 if (s.dec_preread_active) { 3350 if (s.dec_preread_active) {
3322 /* We delay this until after ops_run_io so that if make_request 3351 /* We delay this until after ops_run_io so that if make_request
3323 * is waiting on a flush, it won't continue until the writes 3352 * is waiting on a flush, it won't continue until the writes