summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Ledford <dledford@redhat.com>2010-04-16 11:19:35 -0400
committerDoug Ledford <dledford@redhat.com>2010-04-16 11:19:35 -0400
commit8da2e49bcfa73c59bafe5aa51949752c524a3f69 (patch)
tree23a19ed720a950a6aafd9caf1c932bb0fbd02ab5
parente5a26305d1ef888a34a30f9885eeb955800729f5 (diff)
downloadmdadm-8da2e49bcfa73c59bafe5aa51949752c524a3f69.tar.gz
mdadm-8da2e49bcfa73c59bafe5aa51949752c524a3f69.tar.xz
mdadm-8da2e49bcfa73c59bafe5aa51949752c524a3f69.zip
Don't throw away an entire domain because of one bad path. But if it
turns out there are no good paths, then do throw the domain away. Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r--config.c30
1 files changed, 25 insertions, 5 deletions
diff --git a/config.c b/config.c
index 46b5844..10c10e2 100644
--- a/config.c
+++ b/config.c
@@ -714,7 +714,7 @@ void domainline(char *line)
{
char *w;
struct domain_ent *de;
- struct domain_path *path;
+ struct domain_path *path, *prev_path;
int offset, a_seen=0, m_seen=0, sg_seen=0;
de = malloc(sizeof(struct domain_ent));
@@ -822,8 +822,8 @@ void domainline(char *line)
free(de->spare_group);
de->spare_group = NULL;
}
- if ((de->action & action_mask) == partition)
- for (path = de->paths; path; path = path->next)
+ if ((de->action & action_mask) == partition) {
+ for (prev_path = NULL, path = de->paths; path; )
if ((strstr(path->path, "part") != NULL) ||
(path->path[strlen(path->path) - 1] == '*')) {
fprintf(stderr, Name ": partition method only "
@@ -831,9 +831,29 @@ void domainline(char *line)
"partitions\n");
fprintf(stderr, Name ": bad path=%s\n",
path->path);
- free_domain(de);
- return;
+ if (prev_path) {
+ prev_path->next = path->next;
+ free(path->path);
+ free(path);
+ path = prev_path->next;
+ } else {
+ de->paths = path->next;
+ free(path->path);
+ free(path);
+ path = de->paths;
+ }
+ } else {
+ prev_path = path;
+ path = path->next;
}
+ if (de->paths == NULL) {
+ /* We freed all the paths, kill this domain */
+ fprintf(stderr, Name ": no valid paths in domain, "
+ "freeing.\n");
+ free_domain(de);
+ return;
+ }
+ }
de->next = domain_list;
domain_list = de;
}