rationalise return value for ->hot_add_disk method.
For all array types but linear, ->hot_add_disk returns 1 on
success, 0 on failure.
For linear, it returns 0 on success and -errno on failure.
This doesn't cause a functional problem because the ->hot_add_disk
function of linear is used quite differently to the others.
However it is confusing.
So convert all to return 0 for success or -errno on failure
and fix call sites to match.
Signed-off-by: Neil Brown <neilb@suse.de>
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 5d6fac1..45e255d 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1977,10 +1977,8 @@
rdev->saved_raid_disk = -1;
err = rdev->mddev->pers->
hot_add_disk(rdev->mddev, rdev);
- if (err != 1) {
+ if (err) {
rdev->raid_disk = -1;
- if (err == 0)
- return -EEXIST;
return err;
}
sprintf(nm, "rd%d", rdev->raid_disk);
@@ -5920,7 +5918,8 @@
if (rdev->raid_disk < 0
&& !test_bit(Faulty, &rdev->flags)) {
rdev->recovery_offset = 0;
- if (mddev->pers->hot_add_disk(mddev,rdev)) {
+ if (mddev->pers->
+ hot_add_disk(mddev, rdev) == 0) {
char nm[20];
sprintf(nm, "rd%d", rdev->raid_disk);
if (sysfs_create_link(&mddev->kobj,