]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Grow: fix resent grow_continue breakage.
authorNeilBrown <neilb@suse.de>
Thu, 22 May 2014 04:22:58 +0000 (14:22 +1000)
committerNeilBrown <neilb@suse.de>
Thu, 22 May 2014 04:22:58 +0000 (14:22 +1000)
Commit 5e76dce1acd906e8fc8af04973c3a129cdc77fd6 changed
Grow_continue to assume a fork had already happened, so that
   mdadm --grow --continue

didn't fork.  This is good, but it means that if Grow_continue
is run from Assemble, then
  mdadm --assemble ....

can misbehave if the array was in the middle of a reshape.

So introduce finer control.  Grow_continue only assumes it has
already forked if run from "mdadm --grow --continue".

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

index 8977928534b6efb884b68824510caeac243eac17..a57d384daeff06b77d75580f9ad86723233c26f4 100644 (file)
@@ -1044,7 +1044,7 @@ static int start_array(int mdfd,
                                           "array_state", "readonly");
                        if (rv == 0)
                                rv = Grow_continue(mdfd, st, content,
-                                                  c->backup_file,
+                                                  c->backup_file, 0,
                                                   c->freeze_reshape);
                } else if (c->readonly &&
                           sysfs_attribute_available(
@@ -1912,7 +1912,7 @@ int assemble_container_content(struct supertype *st, int mdfd,
                }
 
                err = Grow_continue(mdfd, st, content, c->backup_file,
-                                   c->freeze_reshape);
+                                   0, c->freeze_reshape);
        } else switch(content->array.level) {
                case LEVEL_LINEAR:
                case LEVEL_MULTIPATH:
diff --git a/Grow.c b/Grow.c
index a5a9421b348a57151a349a370cfd3fef94a8f1b3..202b6ef4d1078df7ab9da0b38650073420770ef4 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -4920,7 +4920,7 @@ int Grow_continue_command(char *devname, int fd,
 
        /* continue reshape
         */
-       ret_val = Grow_continue(fd, st, content, backup_file, 0);
+       ret_val = Grow_continue(fd, st, content, backup_file, 1, 0);
 
 Grow_continue_command_exit:
        if (fd2 > -1)
@@ -4936,7 +4936,7 @@ Grow_continue_command_exit:
 }
 
 int Grow_continue(int mdfd, struct supertype *st, struct mdinfo *info,
-                 char *backup_file, int freeze_reshape)
+                 char *backup_file, int forked, int freeze_reshape)
 {
        int ret_val = 2;
 
@@ -4959,7 +4959,7 @@ int Grow_continue(int mdfd, struct supertype *st, struct mdinfo *info,
        } else
                ret_val = reshape_array(NULL, mdfd, "array", st, info, 1,
                                        NULL, INVALID_SECTORS,
-                                       backup_file, 0, 1,
+                                       backup_file, 0, forked,
                                        1 | info->reshape_active,
                                        freeze_reshape);
 
diff --git a/mdadm.h b/mdadm.h
index a73d42a9407ded8a1a6c476410243a410f621905..efe4778ae4fabc5567137032b966f2c54170563c 100644 (file)
--- a/mdadm.h
+++ b/mdadm.h
@@ -1193,7 +1193,7 @@ extern int Grow_restart(struct supertype *st, struct mdinfo *info,
                        int *fdlist, int cnt, char *backup_file, int verbose);
 extern int Grow_continue(int mdfd, struct supertype *st,
                         struct mdinfo *info, char *backup_file,
-                        int freeze_reshape);
+                        int forked, int freeze_reshape);
 
 extern int restore_backup(struct supertype *st,
                          struct mdinfo *content,