]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Incr: fix breakage in count_active.
authorNeilBrown <neilb@suse.de>
Wed, 15 Jun 2011 02:21:26 +0000 (12:21 +1000)
committerNeilBrown <neilb@suse.de>
Wed, 15 Jun 2011 02:21:26 +0000 (12:21 +1000)
If the second device is much newer than the first, but has a lower
raid_disk number, we clear 'avail' badly and don't set up
'best' properly.

Fix these things.

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

index f576cbae35b1d8669b9bad2eb3937105caac9134..aa98d06b4034c4b70ca52b3e402fc9c48ba2e026 100644 (file)
@@ -776,9 +776,10 @@ static int count_active(struct supertype *st, struct mdinfo *sra,
                                best[info.disk.raid_disk] = devnum;
                                st->ss->getinfo_super(st, bestinfo, NULL);
                        } else { /* info.events much bigger */
-                               memset(avail, 0, info.disk.raid_disk);
+                               memset(avail, 0, raid_disks);
                                max_events = info.events;
                                avail[info.disk.raid_disk] = 2;
+                               best[info.disk.raid_disk] = devnum;
                                st->ss->getinfo_super(st, bestinfo, NULL);
                        }
                }