]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
teach imsm and ddf what st->subarray means at load_super time
authorDan Williams <dan.j.williams@intel.com>
Sat, 1 Aug 2009 00:08:22 +0000 (17:08 -0700)
committerDan Williams <dan.j.williams@intel.com>
Sat, 1 Aug 2009 00:08:22 +0000 (17:08 -0700)
RebuildMap wants to poll through mdstat and retrieve a (kernel name,
uuid, user name) tuple for each array.  Teach imsm and ddf to honor
st->sub_array at ->load_super() time to set their internal subarray
pointers to the value specified in st->subarray, or return an error if
st->subarray specifies an invalid array.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
super-ddf.c
super-intel.c

index 5ad89c25a84c427a6da3899f73832afe6a90c029..517a586420ae44130d46822bf2a03139803af115 100644 (file)
@@ -835,6 +835,18 @@ static int load_super_ddf(struct supertype *st, int fd,
                return rv;
        }
 
+       if (st->subarray[0]) {
+               struct vcl *v;
+
+               for (v = super->conflist; v; v = v->next)
+                       if (v->vcnum == atoi(st->subarray))
+                               super->currentconf = v;
+               if (!super->currentconf) {
+                       free(super);
+                       return 1;
+               }
+       }
+
        /* Should possibly check the sections .... */
 
        st->sb = super;
index 3abaca5adecc6249b791a7e297a7da468837c83d..24827d0b20261f865167e7dd62b5d457aea48564 100644 (file)
@@ -2167,8 +2167,10 @@ static int load_super_imsm_all(struct supertype *st, int fd, void **sbp,
        if (st->subarray[0]) {
                if (atoi(st->subarray) <= super->anchor->num_raid_devs)
                        super->current_vol = atoi(st->subarray);
-               else
+               else {
+                       free_imsm(super);
                        return 1;
+               }
        }
 
        *sbp = super;
@@ -2193,8 +2195,6 @@ static int load_super_imsm(struct supertype *st, int fd, char *devname)
        if (load_super_imsm_all(st, fd, &st->sb, devname, 1) == 0)
                return 0;
 #endif
-       if (st->subarray[0])
-               return 1; /* FIXME */
 
        super = alloc_super(0);
        if (!super) {
@@ -2215,6 +2215,15 @@ static int load_super_imsm(struct supertype *st, int fd, char *devname)
                return rv;
        }
 
+       if (st->subarray[0]) {
+               if (atoi(st->subarray) <= super->anchor->num_raid_devs)
+                       super->current_vol = atoi(st->subarray);
+               else {
+                       free_imsm(super);
+                       return 1;
+               }
+       }
+
        st->sb = super;
        if (st->ss == NULL) {
                st->ss = &super_imsm;