summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Ledford <dledford@redhat.com>2010-04-15 17:38:37 -0400
committerDoug Ledford <dledford@redhat.com>2010-04-15 17:38:37 -0400
commit097c0ef1870e64667f85e689286228035af8323e (patch)
tree1b9e6074ca81fccdb9d262e9e7ebdf69d4421eec
parent67da8fb8592e9e590ac7467c3bfa50e7c032de3a (diff)
downloadmdadm-097c0ef1870e64667f85e689286228035af8323e.tar.gz
mdadm-097c0ef1870e64667f85e689286228035af8323e.tar.xz
mdadm-097c0ef1870e64667f85e689286228035af8323e.zip
Added sanity checks on DOMAIN lines, add an action_mask value
Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r--config.c16
-rw-r--r--mdadm.h1
2 files changed, 15 insertions, 2 deletions
diff --git a/config.c b/config.c
index a1eb9dd..55c7ba6 100644
--- a/config.c
+++ b/config.c
@@ -811,10 +811,10 @@ void domainline(char *line)
}
/* Some sanity checks now that all the options are parsed */
if ((de->action & force) &&
- ((de->action & (force - 1)) <= incremental)) {
+ ((de->action & action_mask) <= incremental)) {
fprintf(stderr, Name ": force makes no sense with ignore or "
"incremental, removing.\n");
- de->action &= (force - 1);
+ de->action &= action_mask;
}
if (de->spare_group && de->action <= incremental) {
fprintf(stderr, Name ": defined a spare group when we aren't "
@@ -822,6 +822,18 @@ 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 ((strstr(path->path, "part") != NULL) ||
+ (path->path[strlen(path->path) - 1] == '*')) {
+ fprintf(stderr, Name ": partition method only "
+ "allowed on whole disks, not on "
+ "partitions\n");
+ fprintf(stderr, Name ": bad path=%s\n",
+ path->path);
+ free_domain(de);
+ return;
+ }
de->next = domain_list;
domain_list = de;
}
diff --git a/mdadm.h b/mdadm.h
index e090920..6b50953 100644
--- a/mdadm.h
+++ b/mdadm.h
@@ -286,6 +286,7 @@ enum domain_actions {
appropriate things with the partitions */
spare,
grow,
+ action_mask=511,
force=512, /* so we can bitwise & this with actions to signify we
should forcibly take over drives even if they have
other metadata on them */