]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
DDF: ddf_activate_spare: only activate good drives
authormwilck@arcor.de <mwilck@arcor.de>
Thu, 25 Jul 2013 18:59:12 +0000 (20:59 +0200)
committerNeilBrown <neilb@suse.de>
Tue, 30 Jul 2013 00:57:13 +0000 (10:57 +1000)
Do not try to activate drives marked missing or failed.

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

index 13a2e61a84105e6c3c6abcbf8691d900b5abc0ee..ae1222c4ad9a8aa58b448ce80e1378c3df1a357e 100644 (file)
@@ -4773,6 +4773,13 @@ static struct mdinfo *ddf_activate_spare(struct active_array *a,
        /* For each slot, if it is not working, find a spare */
        dl = ddf->dlist;
        for (i = 0; i < a->info.array.raid_disks; i++) {
+               be16 state = ddf->phys->entries[dl->pdnum].state;
+               if (be16_and(state,
+                            cpu_to_be16(DDF_Failed|DDF_Missing)) ||
+                   !be16_and(state,
+                             cpu_to_be16(DDF_Online)))
+                       continue;
+
                for (d = a->info.devs ; d ; d = d->next)
                        if (d->disk.raid_disk == i)
                                break;