]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Incr: don't exclude 'active' devices from auto inclusion in a container.
authorNeilBrown <neilb@suse.de>
Wed, 23 Mar 2011 04:42:35 +0000 (15:42 +1100)
committerNeilBrown <neilb@suse.de>
Wed, 23 Mar 2011 04:42:35 +0000 (15:42 +1100)
For containers, it is always appropriate to include a device in the
container.
Whether it should then be included in an array is a separate question.

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

index 4d3d181b10fbac9cce3e0dc119120925830fc5d4..46badc9d0d7d094d242af3f0a1430dcbd7992939 100644 (file)
@@ -375,20 +375,15 @@ int Incremental(char *devname, int verbose, int runstop,
                 * they failed.  However if runstop is 1, then the
                 * array was possibly started early and our best be is
                 * to add this anyway.  It would probably be good to
-                * allow explicit policy statement about this.
+                * allow explicit policy statement about this..
+                * This doesn't apply to containers as the 'non-spare'
+                * flag has a different meaning.  The test has to happen
+                * at the device level there
                 */
-               if ((info.disk.state & (1<<MD_DISK_SYNC)) != 0
+               if (!st->ss->external
+                   && (info.disk.state & (1<<MD_DISK_SYNC)) != 0
                    && runstop < 1) {
-                       int active = 0;
-                       
-                       if (st->ss->external) {
-                               char *devname = devnum2devname(fd2devnum(mdfd));
-
-                               active = devname && is_container_active(devname);
-                               free(devname);
-                       } else if (ioctl(mdfd, GET_ARRAY_INFO, &ainf) == 0)
-                               active = 1;
-                       if (active) {
+                       if (ioctl(mdfd, GET_ARRAY_INFO, &ainf) == 0) {
                                fprintf(stderr, Name
                                        ": not adding %s to active array (without --run) %s\n",
                                        devname, chosen_name);
diff --git a/mdadm.h b/mdadm.h
index f5367bfbb6e8e3d8962befbfb50bcaff5eef5ae4..bb293f4faceddf530f3b52964e206b0023113982 100644 (file)
--- a/mdadm.h
+++ b/mdadm.h
@@ -936,7 +936,6 @@ extern int open_mddev(char *dev, int report_errors);
 extern int open_container(int fd);
 extern int is_container_member(struct mdstat_ent *ent, char *devname);
 extern int is_subarray_active(char *subarray, char *devname);
-int is_container_active(char *devname);
 extern int open_subarray(char *dev, struct supertype *st, int quiet);
 extern struct superswitch *version_to_superswitch(char *vers);
 
diff --git a/util.c b/util.c
index cbefaba45a0f3066ddc6116a7ef2582a8a0990c7..b42056de69e03df3b9b1a36a045094c92ef0381d 100644 (file)
--- a/util.c
+++ b/util.c
@@ -1471,7 +1471,7 @@ int is_subarray_active(char *subarray, char *container)
                if (is_container_member(ent, container)) {
                        char *inst = &ent->metadata_version[10+strlen(container)+1];
 
-                       if (!subarray || strcmp(inst, subarray) == 0)
+                       if (strcmp(inst, subarray) == 0)
                                break;
                }
        }
@@ -1481,11 +1481,6 @@ int is_subarray_active(char *subarray, char *container)
        return ent != NULL;
 }
 
-int is_container_active(char *container)
-{
-       return is_subarray_active(NULL, container);
-}
-
 /* open_subarray - opens a subarray in a container
  * @dev: container device name
  * @st: supertype with only ->subarray set