md: bad blocks shouldn't cause a Blocked status on a Faulty device.
authorNeilBrown <neilb@suse.de>
Thu, 8 Dec 2011 05:22:48 +0000 (16:22 +1100)
committerNeilBrown <neilb@suse.de>
Thu, 8 Dec 2011 05:22:48 +0000 (16:22 +1100)
Once a device is marked Faulty the badblocks - whether acknowledged or
not - become irrelevant.  So they shouldn't cause the device to be
marked as Blocked.

Without this patch, a process might write "-blocked" to clear the
Blocked status, but while that will correctly fail the device, it
won't remove the apparent 'blocked' status.

Signed-off-by: NeilBrown <neilb@suse.de>
drivers/md/md.c

index f97c3b2f2f89e6785892ef8fc563ddab946be13d..d730e8f513a713320a76f5408d2f37370f5893b4 100644 (file)
@@ -2546,7 +2546,8 @@ state_show(struct md_rdev *rdev, char *page)
                sep = ",";
        }
        if (test_bit(Blocked, &rdev->flags) ||
-           rdev->badblocks.unacked_exist) {
+           (rdev->badblocks.unacked_exist
+            && !test_bit(Faulty, &rdev->flags))) {
                len += sprintf(page+len, "%sblocked", sep);
                sep = ",";
        }