chiark / gitweb /
machine_kill(): Don't kill the unit when killing the leader
authorEelco Dolstra <eelco.dolstra@logicblox.com>
Thu, 14 Aug 2014 17:59:16 +0000 (19:59 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 14 Aug 2014 18:10:33 +0000 (20:10 +0200)
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

index 1c9177e1c379b9a60ad2a7424b42bf2b8af8b4a6..13d3448adf47422ce66a6da43bfc82fd7e5de664 100644 (file)
@@ -493,6 +493,8 @@ int machine_kill(Machine *m, KillWho who, int signo) {
 
                 if (kill(m->leader, signo) < 0)
                         return -errno;
 
                 if (kill(m->leader, signo) < 0)
                         return -errno;
+
+                return 0;
         }
 
         /* Otherwise make PID 1 do it for us, for the entire cgroup */
         }
 
         /* Otherwise make PID 1 do it for us, for the entire cgroup */