Hi Dan, thanks for all these. I have pulled them and pushed them out. However: On Tuesday October 13, dan.j.williams@xxxxxxxxx wrote: > Try to execute mdmon from the target namespace. When used for initramfs > handovers we need to drop all references to the initramfs filesystem for > that memory to be freed. I'm not 100% sure of this one. Presumably an initramfs is mounted at '/', and the new root is mounted at e.g. /newroot, and we are running: mdmon md127 /newroot and we want to drop all references to '/' that are held by mdmon. Is that right? This doesn't do that. The working directory and the root directory are still '/' and the newly exec'ed mdmon isn't going to drop them. Don't you want: chdir(switchroot); chroot(switchroot); execl("/sbin/mdmon", "mdmon", devname, NULL); and not bother with the sprintf?? NeilBrown > > Cc: Hans de Goede <hdegoede@xxxxxxxxxx> > Signed-off-by: Dan Williams <dan.j.williams@xxxxxxxxx> > --- > mdmon.c | 23 +++++++++++++++++++++++ > 1 files changed, 23 insertions(+), 0 deletions(-) > > diff --git a/mdmon.c b/mdmon.c > index 5f87e78..d3e8be5 100644 > --- a/mdmon.c > +++ b/mdmon.c > @@ -369,6 +369,29 @@ int mdmon(char *devname, int devnum, int scan, char *switchroot) > > dprintf("starting mdmon for %s in %s\n", > devname, switchroot ? : "/"); > + > + /* try to spawn mdmon instances from the target file system */ > + if (switchroot && strcmp(switchroot, "/") != 0) { > + char path[1024]; > + pid_t pid; > + > + sprintf(path, "%s/sbin/mdmon", switchroot); > + switch (fork()) { > + case 0: > + execl(path, "mdmon", devname, NULL); > + exit(1); > + case -1: > + return 1; > + default: > + pid = wait(&status); > + if (pid > -1 && WIFEXITED(status) && > + WEXITSTATUS(status) == 0) > + return 0; > + else > + return 1; > + } > + } > + > mdfd = open_dev(devnum); > if (mdfd < 0) { > fprintf(stderr, "mdmon: %s: %s\n", devname, -- To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html