]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
ddf: allow a non-spare to be used to recovery a missing device.
authorNeilBrown <neilb@suse.de>
Thu, 27 Sep 2012 06:57:09 +0000 (16:57 +1000)
committerNeilBrown <neilb@suse.de>
Thu, 27 Sep 2012 06:57:09 +0000 (16:57 +1000)
If a DDF has two arrays sharing devices and one device fails, then
as soon as the spare is used to recover one of the arrays it isn't
spare any more and so is not chosen for the other array.

Work around this for now by allowing a non-spare to be used if it has
enough space.

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

index 5e51c4cdac765770fb875bea91a71206e4da8356..9ea62e0f12feca2ffc0c840cca85210ce9af7a01 100644 (file)
@@ -3718,6 +3718,10 @@ static struct mdinfo *ddf_activate_spare(struct active_array *a,
                        } else if (ddf->phys->entries[dl->pdnum].type &
                                   __cpu_to_be16(DDF_Global_Spare)) {
                                is_global = 1;
+                       } else if (!(ddf->phys->entries[dl->pdnum].state &
+                                    __cpu_to_be16(DDF_Failed))) {
+                               /* we can possibly use some of this */
+                               is_global = 1;
                        }
                        if ( ! (is_dedicated ||
                                (is_global && global_ok))) {