]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
ddf: exclude failed devices from container_content
authorNeilBrown <neilb@suse.de>
Wed, 2 Mar 2011 22:04:42 +0000 (09:04 +1100)
committerNeilBrown <neilb@suse.de>
Wed, 2 Mar 2011 22:04:42 +0000 (09:04 +1100)
If a device is failed, then don't include it in the reported
container_content, else it might get included in the array.

Reported-by: Albert Pauw <albert.pauw@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
super-ddf.c

index dba59703a03cc2f054e70e1c8f3a5b74677c3ee7..141731a3069654e2aa29e2c02c8fcc74071c8d1e 100644 (file)
@@ -2974,18 +2974,23 @@ static struct mdinfo *container_content_ddf(struct supertype *st)
                for (i = 0 ; i < ddf->mppe ; i++) {
                        struct mdinfo *dev;
                        struct dl *d;
+                       int stt;
 
                        if (vc->conf.phys_refnum[i] == 0xFFFFFFFF)
                                continue;
 
-                       this->array.working_disks++;
-
                        for (d = ddf->dlist; d ; d=d->next)
                                if (d->disk.refnum == vc->conf.phys_refnum[i])
                                        break;
                        if (d == NULL)
                                /* Haven't found that one yet, maybe there are others */
                                continue;
+                       stt = __be16_to_cpu(ddf->phys->entries[d->pdnum].state);
+                       if ((stt & (DDF_Online|DDF_Failed|DDF_Rebuilding))
+                           != DDF_Online)
+                               continue;
+
+                       this->array.working_disks++;
 
                        dev = malloc(sizeof(*dev));
                        memset(dev, 0, sizeof(*dev));