mirror of
https://github.com/systemd/systemd.git
synced 2025-08-25 13:49:55 +03:00
softreboot: ensure all processes are killed
Having surviving processes is not ready yet as a feature, so ensure everything is killed on the transition for now
This commit is contained in:
@ -122,14 +122,6 @@
|
||||
url="https://systemd.io/PORTABLE_SERVICES">Portable Services</ulink>, but make sure no resource from
|
||||
the host's root filesystem is pinned via <varname>BindPaths=</varname> or similar unit settings,
|
||||
otherwise the old root filesystem will be kept in memory as long as the unit is running.</para>
|
||||
|
||||
<para>If units shall be left running until the very end of shutdown during a soft reboot operation, but
|
||||
shall be terminated regularly during other forms of shutdown, it's recommended to set
|
||||
<varname>DefaultDependencies=no</varname> and then place
|
||||
<varname>Conflicts=</varname>/<varname>Before=</varname> onto <filename>reboot.target</filename>,
|
||||
<filename>kexec.target</filename>, <filename>poweroff.target</filename> and
|
||||
<filename>halt.target</filename> (but <emphasis>not</emphasis> onto
|
||||
<filename>soft-reboot.target</filename>).</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
|
@ -1871,6 +1871,9 @@ static int do_reexecute(
|
||||
* SIGCHLD for them after deserializing. */
|
||||
if (IN_SET(objective, MANAGER_SWITCH_ROOT, MANAGER_SOFT_REBOOT))
|
||||
broadcast_signal(SIGTERM, /* wait_for_exit= */ false, /* send_sighup= */ true, arg_default_timeout_stop_usec);
|
||||
/* On soft reboot really make sure nothing is left */
|
||||
if (objective == MANAGER_SOFT_REBOOT)
|
||||
broadcast_signal(SIGKILL, /* wait_for_exit= */ false, /* send_sighup= */ false, arg_default_timeout_stop_usec);
|
||||
|
||||
if (!switch_root_dir && objective == MANAGER_SOFT_REBOOT) {
|
||||
/* If no switch root dir is specified, then check if /run/nextroot/ qualifies and use that */
|
||||
|
@ -20,14 +20,10 @@ if [ -f /run/testsuite82.touch3 ]; then
|
||||
read -r x <&5
|
||||
test "$x" = "oinkoink"
|
||||
|
||||
# Check that the surviving service is still around
|
||||
test "$(systemctl show -P ActiveState testsuite-82-survive.service)" = "active"
|
||||
# Check that no service is still around
|
||||
test "$(systemctl show -P ActiveState testsuite-82-survive.service)" != "active"
|
||||
test "$(systemctl show -P ActiveState testsuite-82-nosurvive.service)" != "active"
|
||||
|
||||
# Take out the big guns now, and kill the service via SIGKILL (SIGTERM is blocked after all, see below)
|
||||
systemctl --signal=KILL kill testsuite-82-survive.service
|
||||
systemctl stop testsuite-82-survive.service
|
||||
|
||||
# All succeeded, exit cleanly now
|
||||
|
||||
elif [ -f /run/testsuite82.touch2 ]; then
|
||||
@ -47,8 +43,8 @@ elif [ -f /run/testsuite82.touch2 ]; then
|
||||
systemd-notify --fd=3 --pid=parent 3<"$T"
|
||||
rm "$T"
|
||||
|
||||
# Check that the surviving service is still around
|
||||
test "$(systemctl show -P ActiveState testsuite-82-survive.service)" = "active"
|
||||
# Check that no service is still around
|
||||
test "$(systemctl show -P ActiveState testsuite-82-survive.service)" != "active"
|
||||
test "$(systemctl show -P ActiveState testsuite-82-nosurvive.service)" != "active"
|
||||
|
||||
# Test that we really are in the new overlayfs root fs
|
||||
@ -86,8 +82,8 @@ elif [ -f /run/testsuite82.touch ]; then
|
||||
systemd-notify --fd=3 --pid=parent 3<"$T"
|
||||
rm "$T"
|
||||
|
||||
# Check that the surviving service is still around
|
||||
test "$(systemctl show -P ActiveState testsuite-82-survive.service)" = "active"
|
||||
# Check that no service survived, regardless of the configuration
|
||||
test "$(systemctl show -P ActiveState testsuite-82-survive.service)" != "active"
|
||||
test "$(systemctl show -P ActiveState testsuite-82-nosurvive.service)" != "active"
|
||||
|
||||
# This time we test the /run/nextroot/ root switching logic. (We synthesize a new rootfs from the old via overlayfs)
|
||||
|
Reference in New Issue
Block a user