diff options
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/raid10.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 90e951730a23..011827d0df25 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -3201,6 +3201,16 @@ static int run(struct mddev *mddev) | |||
3201 | continue; | 3201 | continue; |
3202 | disk = conf->mirrors + disk_idx; | 3202 | disk = conf->mirrors + disk_idx; |
3203 | 3203 | ||
3204 | if (test_bit(Replacement, &rdev->flags)) { | ||
3205 | if (disk->replacement) | ||
3206 | goto out_free_conf; | ||
3207 | disk->replacement = rdev; | ||
3208 | } else { | ||
3209 | if (disk->rdev) | ||
3210 | goto out_free_conf; | ||
3211 | disk->rdev = rdev; | ||
3212 | } | ||
3213 | |||
3204 | disk->rdev = rdev; | 3214 | disk->rdev = rdev; |
3205 | disk_stack_limits(mddev->gendisk, rdev->bdev, | 3215 | disk_stack_limits(mddev->gendisk, rdev->bdev, |
3206 | rdev->data_offset << 9); | 3216 | rdev->data_offset << 9); |
@@ -3228,6 +3238,13 @@ static int run(struct mddev *mddev) | |||
3228 | 3238 | ||
3229 | disk = conf->mirrors + i; | 3239 | disk = conf->mirrors + i; |
3230 | 3240 | ||
3241 | if (!disk->rdev && disk->replacement) { | ||
3242 | /* The replacement is all we have - use it */ | ||
3243 | disk->rdev = disk->replacement; | ||
3244 | disk->replacement = NULL; | ||
3245 | clear_bit(Replacement, &disk->rdev->flags); | ||
3246 | } | ||
3247 | |||
3231 | if (!disk->rdev || | 3248 | if (!disk->rdev || |
3232 | !test_bit(In_sync, &disk->rdev->flags)) { | 3249 | !test_bit(In_sync, &disk->rdev->flags)) { |
3233 | disk->head_position = 0; | 3250 | disk->head_position = 0; |