]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Check number of failed disks durig raid10->raid0 takeover
authorKrzysztof Wojcik <krzysztof.wojcik@intel.com>
Tue, 25 Jan 2011 06:44:11 +0000 (17:44 +1100)
committerNeilBrown <neilb@suse.de>
Wed, 26 Jan 2011 00:44:59 +0000 (10:44 +1000)
Number of failed disks MUST be half of initial number of disks.
If number of failed disks is different we should not update
metadata- data corruption may occur after array reassemlation.

Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
super-intel.c

index 65391ff03fb5e41ef5be6f86004a4bd229a8f86b..0ff7b2bec049f6dfc5d4b55f80ae8e7b7e563372 100644 (file)
@@ -5791,6 +5791,10 @@ static int apply_takeover_update(struct imsm_update_takeover *u,
        map = get_imsm_map(dev, 0);
 
        if (u->direction == R10_TO_R0) {
+               /* Number of failed disks must be half of initial disk number */
+               if (imsm_count_failed(super, dev) != (map->num_members / 2))
+                       return 0;
+
                /* iterate through devices to mark removed disks as spare */
                for (dm = super->disks; dm; dm = dm->next) {
                        if (dm->disk.status & FAILED_DISK) {