[systemd-devel] [PATCH] machine_kill(): Don't kill the unit when killing the leader
If machinectl poweroff or machinectl reboot is used on a systemd-nspawn container started with --keep-unit and --register, it should *only* send the appropriate signal to the leader PID (i.e. the container's systemd process). It shouldn't fall through to manager_kill_unit() to also send the signal to the unit. The latter ends up killing systemd-nspawn, which takes down the container prematurely. --- src/machine/machine.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/machine/machine.c b/src/machine/machine.c index 1c9177e..13d3448 100644 --- a/src/machine/machine.c +++ b/src/machine/machine.c @@ -493,6 +493,8 @@ int machine_kill(Machine *m, KillWho who, int signo) { if (kill(m-leader, signo) 0) return -errno; + +return 0; } /* Otherwise make PID 1 do it for us, for the entire cgroup */ -- 1.9.2 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] machine_kill(): Don't kill the unit when killing the leader
On Thu, 14.08.14 19:59, Eelco Dolstra (eelco.dols...@logicblox.com) wrote: Thanks! Applied! If machinectl poweroff or machinectl reboot is used on a systemd-nspawn container started with --keep-unit and --register, it should *only* send the appropriate signal to the leader PID (i.e. the container's systemd process). It shouldn't fall through to manager_kill_unit() to also send the signal to the unit. The latter ends up killing systemd-nspawn, which takes down the container prematurely. --- src/machine/machine.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/machine/machine.c b/src/machine/machine.c index 1c9177e..13d3448 100644 --- a/src/machine/machine.c +++ b/src/machine/machine.c @@ -493,6 +493,8 @@ int machine_kill(Machine *m, KillWho who, int signo) { if (kill(m-leader, signo) 0) return -errno; + +return 0; } /* Otherwise make PID 1 do it for us, for the entire cgroup */ Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel