]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
DDF: get_extents: don't allocate space on failed disks
authormwilck@arcor.de <mwilck@arcor.de>
Mon, 5 Aug 2013 20:37:50 +0000 (22:37 +0200)
committerNeilBrown <neilb@suse.de>
Mon, 5 Aug 2013 23:54:47 +0000 (09:54 +1000)
We should skip known failed disks when allocating space for
new arrays. This fixes the problem with 10ddf-fail-spare.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
super-ddf.c

index b352a52a5fc035c6df408a41d6bf9f95e42d4d41..b7c614298bbbcd4d5a9798253009b7b9204db22b 100644 (file)
@@ -2390,6 +2390,10 @@ static struct extent *get_extents(struct ddf_super *ddf, struct dl *dl)
        struct extent *rv;
        int n = 0;
        unsigned int i;
+       __u16 state = be16_to_cpu(ddf->phys->entries[dl->pdnum].state);
+
+       if ((state & (DDF_Online|DDF_Failed|DDF_Missing)) != DDF_Online)
+               return NULL;
 
        rv = xmalloc(sizeof(struct extent) * (ddf->max_part + 2));