summaryrefslogtreecommitdiffstats
path: root/Manage.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2009-12-08 17:26:31 +1100
committerNeilBrown <neilb@suse.de>2009-12-08 17:26:31 +1100
commit5c64fcb5358953883ae6b72e584bf7dbbae2b71f (patch)
tree65d2454be6fefcd44e8e91b99e284d92cb6f3c1e /Manage.c
parent034b203a4754da7615d7b16bafeabfc4115dabea (diff)
downloadmdadm-5c64fcb5358953883ae6b72e584bf7dbbae2b71f.tar.gz
mdadm-5c64fcb5358953883ae6b72e584bf7dbbae2b71f.tar.xz
mdadm-5c64fcb5358953883ae6b72e584bf7dbbae2b71f.zip
Don't attempt a re-add if the device is marked as faulty.
If a device is marked as faulty, then a re-add will cause it to be added as a faulty drive, which is not what it wanted. So just refuse to try to re-add a device which is marked 'faulty'. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'Manage.c')
-rw-r--r--Manage.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Manage.c b/Manage.c
index fb9b972..1ca371d 100644
--- a/Manage.c
+++ b/Manage.c
@@ -565,7 +565,10 @@ int Manage_subdevs(char *devname, int fd,
disc.state |= 1 << MD_DISK_WRITEMOSTLY;
if (dv->writemostly == 2)
disc.state &= ~(1 << MD_DISK_WRITEMOSTLY);
- if (ioctl(fd, ADD_NEW_DISK, &disc) == 0) {
+ /* don't even try if disk is marked as faulty */
+ errno = 0;
+ if ((disc.state & 1) == 0 &&
+ ioctl(fd, ADD_NEW_DISK, &disc) == 0) {
if (verbose >= 0)
fprintf(stderr, Name ": re-added %s\n", dv->devname);
continue;