aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2011-08-25 00:42:51 -0400
committerNeilBrown <neilb@suse.de>2011-08-25 00:42:51 -0400
commit5ef56c8fecedf403a346d02140e52a072d693d6b (patch)
tree1f121fe5e4db61364c352e7ffe2293a1cc20e9a9
parent14c62e78dc1379185515be41903c4a667efc6d54 (diff)
md: report failure if a 'set faulty' request doesn't.
Sometimes a device will refuse to be set faulty. e.g. RAID1 will never let the last working device become faulty. So check if "md_error()" did manage to set the faulty flag and fail with EBUSY if it didn't. Resolves-Debian-Bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=601198 Reported-by: Mike Hommey <mh+reportbug@glandium.org> Signed-off-by: NeilBrown <neilb@suse.de>
-rw-r--r--drivers/md/md.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 8e221a20f5d9..1cd9bfb45e9a 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -2561,7 +2561,10 @@ state_store(mdk_rdev_t *rdev, const char *buf, size_t len)
2561 int err = -EINVAL; 2561 int err = -EINVAL;
2562 if (cmd_match(buf, "faulty") && rdev->mddev->pers) { 2562 if (cmd_match(buf, "faulty") && rdev->mddev->pers) {
2563 md_error(rdev->mddev, rdev); 2563 md_error(rdev->mddev, rdev);
2564 err = 0; 2564 if (test_bit(Faulty, &rdev->flags))
2565 err = 0;
2566 else
2567 err = -EBUSY;
2565 } else if (cmd_match(buf, "remove")) { 2568 } else if (cmd_match(buf, "remove")) {
2566 if (rdev->raid_disk >= 0) 2569 if (rdev->raid_disk >= 0)
2567 err = -EBUSY; 2570 err = -EBUSY;
@@ -5983,6 +5986,8 @@ static int set_disk_faulty(mddev_t *mddev, dev_t dev)
5983 return -ENODEV; 5986 return -ENODEV;
5984 5987
5985 md_error(mddev, rdev); 5988 md_error(mddev, rdev);
5989 if (!test_bit(Faulty, &rdev->flags))
5990 return -EBUSY;
5986 return 0; 5991 return 0;
5987} 5992}
5988 5993