diff options
author | NeilBrown <neilb@suse.de> | 2011-03-22 10:32:09 +1100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2011-03-22 10:32:09 +1100 |
commit | 0cf5ef67bbc8dad949af945ab5dd4b1d9df0d0a9 (patch) | |
tree | 52cec28e5092e0e67029de562d9390ba847f408f | |
parent | 6f38d7ae107de0615232a64a1b16a470fa1f8a4b (diff) | |
download | mdadm-0cf5ef67bbc8dad949af945ab5dd4b1d9df0d0a9.tar.gz |
ddf: fix up detection of failed/missing devices.
If a device hasn't been found yet we can still tell if it is
expected to be working, and we must to do to make sure
'working_disks' is correct.
Signed-off-by: NeilBrown <neilb@suse.de>
-rw-r--r-- | super-ddf.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/super-ddf.c b/super-ddf.c index 72b87ff..8f88b70 100644 --- a/super-ddf.c +++ b/super-ddf.c @@ -3019,23 +3019,33 @@ static struct mdinfo *container_content_ddf(struct supertype *st, char *subarray struct mdinfo *dev; struct dl *d; int stt; + int pd; if (vc->conf.phys_refnum[i] == 0xFFFFFFFF) continue; - for (d = ddf->dlist; d ; d=d->next) - if (d->disk.refnum == vc->conf.phys_refnum[i]) + for (pd = __be16_to_cpu(ddf->phys->used_pdes); + pd--;) + if (ddf->phys->entries[pd].refnum + == vc->conf.phys_refnum[i]) break; - if (d == NULL) - /* Haven't found that one yet, maybe there are others */ + if (pd < 0) continue; - stt = __be16_to_cpu(ddf->phys->entries[d->pdnum].state); + + stt = __be16_to_cpu(ddf->phys->entries[pd].state); if ((stt & (DDF_Online|DDF_Failed|DDF_Rebuilding)) != DDF_Online) 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; + dev = malloc(sizeof(*dev)); memset(dev, 0, sizeof(*dev)); dev->next = this->devs; |