diff options
author | NeilBrown <neilb@suse.de> | 2010-08-17 21:56:59 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2010-08-17 22:04:32 -0400 |
commit | 6b9656205469269c050963c71fca1998b247a560 (patch) | |
tree | 9d090d2e363d269cdc55549213025d86af8ef70a /drivers/md/raid10.c | |
parent | e6ffbcb6cd0ac471223df24ae77eb486c1ee68cc (diff) |
md: provide appropriate return value for spare_active functions.
md_check_recovery expects ->spare_active to return 'true' if any
spares were activated, but none of them do, so the consequent change
in 'degraded' is not notified through sysfs.
So count the number of spares activated, subtract it from 'degraded'
just once, and return it.
Reported-by: Adrian Drzewiecki <adriand@vmware.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/raid10.c')
-rw-r--r-- | drivers/md/raid10.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 76d1fc9c65ba..a2f8a7153dce 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -1116,6 +1116,8 @@ static int raid10_spare_active(mddev_t *mddev) | |||
1116 | int i; | 1116 | int i; |
1117 | conf_t *conf = mddev->private; | 1117 | conf_t *conf = mddev->private; |
1118 | mirror_info_t *tmp; | 1118 | mirror_info_t *tmp; |
1119 | int count = 0; | ||
1120 | unsigned long flags; | ||
1119 | 1121 | ||
1120 | /* | 1122 | /* |
1121 | * Find all non-in_sync disks within the RAID10 configuration | 1123 | * Find all non-in_sync disks within the RAID10 configuration |
@@ -1126,16 +1128,16 @@ static int raid10_spare_active(mddev_t *mddev) | |||
1126 | if (tmp->rdev | 1128 | if (tmp->rdev |
1127 | && !test_bit(Faulty, &tmp->rdev->flags) | 1129 | && !test_bit(Faulty, &tmp->rdev->flags) |
1128 | && !test_and_set_bit(In_sync, &tmp->rdev->flags)) { | 1130 | && !test_and_set_bit(In_sync, &tmp->rdev->flags)) { |
1129 | unsigned long flags; | 1131 | count++; |
1130 | spin_lock_irqsave(&conf->device_lock, flags); | ||
1131 | mddev->degraded--; | ||
1132 | spin_unlock_irqrestore(&conf->device_lock, flags); | ||
1133 | sysfs_notify_dirent(tmp->rdev->sysfs_state); | 1132 | sysfs_notify_dirent(tmp->rdev->sysfs_state); |
1134 | } | 1133 | } |
1135 | } | 1134 | } |
1135 | spin_lock_irqsave(&conf->device_lock, flags); | ||
1136 | mddev->degraded -= count; | ||
1137 | spin_unlock_irqrestore(&conf->device_lock, flags); | ||
1136 | 1138 | ||
1137 | print_conf(conf); | 1139 | print_conf(conf); |
1138 | return 0; | 1140 | return count; |
1139 | } | 1141 | } |
1140 | 1142 | ||
1141 | 1143 | ||