md/raid10 record bad blocks as needed during recovery.

When recovering one or more devices, if all the good devices have
bad blocks we should record a bad block on the device being rebuilt.

If this fails, we need to abort the recovery.

To ensure we don't think that we aborted later than we actually did,
we need to move the check for MD_RECOVERY_INTR earlier in md_do_sync,
in particular before mddev->curr_resync is updated.

Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
NeilBrown
2011-07-28 11:39:24 +10:00
parent 40c356ce5a
commit e875ecea26
2 changed files with 36 additions and 13 deletions

View File

@ -7165,11 +7165,14 @@ void md_do_sync(mddev_t *mddev)
atomic_add(sectors, &mddev->recovery_active);
}
if (test_bit(MD_RECOVERY_INTR, &mddev->recovery))
break;
j += sectors;
if (j>1) mddev->curr_resync = j;
mddev->curr_mark_cnt = io_sectors;
if (last_check == 0)
/* this is the earliers that rebuilt will be
/* this is the earliest that rebuild will be
* visible in /proc/mdstat
*/
md_new_event(mddev);
@ -7178,10 +7181,6 @@ void md_do_sync(mddev_t *mddev)
continue;
last_check = io_sectors;
if (test_bit(MD_RECOVERY_INTR, &mddev->recovery))
break;
repeat:
if (time_after_eq(jiffies, mark[last_mark] + SYNC_MARK_STEP )) {
/* step marks */