]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Grow: fix problems with prematurely aborting of reshapes.
authorNeilBrown <neilb@suse.de>
Mon, 20 Jan 2014 04:31:45 +0000 (15:31 +1100)
committerNeilBrown <neilb@suse.de>
Mon, 20 Jan 2014 04:31:45 +0000 (15:31 +1100)
1/ when unfreezing, make sure the array is frozen first.
   If it isn't we might end up interrupting a reshape.
2/ When the child finishes, don't call abort_reshape() as that
   will interrupt the reshape.  Just set suspend_* etc
   explicitly.

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

diff --git a/Grow.c b/Grow.c
index f9f97920d996f4341c1b8b3aabe4d1c80d6dc150..6f556f65af78749c70c7287c298342ec42806c92 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -612,9 +612,14 @@ static void unfreeze(struct supertype *st)
                return unfreeze_container(st);
        else {
                struct mdinfo *sra = sysfs_read(-1, st->devnm, GET_VERSION);
+               char buf[20];
 
-               if (sra)
+               if (sra &&
+                   sysfs_get_str(sra, NULL, "sync_action", buf, 20) > 0
+                   && strcmp(buf, "frozen\n") == 0) {
+                       printf("unfreeze\n");
                        sysfs_set_str(sra, NULL, "sync_action", "idle");
+               }
                sysfs_free(sra);
        }
 }
@@ -2666,7 +2671,7 @@ static int impose_level(int fd, int level, char *devname, int verbose)
                for (d = 0, found = 0;
                     d < MAX_DISKS && found < array.nr_disks;
                     d++) {
-                               mdu_disk_info_t disk;
+                       mdu_disk_info_t disk;
                        disk.number = d;
                        if (ioctl(fd, GET_DISK_INFO, &disk) < 0)
                                continue;
@@ -4316,7 +4321,12 @@ int child_monitor(int afd, struct mdinfo *sra, struct reshape *reshape,
        }
 
        /* FIXME maybe call progress_reshape one more time instead */
-       abort_reshape(sra); /* remove any remaining suspension */
+       /* remove any remaining suspension */
+       sysfs_set_num(sra, NULL, "suspend_lo", 0x7FFFFFFFFFFFFFFFULL);
+       sysfs_set_num(sra, NULL, "suspend_hi", 0);
+       sysfs_set_num(sra, NULL, "suspend_lo", 0);
+       sysfs_set_num(sra, NULL, "sync_min", 0);
+
        if (reshape->before.data_disks == reshape->after.data_disks)
                sysfs_set_num(sra, NULL, "sync_speed_min", speed);
        free(buf);