]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Continue reshape after assembling array
authorAdam Kwolek <adam.kwolek@intel.com>
Wed, 2 Mar 2011 01:28:15 +0000 (12:28 +1100)
committerNeilBrown <neilb@suse.de>
Wed, 2 Mar 2011 01:28:15 +0000 (12:28 +1100)
assemble_container_content() cannot close mdfd handle, as it could be
required by reshape continuation.
mdfd handle is closed outside this function, when it is not longer
necessary.
Call to Grow_continue is added for reshape continuation after
assembly.

In the nearest future, simple condition:
    if (content->reshape_active)
before Grow_continue() call will be replaced by check function
for support container operation /reshape/.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Assemble.c
Incremental.c

index 4d4108122d6b537ef393d63a06c117dd65dac06d..ee5fcec46b0223ed32f20d7a2482aa290ba3f26b 100644 (file)
@@ -696,8 +696,21 @@ int Assemble(struct supertype *st, char *mddev,
 #ifndef MDASSEMBLE
        if (content != &info) {
                /* This is a member of a container.  Try starting the array. */
-               return assemble_container_content(st, mdfd, content, runstop,
-                                          chosen_name, verbose);
+               int err;
+               err = assemble_container_content(st, mdfd, content, runstop,
+                                                chosen_name, verbose);
+               if (!err) {
+                       /* check if reshape of external metadata
+                        * is in progress
+                        * and it is need to be monitored by mdadm
+                        */
+                       if (content->reshape_active)
+                               err = Grow_continue(mdfd, st, content,
+                                                   backup_file);
+               }
+               close(mdfd);
+
+               return err;
        }
 #endif
        /* Ok, no bad inconsistancy, we can try updating etc */
@@ -1511,10 +1524,9 @@ int assemble_container_content(struct supertype *st, int mdfd,
 
        sra = sysfs_read(mdfd, 0, GET_VERSION);
        if (sra == NULL || strcmp(sra->text_version, content->text_version) != 0)
-               if (sysfs_set_array(content, md_get_version(mdfd)) != 0) {
-                       close(mdfd);
+               if (sysfs_set_array(content, md_get_version(mdfd)) != 0)
                        return 1;
-               }
+
        if (sra)
                sysfs_free(sra);
 
@@ -1526,11 +1538,9 @@ int assemble_container_content(struct supertype *st, int mdfd,
                else if (dev->disk.raid_disk >= content->array.raid_disks &&
                          content->reshape_active)
                        expansion++;
-       if (working == 0) {
-               close(mdfd);
+       if (working == 0)
                return 1;/* Nothing new, don't try to start */
-       }
-       
+
        map_update(&map, fd2devnum(mdfd),
                   content->text_version,
                   content->uuid, chosen_name);
@@ -1578,8 +1588,7 @@ int assemble_container_content(struct supertype *st, int mdfd,
                }
                if (!err)
                        wait_for(chosen_name, mdfd);
-               close(mdfd);
-               return 0;
+               return err;
                /* FIXME should have an O_EXCL and wait for read-auto */
        } else {
                if (verbose >= 0)
@@ -1587,7 +1596,6 @@ int assemble_container_content(struct supertype *st, int mdfd,
                                ": %s assembled with %d devices but "
                                "not started\n",
                                chosen_name, working);
-               close(mdfd);
                return 1;
        }
 }
index 4c4b0c7ec21ce66d2d29e159de991352de6136c7..91359f4e93b453fedbf1575401dc0880c711135c 100644 (file)
@@ -1556,6 +1556,7 @@ static int Incremental_container(struct supertype *st, char *devname,
 
                assemble_container_content(st, mdfd, ra, runstop,
                                           chosen_name, verbose);
+               close(mdfd);
        }
 
        /* Now move all suitable spares from spare container */