diff options
author | NeilBrown <neilb@suse.de> | 2011-08-25 14:42:51 +1000 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2011-08-25 14:42:51 +1000 |
commit | 5ef56c8fecedf403a346d02140e52a072d693d6b (patch) | |
tree | 1f121fe5e4db61364c352e7ffe2293a1cc20e9a9 /drivers/md | |
parent | 14c62e78dc1379185515be41903c4a667efc6d54 (diff) | |
download | linux-5ef56c8fecedf403a346d02140e52a072d693d6b.tar.bz2 |
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>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/md.c | 7 |
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) int err = -EINVAL; if (cmd_match(buf, "faulty") && rdev->mddev->pers) { md_error(rdev->mddev, rdev); - err = 0; + if (test_bit(Faulty, &rdev->flags)) + err = 0; + else + err = -EBUSY; } else if (cmd_match(buf, "remove")) { if (rdev->raid_disk >= 0) err = -EBUSY; @@ -5983,6 +5986,8 @@ static int set_disk_faulty(mddev_t *mddev, dev_t dev) return -ENODEV; md_error(mddev, rdev); + if (!test_bit(Faulty, &rdev->flags)) + return -EBUSY; return 0; } |