aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2011-12-22 18:17:57 -0500
committerNeilBrown <neilb@suse.de>2011-12-22 18:17:57 -0500
commit19d671695e1931ebfd75b2b888778201aefe35ca (patch)
treeb3c54cdb0812632f830453b6a6c9b8b966c9dcc4 /drivers
parent7ef449d1ec3668acbba6af6a500d0c84636b436f (diff)
md/raid1: Mark device want_replacement when we see a write error.
Now that WantReplacement drives are replaced cleanly, mark a drive as want_replacement when we see a write error. It might get failed soon so the WantReplacement flag is irrelevant, but if the write error is recorded in the bad block log, we still want to activate any spare that might be available. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/md/raid1.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index e3cfca7cde16..cc24f0cb7ee3 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -391,6 +391,11 @@ static void raid1_end_write_request(struct bio *bio, int error)
391 if (!uptodate) { 391 if (!uptodate) {
392 set_bit(WriteErrorSeen, 392 set_bit(WriteErrorSeen,
393 &conf->mirrors[mirror].rdev->flags); 393 &conf->mirrors[mirror].rdev->flags);
394 if (!test_and_set_bit(WantReplacement,
395 &conf->mirrors[mirror].rdev->flags))
396 set_bit(MD_RECOVERY_NEEDED, &
397 conf->mddev->recovery);
398
394 set_bit(R1BIO_WriteError, &r1_bio->state); 399 set_bit(R1BIO_WriteError, &r1_bio->state);
395 } else { 400 } else {
396 /* 401 /*
@@ -1461,6 +1466,10 @@ static void end_sync_write(struct bio *bio, int error)
1461 } while (sectors_to_go > 0); 1466 } while (sectors_to_go > 0);
1462 set_bit(WriteErrorSeen, 1467 set_bit(WriteErrorSeen,
1463 &conf->mirrors[mirror].rdev->flags); 1468 &conf->mirrors[mirror].rdev->flags);
1469 if (!test_and_set_bit(WantReplacement,
1470 &conf->mirrors[mirror].rdev->flags))
1471 set_bit(MD_RECOVERY_NEEDED, &
1472 mddev->recovery);
1464 set_bit(R1BIO_WriteError, &r1_bio->state); 1473 set_bit(R1BIO_WriteError, &r1_bio->state);
1465 } else if (is_badblock(conf->mirrors[mirror].rdev, 1474 } else if (is_badblock(conf->mirrors[mirror].rdev,
1466 r1_bio->sector, 1475 r1_bio->sector,
@@ -1491,8 +1500,13 @@ static int r1_sync_page_io(struct md_rdev *rdev, sector_t sector,
1491 if (sync_page_io(rdev, sector, sectors << 9, page, rw, false)) 1500 if (sync_page_io(rdev, sector, sectors << 9, page, rw, false))
1492 /* success */ 1501 /* success */
1493 return 1; 1502 return 1;
1494 if (rw == WRITE) 1503 if (rw == WRITE) {
1495 set_bit(WriteErrorSeen, &rdev->flags); 1504 set_bit(WriteErrorSeen, &rdev->flags);
1505 if (!test_and_set_bit(WantReplacement,
1506 &rdev->flags))
1507 set_bit(MD_RECOVERY_NEEDED, &
1508 rdev->mddev->recovery);
1509 }
1496 /* need to record an error - either for the block or the device */ 1510 /* need to record an error - either for the block or the device */
1497 if (!rdev_set_badblocks(rdev, sector, sectors, 0)) 1511 if (!rdev_set_badblocks(rdev, sector, sectors, 0))
1498 md_error(rdev->mddev, rdev); 1512 md_error(rdev->mddev, rdev);