]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Grow: call start/abort_reshape as appropriate when reshaping a container.
authorNeilBrown <neilb@suse.de>
Wed, 15 Dec 2010 22:07:52 +0000 (09:07 +1100)
committerNeilBrown <neilb@suse.de>
Wed, 15 Dec 2010 22:07:52 +0000 (09:07 +1100)
This means that ->manage_reshape will be called with reshape ready to
roll.

Also move the current start_reshape call earlier so that it is before
the other ->manage_reshape call.

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

diff --git a/Grow.c b/Grow.c
index 40b4809a8f17c406e524809df6515241b51c413a..d77b7f0ff9df895ff9c930674e32a2d82bd35e76 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -756,6 +756,8 @@ static int reshape_container_raid_disks(char *container, int raid_disks)
                                changed++;
                        break;
                }
+               if (!rv && level > 1)
+                       start_reshape(sub);
                sysfs_free(sub);
                if (rv)
                        break;
@@ -823,6 +825,9 @@ static void revert_container_raid_disks(struct supertype *st, int fd, char *cont
                                disks_fixed = 1;
                } else if (sub)
                        disks_fixed = 1;
+
+               if (sub)
+                       abort_reshape(sub);
                sysfs_free(sub);
 
                if (!disks_fixed || !level_fixed)
@@ -1885,6 +1890,7 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
                        break;
                }
 
+               start_reshape(sra);
                if (st->ss->external) {
                        /* metadata handler takes it from here */
                        ping_manager(container);
@@ -1916,6 +1922,7 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
                        fprintf(stderr, Name ": %s: Cannot find a superblock\n",
                                devname);
                        rv = 1;
+                       abort_reshape(sra);
                        break;
                }
 
@@ -1929,7 +1936,6 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
                 * handling backups of the data...
                 * This is all done by a forked background process.
                 */
-               start_reshape(sra);
                switch(fork()) {
                case 0:
                        close(fd);