summaryrefslogtreecommitdiff
path: root/Incremental.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2008-05-27 09:18:52 +1000
committerNeil Brown <neilb@suse.de>2008-05-27 09:18:52 +1000
commit75aa18b53cb2df342bc78dd9e44cd0f0c51075f0 (patch)
tree440b2622a2a035f19f70f249d24e39ce79366321 /Incremental.c
parent25dbe93ab48b6cb45e1fc72b27aaa75d4c1fa48c (diff)
Start mdmon during incremental assembly of container
Diffstat (limited to 'Incremental.c')
-rw-r--r--Incremental.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/Incremental.c b/Incremental.c
index 18cdf3fa..5c582bb3 100644
--- a/Incremental.c
+++ b/Incremental.c
@@ -849,11 +849,35 @@ int Incremental_container(struct supertype *st, char *devname, int verbose,
default:
sysfs_set_str(sra, NULL, "array_state",
"readonly");
+ /* start mdmon if needed. */
+ if (mdmon_running(st->container_dev))
+ signal_mdmon(st->container_dev);
+ else {
+ int dn = st->container_dev;
+ int i;
+ switch(fork()) {
+ case 0:
+ /* FIXME yuk. CLOSE_EXEC?? */
+ for (i=3; i < 100; i++)
+ close(i);
+ execl("./mdmon", "mdmon",
+ map_dev(dev2major(dn),
+ dev2minor(dn),
+ 1), NULL);
+ exit(1);
+ case -1: fprintf(stderr, Name
+ ": cannot fork. "
+ "Array remains readonly\n");
+ return 1;
+ default: ; /* parent - good */
+ }
+ }
break;
}
if (verbose >= 0)
printf("Started %s with %d devices\n",
chosen_name, working);
+ /* FIXME should have an O_EXCL and wait for read-auto */
} else
if (verbose >= 0)
printf("%s assembled with %d devices but "