[PATCH] md: fix calculation of ->degraded for multipath and raid10
authorNeilBrown <neilb@suse.de>
Sat, 21 Oct 2006 17:24:07 +0000 (10:24 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Sat, 21 Oct 2006 20:35:05 +0000 (13:35 -0700)
Two less-used md personalities have bugs in the calculation of ->degraded (the
extent to which the array is degraded).

Signed-off-by: Neil Brown <neilb@suse.de>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/md/multipath.c
drivers/md/raid10.c

index 171ff41..a6260f0 100644 (file)
@@ -501,7 +501,7 @@ static int multipath_run (mddev_t *mddev)
                        mdname(mddev));
                goto out_free_conf;
        }
-       mddev->degraded = conf->raid_disks = conf->working_disks;
+       mddev->degraded = conf->raid_disks - conf->working_disks;
 
        conf->pool = mempool_create_kzalloc_pool(NR_RESERVED_BUFS,
                                                 sizeof(struct multipath_bh));
index 1250f0e..74f17a9 100644 (file)
@@ -2079,7 +2079,7 @@ static int run(mddev_t *mddev)
                disk = conf->mirrors + i;
 
                if (!disk->rdev ||
-                   !test_bit(In_sync, &rdev->flags)) {
+                   !test_bit(In_sync, &disk->rdev->flags)) {
                        disk->head_position = 0;
                        mddev->degraded++;
                }