diff options
-rw-r--r-- | drivers/md/md.c | 7 | ||||
-rw-r--r-- | drivers/md/multipath.c | 8 | ||||
-rw-r--r-- | drivers/md/raid1.c | 6 | ||||
-rw-r--r-- | drivers/md/raid10.c | 10 | ||||
-rw-r--r-- | drivers/md/raid5.c | 10 |
5 files changed, 21 insertions, 20 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 5d6fac1fd39e..45e255d4916f 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -1977,10 +1977,8 @@ slot_store(mdk_rdev_t *rdev, const char *buf, size_t len) | |||
1977 | rdev->saved_raid_disk = -1; | 1977 | rdev->saved_raid_disk = -1; |
1978 | err = rdev->mddev->pers-> | 1978 | err = rdev->mddev->pers-> |
1979 | hot_add_disk(rdev->mddev, rdev); | 1979 | hot_add_disk(rdev->mddev, rdev); |
1980 | if (err != 1) { | 1980 | if (err) { |
1981 | rdev->raid_disk = -1; | 1981 | rdev->raid_disk = -1; |
1982 | if (err == 0) | ||
1983 | return -EEXIST; | ||
1984 | return err; | 1982 | return err; |
1985 | } | 1983 | } |
1986 | sprintf(nm, "rd%d", rdev->raid_disk); | 1984 | sprintf(nm, "rd%d", rdev->raid_disk); |
@@ -5920,7 +5918,8 @@ static int remove_and_add_spares(mddev_t *mddev) | |||
5920 | if (rdev->raid_disk < 0 | 5918 | if (rdev->raid_disk < 0 |
5921 | && !test_bit(Faulty, &rdev->flags)) { | 5919 | && !test_bit(Faulty, &rdev->flags)) { |
5922 | rdev->recovery_offset = 0; | 5920 | rdev->recovery_offset = 0; |
5923 | if (mddev->pers->hot_add_disk(mddev,rdev)) { | 5921 | if (mddev->pers-> |
5922 | hot_add_disk(mddev, rdev) == 0) { | ||
5924 | char nm[20]; | 5923 | char nm[20]; |
5925 | sprintf(nm, "rd%d", rdev->raid_disk); | 5924 | sprintf(nm, "rd%d", rdev->raid_disk); |
5926 | if (sysfs_create_link(&mddev->kobj, | 5925 | if (sysfs_create_link(&mddev->kobj, |
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c index 4a1d714c048e..541cbe3414bd 100644 --- a/drivers/md/multipath.c +++ b/drivers/md/multipath.c | |||
@@ -281,7 +281,7 @@ static int multipath_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | |||
281 | { | 281 | { |
282 | multipath_conf_t *conf = mddev->private; | 282 | multipath_conf_t *conf = mddev->private; |
283 | struct request_queue *q; | 283 | struct request_queue *q; |
284 | int found = 0; | 284 | int err = -EEXIST; |
285 | int path; | 285 | int path; |
286 | struct multipath_info *p; | 286 | struct multipath_info *p; |
287 | int first = 0; | 287 | int first = 0; |
@@ -312,11 +312,13 @@ static int multipath_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | |||
312 | rdev->raid_disk = path; | 312 | rdev->raid_disk = path; |
313 | set_bit(In_sync, &rdev->flags); | 313 | set_bit(In_sync, &rdev->flags); |
314 | rcu_assign_pointer(p->rdev, rdev); | 314 | rcu_assign_pointer(p->rdev, rdev); |
315 | found = 1; | 315 | err = 0; |
316 | break; | ||
316 | } | 317 | } |
317 | 318 | ||
318 | print_multipath_conf(conf); | 319 | print_multipath_conf(conf); |
319 | return found; | 320 | |
321 | return err; | ||
320 | } | 322 | } |
321 | 323 | ||
322 | static int multipath_remove_disk(mddev_t *mddev, int number) | 324 | static int multipath_remove_disk(mddev_t *mddev, int number) |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index d32fc559ff05..f05d5983efb6 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -1100,7 +1100,7 @@ static int raid1_spare_active(mddev_t *mddev) | |||
1100 | static int raid1_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | 1100 | static int raid1_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) |
1101 | { | 1101 | { |
1102 | conf_t *conf = mddev->private; | 1102 | conf_t *conf = mddev->private; |
1103 | int found = 0; | 1103 | int err = -EEXIST; |
1104 | int mirror = 0; | 1104 | int mirror = 0; |
1105 | mirror_info_t *p; | 1105 | mirror_info_t *p; |
1106 | int first = 0; | 1106 | int first = 0; |
@@ -1124,7 +1124,7 @@ static int raid1_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | |||
1124 | 1124 | ||
1125 | p->head_position = 0; | 1125 | p->head_position = 0; |
1126 | rdev->raid_disk = mirror; | 1126 | rdev->raid_disk = mirror; |
1127 | found = 1; | 1127 | err = 0; |
1128 | /* As all devices are equivalent, we don't need a full recovery | 1128 | /* As all devices are equivalent, we don't need a full recovery |
1129 | * if this was recently any drive of the array | 1129 | * if this was recently any drive of the array |
1130 | */ | 1130 | */ |
@@ -1135,7 +1135,7 @@ static int raid1_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | |||
1135 | } | 1135 | } |
1136 | 1136 | ||
1137 | print_conf(conf); | 1137 | print_conf(conf); |
1138 | return found; | 1138 | return err; |
1139 | } | 1139 | } |
1140 | 1140 | ||
1141 | static int raid1_remove_disk(mddev_t *mddev, int number) | 1141 | static int raid1_remove_disk(mddev_t *mddev, int number) |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 50ad8d2ae0e8..df08a9fa3a1f 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -1113,7 +1113,7 @@ static int raid10_spare_active(mddev_t *mddev) | |||
1113 | static int raid10_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | 1113 | static int raid10_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) |
1114 | { | 1114 | { |
1115 | conf_t *conf = mddev->private; | 1115 | conf_t *conf = mddev->private; |
1116 | int found = 0; | 1116 | int err = -EEXIST; |
1117 | int mirror; | 1117 | int mirror; |
1118 | mirror_info_t *p; | 1118 | mirror_info_t *p; |
1119 | int first = 0; | 1119 | int first = 0; |
@@ -1123,9 +1123,9 @@ static int raid10_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | |||
1123 | /* only hot-add to in-sync arrays, as recovery is | 1123 | /* only hot-add to in-sync arrays, as recovery is |
1124 | * very different from resync | 1124 | * very different from resync |
1125 | */ | 1125 | */ |
1126 | return 0; | 1126 | return -EBUSY; |
1127 | if (!enough(conf)) | 1127 | if (!enough(conf)) |
1128 | return 0; | 1128 | return -EINVAL; |
1129 | 1129 | ||
1130 | if (rdev->raid_disk) | 1130 | if (rdev->raid_disk) |
1131 | first = last = rdev->raid_disk; | 1131 | first = last = rdev->raid_disk; |
@@ -1151,7 +1151,7 @@ static int raid10_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | |||
1151 | 1151 | ||
1152 | p->head_position = 0; | 1152 | p->head_position = 0; |
1153 | rdev->raid_disk = mirror; | 1153 | rdev->raid_disk = mirror; |
1154 | found = 1; | 1154 | err = 0; |
1155 | if (rdev->saved_raid_disk != mirror) | 1155 | if (rdev->saved_raid_disk != mirror) |
1156 | conf->fullsync = 1; | 1156 | conf->fullsync = 1; |
1157 | rcu_assign_pointer(p->rdev, rdev); | 1157 | rcu_assign_pointer(p->rdev, rdev); |
@@ -1159,7 +1159,7 @@ static int raid10_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | |||
1159 | } | 1159 | } |
1160 | 1160 | ||
1161 | print_conf(conf); | 1161 | print_conf(conf); |
1162 | return found; | 1162 | return err; |
1163 | } | 1163 | } |
1164 | 1164 | ||
1165 | static int raid10_remove_disk(mddev_t *mddev, int number) | 1165 | static int raid10_remove_disk(mddev_t *mddev, int number) |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 002f33b1ae00..8c4e6149daea 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -4604,7 +4604,7 @@ abort: | |||
4604 | static int raid5_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | 4604 | static int raid5_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) |
4605 | { | 4605 | { |
4606 | raid5_conf_t *conf = mddev->private; | 4606 | raid5_conf_t *conf = mddev->private; |
4607 | int found = 0; | 4607 | int err = -EEXIST; |
4608 | int disk; | 4608 | int disk; |
4609 | struct disk_info *p; | 4609 | struct disk_info *p; |
4610 | int first = 0; | 4610 | int first = 0; |
@@ -4612,7 +4612,7 @@ static int raid5_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | |||
4612 | 4612 | ||
4613 | if (mddev->degraded > conf->max_degraded) | 4613 | if (mddev->degraded > conf->max_degraded) |
4614 | /* no point adding a device */ | 4614 | /* no point adding a device */ |
4615 | return 0; | 4615 | return -EINVAL; |
4616 | 4616 | ||
4617 | if (rdev->raid_disk >= 0) | 4617 | if (rdev->raid_disk >= 0) |
4618 | first = last = rdev->raid_disk; | 4618 | first = last = rdev->raid_disk; |
@@ -4631,14 +4631,14 @@ static int raid5_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | |||
4631 | if ((p=conf->disks + disk)->rdev == NULL) { | 4631 | if ((p=conf->disks + disk)->rdev == NULL) { |
4632 | clear_bit(In_sync, &rdev->flags); | 4632 | clear_bit(In_sync, &rdev->flags); |
4633 | rdev->raid_disk = disk; | 4633 | rdev->raid_disk = disk; |
4634 | found = 1; | 4634 | err = 0; |
4635 | if (rdev->saved_raid_disk != disk) | 4635 | if (rdev->saved_raid_disk != disk) |
4636 | conf->fullsync = 1; | 4636 | conf->fullsync = 1; |
4637 | rcu_assign_pointer(p->rdev, rdev); | 4637 | rcu_assign_pointer(p->rdev, rdev); |
4638 | break; | 4638 | break; |
4639 | } | 4639 | } |
4640 | print_raid5_conf(conf); | 4640 | print_raid5_conf(conf); |
4641 | return found; | 4641 | return err; |
4642 | } | 4642 | } |
4643 | 4643 | ||
4644 | static int raid5_resize(mddev_t *mddev, sector_t sectors) | 4644 | static int raid5_resize(mddev_t *mddev, sector_t sectors) |
@@ -4739,7 +4739,7 @@ static int raid5_start_reshape(mddev_t *mddev) | |||
4739 | rdev_for_each(rdev, rtmp, mddev) | 4739 | rdev_for_each(rdev, rtmp, mddev) |
4740 | if (rdev->raid_disk < 0 && | 4740 | if (rdev->raid_disk < 0 && |
4741 | !test_bit(Faulty, &rdev->flags)) { | 4741 | !test_bit(Faulty, &rdev->flags)) { |
4742 | if (raid5_add_disk(mddev, rdev)) { | 4742 | if (raid5_add_disk(mddev, rdev) == 0) { |
4743 | char nm[20]; | 4743 | char nm[20]; |
4744 | set_bit(In_sync, &rdev->flags); | 4744 | set_bit(In_sync, &rdev->flags); |
4745 | added_devices++; | 4745 | added_devices++; |