md: do not count blocked devices as spares
authorDan Williams <dan.j.williams@intel.com>
Tue, 29 Jul 2008 06:28:06 +0000 (23:28 -0700)
committerDan Williams <dan.j.williams@intel.com>
Tue, 29 Jul 2008 00:52:44 +0000 (17:52 -0700)
remove_and_add_spares() assumes that failed devices have been hot-removed
from the array.  Removal is skipped in the 'blocked' case so do not count a
device in this state as 'spare'.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/md/md.c

index 0f1b83096425a5afcb3642b7a3402ed4e4317e71..c7aae66c6f9bc55386aea5a57db74b78ca27dd30 100644 (file)
@@ -5996,7 +5996,8 @@ static int remove_and_add_spares(mddev_t *mddev)
        if (mddev->degraded) {
                rdev_for_each(rdev, rtmp, mddev) {
                        if (rdev->raid_disk >= 0 &&
-                           !test_bit(In_sync, &rdev->flags))
+                           !test_bit(In_sync, &rdev->flags) &&
+                           !test_bit(Blocked, &rdev->flags))
                                spares++;
                        if (rdev->raid_disk < 0
                            && !test_bit(Faulty, &rdev->flags)) {