summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Manage.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Manage.c b/Manage.c
index fb9b9723..1ca371db 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;