From: NeilBrown Date: Fri, 20 Oct 2006 03:25:30 +0000 (+1000) Subject: [PATCH] md: Fix calculation of ->degraded for multipath and raid10 X-Git-Tag: v2.6.18.2~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8fb3dd17ba82cf264224fc19c69efb42e4370f28;p=thirdparty%2Fkernel%2Fstable.git [PATCH] md: Fix calculation of ->degraded for multipath and raid10 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 Signed-off-by: Greg Kroah-Hartman Signed-off-by: Chris Wright --- diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c index 1cc9de44ce86c..33f67caa91701 100644 --- a/drivers/md/multipath.c +++ b/drivers/md/multipath.c @@ -480,7 +480,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)); diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 016ddb831c9b3..115a6f866a873 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -2042,7 +2042,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++; }