aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid5.c
diff options
context:
space:
mode:
authorKukjin Kim <kgene.kim@samsung.com>2012-05-12 18:53:34 -0400
committerKukjin Kim <kgene.kim@samsung.com>2012-05-12 18:53:34 -0400
commit163ec0369be4c26e68385f6cec88d0ee38c8d8e5 (patch)
treef3e441866f8bc1b0548e7d8eddd9548b6aedef5e /drivers/md/raid5.c
parent199642bfe107c411f25fbfc16c9fd49cfef9785d (diff)
parent99dbdd98f271899e023d52b3f4c2bf67cdd7eb56 (diff)
Merge branch 'next/cleanup-plat-s3c24xx' into next/cleanup-plat-s3c24xx-s5p
Diffstat (limited to 'drivers/md/raid5.c')
-rw-r--r--drivers/md/raid5.c59
1 files changed, 32 insertions, 27 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 23ac880bba9a..f351422938e0 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -2471,39 +2471,41 @@ handle_failed_sync(struct r5conf *conf, struct stripe_head *sh,
2471 int abort = 0; 2471 int abort = 0;
2472 int i; 2472 int i;
2473 2473
2474 md_done_sync(conf->mddev, STRIPE_SECTORS, 0);
2475 clear_bit(STRIPE_SYNCING, &sh->state); 2474 clear_bit(STRIPE_SYNCING, &sh->state);
2476 s->syncing = 0; 2475 s->syncing = 0;
2477 s->replacing = 0; 2476 s->replacing = 0;
2478 /* There is nothing more to do for sync/check/repair. 2477 /* There is nothing more to do for sync/check/repair.
2478 * Don't even need to abort as that is handled elsewhere
2479 * if needed, and not always wanted e.g. if there is a known
2480 * bad block here.
2479 * For recover/replace we need to record a bad block on all 2481 * For recover/replace we need to record a bad block on all
2480 * non-sync devices, or abort the recovery 2482 * non-sync devices, or abort the recovery
2481 */ 2483 */
2482 if (!test_bit(MD_RECOVERY_RECOVER, &conf->mddev->recovery)) 2484 if (test_bit(MD_RECOVERY_RECOVER, &conf->mddev->recovery)) {
2483 return; 2485 /* During recovery devices cannot be removed, so
2484 /* During recovery devices cannot be removed, so locking and 2486 * locking and refcounting of rdevs is not needed
2485 * refcounting of rdevs is not needed 2487 */
2486 */ 2488 for (i = 0; i < conf->raid_disks; i++) {
2487 for (i = 0; i < conf->raid_disks; i++) { 2489 struct md_rdev *rdev = conf->disks[i].rdev;
2488 struct md_rdev *rdev = conf->disks[i].rdev; 2490 if (rdev
2489 if (rdev 2491 && !test_bit(Faulty, &rdev->flags)
2490 && !test_bit(Faulty, &rdev->flags) 2492 && !test_bit(In_sync, &rdev->flags)
2491 && !test_bit(In_sync, &rdev->flags) 2493 && !rdev_set_badblocks(rdev, sh->sector,
2492 && !rdev_set_badblocks(rdev, sh->sector, 2494 STRIPE_SECTORS, 0))
2493 STRIPE_SECTORS, 0)) 2495 abort = 1;
2494 abort = 1; 2496 rdev = conf->disks[i].replacement;
2495 rdev = conf->disks[i].replacement; 2497 if (rdev
2496 if (rdev 2498 && !test_bit(Faulty, &rdev->flags)
2497 && !test_bit(Faulty, &rdev->flags) 2499 && !test_bit(In_sync, &rdev->flags)
2498 && !test_bit(In_sync, &rdev->flags) 2500 && !rdev_set_badblocks(rdev, sh->sector,
2499 && !rdev_set_badblocks(rdev, sh->sector, 2501 STRIPE_SECTORS, 0))
2500 STRIPE_SECTORS, 0)) 2502 abort = 1;
2501 abort = 1; 2503 }
2502 } 2504 if (abort)
2503 if (abort) { 2505 conf->recovery_disabled =
2504 conf->recovery_disabled = conf->mddev->recovery_disabled; 2506 conf->mddev->recovery_disabled;
2505 set_bit(MD_RECOVERY_INTR, &conf->mddev->recovery);
2506 } 2507 }
2508 md_done_sync(conf->mddev, STRIPE_SECTORS, !abort);
2507} 2509}
2508 2510
2509static int want_replace(struct stripe_head *sh, int disk_idx) 2511static int want_replace(struct stripe_head *sh, int disk_idx)
@@ -3203,7 +3205,8 @@ static void analyse_stripe(struct stripe_head *sh, struct stripe_head_state *s)
3203 /* Not in-sync */; 3205 /* Not in-sync */;
3204 else if (is_bad) { 3206 else if (is_bad) {
3205 /* also not in-sync */ 3207 /* also not in-sync */
3206 if (!test_bit(WriteErrorSeen, &rdev->flags)) { 3208 if (!test_bit(WriteErrorSeen, &rdev->flags) &&
3209 test_bit(R5_UPTODATE, &dev->flags)) {
3207 /* treat as in-sync, but with a read error 3210 /* treat as in-sync, but with a read error
3208 * which we can now try to correct 3211 * which we can now try to correct
3209 */ 3212 */
@@ -3276,12 +3279,14 @@ static void analyse_stripe(struct stripe_head *sh, struct stripe_head_state *s)
3276 /* If there is a failed device being replaced, 3279 /* If there is a failed device being replaced,
3277 * we must be recovering. 3280 * we must be recovering.
3278 * else if we are after recovery_cp, we must be syncing 3281 * else if we are after recovery_cp, we must be syncing
3282 * else if MD_RECOVERY_REQUESTED is set, we also are syncing.
3279 * else we can only be replacing 3283 * else we can only be replacing
3280 * sync and recovery both need to read all devices, and so 3284 * sync and recovery both need to read all devices, and so
3281 * use the same flag. 3285 * use the same flag.
3282 */ 3286 */
3283 if (do_recovery || 3287 if (do_recovery ||
3284 sh->sector >= conf->mddev->recovery_cp) 3288 sh->sector >= conf->mddev->recovery_cp ||
3289 test_bit(MD_RECOVERY_REQUESTED, &(conf->mddev->recovery)))
3285 s->syncing = 1; 3290 s->syncing = 1;
3286 else 3291 else
3287 s->replacing = 1; 3292 s->replacing = 1;