|
|
@@ -3105,6 +3105,13 @@ static int raid1_run(struct mddev *mddev)
|
|
|
!test_bit(In_sync, &conf->mirrors[i].rdev->flags) ||
|
|
|
test_bit(Faulty, &conf->mirrors[i].rdev->flags))
|
|
|
mddev->degraded++;
|
|
|
+ /*
|
|
|
+ * RAID1 needs at least one disk in active
|
|
|
+ */
|
|
|
+ if (conf->raid_disks - mddev->degraded < 1) {
|
|
|
+ ret = -EINVAL;
|
|
|
+ goto abort;
|
|
|
+ }
|
|
|
|
|
|
if (conf->raid_disks - mddev->degraded == 1)
|
|
|
mddev->recovery_cp = MaxSector;
|
|
|
@@ -3138,8 +3145,12 @@ static int raid1_run(struct mddev *mddev)
|
|
|
ret = md_integrity_register(mddev);
|
|
|
if (ret) {
|
|
|
md_unregister_thread(&mddev->thread);
|
|
|
- raid1_free(mddev, conf);
|
|
|
+ goto abort;
|
|
|
}
|
|
|
+ return 0;
|
|
|
+
|
|
|
+abort:
|
|
|
+ raid1_free(mddev, conf);
|
|
|
return ret;
|
|
|
}
|
|
|
|