]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Assemble: avoid infinite loop when auto-assembling partial container.
authorNeilBrown <neilb@suse.de>
Mon, 20 Jan 2014 04:23:31 +0000 (15:23 +1100)
committerNeilBrown <neilb@suse.de>
Mon, 20 Jan 2014 04:23:31 +0000 (15:23 +1100)
When auto-assembling we loop until we get no successes.

If a device is found that look like it is part of an already-existing
container, but we subsequently fail to add that device, then the fact
that the container is running looks like a success.  This can result
in infinite looping.
So if a container was already partially assemble, and is still only
partially assembled after we try to add devices, then don't treat that
as success.

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

index 7e8e7957035239eae63f20debcf2b615186e0d9c..fdb38e4e9064d5ae2abb7273711e141e67da093a 100644 (file)
@@ -990,6 +990,10 @@ static int start_array(int mdfd,
                }
                st->ss->free_super(st);
                sysfs_uevent(content, "change");
+               if (err_ok && okcnt < (unsigned)content->array.raid_disks)
+                       /* Was partial, is still partial, so signal an error
+                        * to ensure we don't retry */
+                       return 1;
                return 0;
        }