]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Incr: fix up return value in try_spare
authorNeilBrown <neilb@suse.de>
Mon, 22 Nov 2010 09:58:06 +0000 (20:58 +1100)
committerNeilBrown <neilb@suse.de>
Mon, 22 Nov 2010 09:58:06 +0000 (20:58 +1100)
We only want to try partition_try_spare if array_try_spare failed.
If it succeeded, there is nothing more to try.

Signed-off-by: NeilBrown <neilb@suse.de>
Incremental.c

index 35ad221ad9570c5a39debeef0c7ebc71fc5d66d4..44e83ba33da7698d8f2d0d80fb62d085b1fe9938 100644 (file)
@@ -1112,10 +1112,10 @@ static int try_spare(char *devname, int *dfdp, struct dev_policy *pol,
                    policy_action_allows(pol, superlist[i]->name, act_spare))
                        partitions_ok = 1;
        }
-       rv = 0;
+       rv = 1;
        if (arrays_ok)
                rv = array_try_spare(devname, dfdp, pol, st, verbose);
-       if (rv == 0 && partitions_ok)
+       if (rv != 0 && partitions_ok)
                rv = partition_try_spare(devname, dfdp, pol, st, verbose);
        return rv;
 }