]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
imsm: fix: correct adding and activation of spare disks
authorLukasz Dorau <lukasz.dorau@intel.com>
Wed, 5 Oct 2011 03:17:38 +0000 (14:17 +1100)
committerNeilBrown <neilb@suse.de>
Wed, 5 Oct 2011 03:17:38 +0000 (14:17 +1100)
During activation of spare disks, only one of all available
spare disks can be activated at this moment.
It causes that for example during take-over from
RAID0 with 2 disks to RAID10, only one of two spare disks
is taken for recovery and a degraded RAID10 array
with only 3 of 4 working disks is created.
It has been fixed by adding more than one of all available
spare disks and saving them in additional_test_list
which is passed to imsm_add_spare().

Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
super-intel.c

index e761819cbd1f9ff6e1ab1e5c26efc00bcb51988c..ce067a2c161e8f9090a969ba13c2dfc5c21bde73 100644 (file)
@@ -6671,9 +6671,9 @@ static struct mdinfo *imsm_activate_spare(struct active_array *a,
                 */
                dl = imsm_readd(super, i, a);
                if (!dl)
-                       dl = imsm_add_spare(super, i, a, 0, NULL);
+                       dl = imsm_add_spare(super, i, a, 0, rv);
                if (!dl)
-                       dl = imsm_add_spare(super, i, a, 1, NULL);
+                       dl = imsm_add_spare(super, i, a, 1, rv);
                if (!dl)
                        continue;
  
@@ -6710,8 +6710,6 @@ static struct mdinfo *imsm_activate_spare(struct active_array *a,
                num_spares++;
                dprintf("%x:%x to be %d at %llu\n", dl->major, dl->minor,
                        i, di->data_offset);
-
-               break;
        }
 
        if (!rv)