Commit 6a6ad7af by Daniel Lezcano

make container to die when parent dies

When the parent of the first process dies, the container stays there making very difficuly to track it and to kill. We have to use the lxc-ps --lxc and kill the processes, hoping we kill the init process of the container. That's not a big deal until we have thousand of processes in the container :) We want to keep the parent of the container init always there, this process is responsible to manage the container, provide tty, notify the container changing states and ensure self exclusion (eg. avoid to launch several containers with the same name). If this process dies, we consider that as a fatal error and we make the child process to die too. This patch will just add the prctl to to send a SIGKILL to the container init process when its parent exits For the point of view of the pid namespace, when the init process dies all the processes of the namespace are killed too. Signed-off-by: 's avatarDaniel Lezcano <dlezcano@fr.ibm.com>
parent a9e61274
......@@ -368,6 +368,11 @@ static int do_start(void *arg)
goto out_child;
}
if (prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0)) {
SYSERROR("failed to set pdeath signal");
goto out_child;
}
NOTICE("exec'ing '%s'", argv[0]);
execvp(argv[0], argv);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment