diff options
author | Dan Williams <dan.j.williams@intel.com> | 2008-08-15 10:58:43 -0700 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2008-08-15 10:58:43 -0700 |
commit | f1d267661dc681dfe9bc1c9c6ad246617206d30f (patch) | |
tree | 77dadd97bcc050c524af07c6192fdc2eb917715c /managemon.c | |
parent | fcb844757f8cee1221fb0f7e2b4ced14e44cb572 (diff) | |
download | mdadm-f1d267661dc681dfe9bc1c9c6ad246617206d30f.tar.gz mdadm-f1d267661dc681dfe9bc1c9c6ad246617206d30f.tar.xz mdadm-f1d267661dc681dfe9bc1c9c6ad246617206d30f.zip |
mdmon: allow degraded arrays to be monitored
manage_new is too strict in the face of failed devices. Teach it to
monitor degraded arrays.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'managemon.c')
-rw-r--r-- | managemon.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/managemon.c b/managemon.c index 7a1c063..0a251de 100644 --- a/managemon.c +++ b/managemon.c @@ -341,6 +341,7 @@ static void manage_new(struct mdstat_ent *mdstat, struct mdinfo *mdi, *di; char *inst; int i; + int failed = 0; /* check if array is ready to be monitored */ if (!mdstat->active) @@ -348,7 +349,7 @@ static void manage_new(struct mdstat_ent *mdstat, mdi = sysfs_read(-1, mdstat->devnum, GET_LEVEL|GET_CHUNK|GET_DISKS|GET_COMPONENT| - GET_DEVS|GET_OFFSET|GET_SIZE|GET_STATE); + GET_DEGRADED|GET_DEVS|GET_OFFSET|GET_SIZE|GET_STATE); new = malloc(sizeof(*new)); @@ -390,10 +391,14 @@ static void manage_new(struct mdstat_ent *mdstat, newd->prev_state = read_dev_state(newd->state_fd); newd->curr_state = newd->prev_state; - } else { - /* we cannot properly monitor without all raid_disks */ + } else if (failed + 1 > new->info.array.failed_disks) { + /* we cannot properly monitor without all working disks */ new->container = NULL; break; + } else { + failed++; + free(newd); + continue; } sprintf(newd->sys_name, "rd%d", i); newd->next = new->info.devs; |