]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Misc reshape_array fixes.
authorNeilBrown <neilb@suse.de>
Tue, 11 Jan 2011 03:41:48 +0000 (14:41 +1100)
committerNeilBrown <neilb@suse.de>
Tue, 11 Jan 2011 03:41:48 +0000 (14:41 +1100)
1/ test on spares_needed is backwards
2/ stray white space
3/ reuse a goto instead of explicit exit().

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

diff --git a/Grow.c b/Grow.c
index 7117cb96c53d6b56a682aa1de8bffa63dddd766b..611b3e215dde9971fc2d85dc9ce520ba562c4e95 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -1642,7 +1642,7 @@ static int reshape_array(char *container, int fd, char *devname,
                            reshape.after.data_disks)
                + reshape.parity - array.raid_disks;
 
-       if (!force && spares_needed < info->array.spare_disks) {
+       if (!force && spares_needed > info->array.spare_disks) {
                fprintf(stderr,
                        Name ": Need %d spare%s to avoid degraded array,"
                        " and only have %d.\n"
@@ -1845,7 +1845,7 @@ static int reshape_array(char *container, int fd, char *devname,
                goto release;
        }
        if (backup_file == NULL) {
-               if (reshape.after.data_disks <= reshape.before.data_disks) {
+               if (reshape.after.data_disks <= reshape.before.data_disks) {
                        fprintf(stderr,
                                Name ": %s: Cannot grow - need backup-file\n", 
                                devname);
@@ -2060,11 +2060,8 @@ static int reshape_array(char *container, int fd, char *devname,
                                wait_reshape(sra);
 
                        c = map_num(pers, info->new_level);
-                       if (c == NULL) {
-                               if (forked)
-                                       return 1;
-                               exit(0);/* not possible */
-                       }
+                       if (c == NULL)
+                               goto out;/* not possible */
 
                        err = sysfs_set_str(sra, NULL, "level", c);
                        if (err)