]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
imsm: FIX: imsm_add_spare() wrongly tests spares list
authorAdam Kwolek <adam.kwolek@intel.com>
Wed, 15 Dec 2010 09:38:15 +0000 (10:38 +0100)
committerNeilBrown <neilb@suse.de>
Wed, 15 Dec 2010 22:03:03 +0000 (09:03 +1100)
For more than one disk tested additional_test_list was searched from last
point, not from begin.

This bug causes that more than 2 disks cannot be added to imsm array,
when imsm_add_spare() is used for this.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
super-intel.c

index 2a23f1b4f717e774e656a3313a90475b50ad0378..2be24a9edbde186ced4085888948ac2b79323206 100644 (file)
@@ -5034,6 +5034,7 @@ static struct dl *imsm_add_spare(struct intel_super *super, int slot,
        __u32 array_start = 0;
        __u32 array_end = 0;
        struct dl *dl;
+       struct mdinfo *test_list;
 
        for (dl = super->disks; dl; dl = dl->next) {
                /* If in this array, skip */
@@ -5047,16 +5048,17 @@ static struct dl *imsm_add_spare(struct intel_super *super, int slot,
                        }
                if (d)
                        continue;
-               while (additional_test_list) {
-                       if (additional_test_list->disk.major == dl->major &&
-                           additional_test_list->disk.minor == dl->minor) {
+               test_list = additional_test_list;
+               while (test_list) {
+                       if (test_list->disk.major == dl->major &&
+                           test_list->disk.minor == dl->minor) {
                                dprintf("%x:%x already in additional test list\n",
                                        dl->major, dl->minor);
                                break;
                        }
-                       additional_test_list = additional_test_list->next;
+                       test_list = test_list->next;
                }
-               if (additional_test_list)
+               if (test_list)
                        continue;
 
                /* skip in use or failed drives */