found 601198 linux-2.6/2.6.32-41 tags 601198 + patch moreinfo quit Hi Mike,
Mike Hommey wrote: > Just had this scary experience this morning, where I thought I did > something really wrong, being that I setted faulty the only remaining > active device from a raid 1 array during recovery, when I meant to > set the other one faulty: [...] > # mdadm --set-faulty /dev/md0 /dev/sdb2 > mdadm: set /dev/sdb2 faulty in /dev/md0 > > Here I thought I was screwed, but it turns out it really didn't happen. > > For people's blood pressure, it would better if it managed to say it > failed doing the requested operation. Said to be fixed by v3.1-rc5~4^2~5 (md: report failure if a 'set faulty' request doesn't, 2011-08-25). Do you think this is worth fixing in squeeze? If so, please test the attached patch. Thanks, Jonathan
From: NeilBrown <ne...@suse.de> Date: Thu, 25 Aug 2011 14:42:51 +1000 Subject: md: report failure if a 'set faulty' request doesn't. commit 5ef56c8fecedf403a346d02140e52a072d693d6b upstream. 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+report...@glandium.org> Signed-off-by: NeilBrown <ne...@suse.de> Signed-off-by: Jonathan Nieder <jrnie...@gmail.com> --- drivers/md/md.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index 4ce6e2fa4b53..f585062e7204 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -2180,7 +2180,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; @@ -5321,6 +5324,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; } -- 1.7.10.rc1