Systemd/src/core
HATAYAMA Daisuke 9c1f969d40 swap: finish the secondary swap units' jobs if deactivation of the primary swap unit fails
Currently, if deactivation of the primary swap unit fails:

    # LANG=C systemctl --no-pager stop dev-mapper-fedora\\x2dswap.swap
    Job for dev-mapper-fedora\x2dswap.swap failed.
    See "systemctl status "dev-mapper-fedora\\x2dswap.swap"" and "journalctl -xe" for details.

then there are still the running stop jobs for all the secondary swap units
that follow the primary one:

    # systemctl list-jobs
     JOB UNIT                                                                                                         TYPE STATE
     3233 dev-disk-by\x2duuid-2dc8b9b1\x2da0a5\x2d44d8\x2d89c4\x2d6cdd26cd5ce0.swap                                    stop running
     3232 dev-dm\x2d1.swap                                                                                             stop running
     3231 dev-disk-by\x2did-dm\x2duuid\x2dLVM\x2dyuXWpCCIurGzz2nkGCVnUFSi7GH6E3ZcQjkKLnF0Fil0RJmhoLN8fcOnDybWCMTj.swap stop running
     3230 dev-disk-by\x2did-dm\x2dname\x2dfedora\x2dswap.swap                                                          stop running
     3234 dev-fedora-swap.swap                                                                                         stop running

    5 jobs listed.

This remains endlessly because their JobTimeoutUSec is infinity:

    # LANG=C systemctl show -p JobTimeoutUSec dev-fedora-swap.swap
    JobTimeoutUSec=infinity

If this issue happens during system shutdown, the system shutdown appears to
get hang and the system will be forcibly shutdown or rebooted 30 minutes later
by the following configuration:

    # grep -E "^JobTimeout" /usr/lib/systemd/system/reboot.target
    JobTimeoutSec=30min
    JobTimeoutAction=reboot-force

The scenario in the real world seems that there is some service unit with
KillMode=none, processes whose memory is being swapped out are not killed
during stop operation in the service unit and then swapoff command fails.

On the other hand, it works well in successful case of swapoff command because
the secondary jobs monitor /proc/swaps file and can detect deletion of the
corresponding swap file.

This commit fixes the issue by finishing the secondary swap units' jobs if
deactivation of the primary swap unit fails.

Fixes: #11577
2020-02-27 08:40:51 +01:00
..
all-units.h core: add spdx header to all-units.h 2019-07-24 05:06:21 +09:00
audit-fd.c tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
audit-fd.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
automount.c core: clearly refuse OnFailure= deps on units that can't fail 2020-01-09 11:03:53 +01:00
automount.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
bpf-devices.c bpf-devices: line-break some overly long function signatures 2020-01-07 18:41:36 +01:00
bpf-devices.h bpf: make bpf_devices_apply_policy() independent of any unit code 2019-11-11 14:55:57 +01:00
bpf-firewall.c core: constify bpf program arrays 2019-11-10 23:22:14 +01:00
bpf-firewall.h bpf-firewall: custom BPF programs through IP(Ingress|Egress)FilterPath= 2019-06-25 09:56:16 +02:00
cgroup.c cgroup: minor comment improvement 2020-01-14 16:57:51 +01:00
cgroup.h core: make TasksMax a partially dynamic property 2019-11-14 18:41:54 +01:00
core-varlink.c core: reduce indentation a bit 2020-01-17 08:13:09 +01:00
core-varlink.h core: add user/group resolution varlink interface to PID 1 2020-01-15 15:28:55 +01:00
dbus-automount.c tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
dbus-automount.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
dbus-cgroup.c core: write cgroup limits as permilles 2019-11-14 18:41:54 +01:00
dbus-cgroup.h core: make TasksMax a partially dynamic property 2019-11-14 18:41:54 +01:00
dbus-device.c tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
dbus-device.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
dbus-execute.c core: sync SeccompParseFlags between dbus-execute and load-fragment 2020-02-07 13:39:35 +09:00
dbus-execute.h core: add ExecStartXYZEx= with dbus support for executable prefixes 2019-05-30 20:41:42 -07:00
dbus-job.c core: move bus-util include out of selinux-access header 2020-02-04 19:26:38 +01:00
dbus-job.h core: add helper function to check job status 2019-10-01 15:05:27 +02:00
dbus-kill.c core: add support for RestartKillSignal= to override signal used for restart jobs 2019-10-02 14:01:25 +02:00
dbus-kill.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
dbus-manager.c core: move bus-util include out of selinux-access header 2020-02-04 19:26:38 +01:00
dbus-manager.h core: implement OOMPolicy= and watch cgroups for OOM killings 2019-04-09 11:17:58 +02:00
dbus-mount.c cgroup: drastically simplify caching of cgroups members mask 2018-11-23 13:41:37 +01:00
dbus-mount.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
dbus-path.c tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
dbus-path.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
dbus-scope.c scope: Support RuntimeMaxSec= directive in scope units 2019-10-28 09:44:31 +01:00
dbus-scope.h pid1: add a new AbandonScope() method call on the Manager object 2018-11-09 17:08:59 +01:00
dbus-service.c pid1: make TimeoutAbortSec settable for transient units 2019-11-27 13:56:29 +01:00
dbus-service.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
dbus-slice.c cgroup: drastically simplify caching of cgroups members mask 2018-11-23 13:41:37 +01:00
dbus-slice.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
dbus-socket.c util-lib: move things that parse ifnames to shared/ 2020-01-11 12:07:28 +01:00
dbus-socket.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
dbus-swap.c core: expose swap priority value via dbus only if it is set 2020-01-09 17:08:10 +01:00
dbus-swap.h tree-wide: beautify remaining copyright statements 2018-06-14 10:20:21 +02:00
dbus-target.c tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
dbus-target.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
dbus-timer.c core: TAKE_PTR in timer_add_one_calendar_spec 2019-08-22 11:02:56 +02:00
dbus-timer.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
dbus-unit.c core: move bus-util include out of selinux-access header 2020-02-04 19:26:38 +01:00
dbus-unit.h core: add helper function to check job status 2019-10-01 15:05:27 +02:00
dbus-util.c shared/user-util: allow usernames with dots in specific fields 2019-08-19 21:19:13 +02:00
dbus-util.h shared/user-util: allow usernames with dots in specific fields 2019-08-19 21:19:13 +02:00
dbus.c core: move bus-util include out of selinux-access header 2020-02-04 19:26:38 +01:00
dbus.h core: drop initial ListNames() bus call from PID 1 2020-01-06 15:21:47 +01:00
device.c core: clearly refuse OnFailure= deps on units that can't fail 2020-01-09 11:03:53 +01:00
device.h device: clean up DeviceFound flags set 2018-10-09 21:11:22 +02:00
dynamic-user.c core: call dynamic_user_acquire() only when 'group' is non-null 2020-02-03 21:51:07 +09:00
dynamic-user.h tree-wide: reorder various structures to make them smaller and use fewer cache lines 2019-03-27 18:11:11 +01:00
efi-random.c core: take random seed from boot loader and credit it to kernel entropy pool 2019-07-25 18:16:46 +02:00
efi-random.h core: take random seed from boot loader and credit it to kernel entropy pool 2019-07-25 18:16:46 +02:00
emergency-action.c core: add new API for enqueing a job with returning the transaction data 2019-03-27 12:37:37 +01:00
emergency-action.h core: change emergency_action() to return void 2019-03-18 16:06:36 +01:00
execute.c core: add new LogNamespace= execution setting 2020-01-31 15:01:43 +01:00
execute.h core: add new LogNamespace= execution setting 2020-01-31 15:01:43 +01:00
hostname-setup.c tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
hostname-setup.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
ima-setup.c headers: remove unneeded includes from util.h 2019-03-27 11:53:12 +01:00
ima-setup.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
ip-address-access.c bpf-firewall: optimization for IPAddressXYZ="any" (and unprivileged users) 2019-06-22 19:56:06 +02:00
ip-address-access.h bpf-firewall: optimization for IPAddressXYZ="any" (and unprivileged users) 2019-06-22 19:56:06 +02:00
job.c job: Don't mark as redundant if deps are relevant 2020-01-03 15:58:10 +01:00
job.h job: Don't mark as redundant if deps are relevant 2020-01-03 15:58:10 +01:00
kill.c core: add support for RestartKillSignal= to override signal used for restart jobs 2019-10-02 14:01:25 +02:00
kill.h core: add support for RestartKillSignal= to override signal used for restart jobs 2019-10-02 14:01:25 +02:00
killall.c killall: update reference to root storage daemon interface docs 2020-01-13 18:53:46 +01:00
killall.h core/killall: Propagate errors and return the number of process left 2019-04-08 19:41:16 +02:00
kmod-setup.c tree-wide: drop libkmod.h when module-util.h is included 2019-11-04 00:30:32 +09:00
kmod-setup.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
load-dropin.c core,install: allow one more case of "instance propagation" 2020-01-10 14:31:01 +01:00
load-dropin.h pid1: kill unit_file_find_dropin_paths() helper 2019-07-17 14:27:23 +02:00
load-fragment-gperf-nulstr.awk
load-fragment-gperf.gperf.m4 core: add new LogNamespace= execution setting 2020-01-31 15:01:43 +01:00
load-fragment.c core: add new LogNamespace= execution setting 2020-01-31 15:01:43 +01:00
load-fragment.h core: add new LogNamespace= execution setting 2020-01-31 15:01:43 +01:00
locale-setup.c tree-wide: drop string.h when string-util.h or friends are included 2019-11-04 00:30:32 +09:00
locale-setup.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
loopback-setup.c tree-wide: drop missing.h 2019-10-31 17:57:03 +09:00
loopback-setup.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
machine-id-setup.c Generate stable machine-id and DHCP client ID on POWER KVM. 2019-08-31 10:57:16 +02:00
machine-id-setup.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
macros.systemd.in rpm: avoid hiding errors from systemd commands 2019-03-22 20:54:59 +01:00
main.c Fix typo 2019-12-26 12:07:08 +09:00
manager.c core: show the UID we cannot parse 2020-01-21 11:51:26 +01:00
manager.h core: add user/group resolution varlink interface to PID 1 2020-01-15 15:28:55 +01:00
meson.build core: add user/group resolution varlink interface to PID 1 2020-01-15 15:28:55 +01:00
mount-setup.c core: create inaccessible nodes for users when making runtime dirs 2019-12-18 11:09:30 -08:00
mount-setup.h core: remove JoinControllers= configuration setting 2018-11-16 14:54:13 +01:00
mount.c core: add implicit ordering dep on blockdev@.target from all mount units 2020-01-21 20:23:44 +01:00
mount.h core/mount: support "systemctl clean" for mount units 2019-08-28 23:09:54 +09:00
namespace.c core: do not prepare a SELinux context for dummy files for devicenode bind-mounting 2020-02-06 10:20:14 +01:00
namespace.h core: add new LogNamespace= execution setting 2020-01-31 15:01:43 +01:00
org.freedesktop.systemd1.conf systemd-analyze: make dump work for large # of units 2018-05-11 08:11:02 -07:00
org.freedesktop.systemd1.policy.in core: systemd1.manage-unit-files policy implies systemd1.manage-units 2018-05-18 00:02:58 +09:00
org.freedesktop.systemd1.service Revert "Drop dbus activation stub service" 2019-12-20 17:28:12 +01:00
path.c core: clearly refuse OnFailure= deps on units that can't fail 2020-01-09 11:03:53 +01:00
path.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
scope.c core: clearly refuse OnFailure= deps on units that can't fail 2020-01-09 11:03:53 +01:00
scope.h scope: Support RuntimeMaxSec= directive in scope units 2019-10-28 09:44:31 +01:00
selinux-access.c core/selinux-access: use _cleanup_ and improve logging 2020-02-06 23:06:55 +01:00
selinux-access.h core: move bus-util include out of selinux-access header 2020-02-04 19:26:38 +01:00
selinux-setup.c headers: remove unneeded includes from util.h 2019-03-27 11:53:12 +01:00
selinux-setup.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
service.c core: make sure StandardInput=file: doesn't get dup'ed to stdout/stderr by default 2020-01-20 17:19:42 +01:00
service.h core: move timeout_clean_usec from Service to ExecContext 2019-08-28 23:09:54 +09:00
show-status.c Add config and kernel commandline option to use short identifiers 2019-07-10 13:35:26 +02:00
show-status.h Add config and kernel commandline option to use short identifiers 2019-07-10 13:35:26 +02:00
slice.c core: adjust load functions for other unit types to be more like service 2019-10-11 13:46:05 +02:00
slice.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
smack-setup.c tree-wide: drop dirent.h when dirent-util.h is included 2019-11-04 00:30:32 +09:00
smack-setup.h tree-wide: use proper unicode © instead of (C) where we can 2018-06-14 10:20:20 +02:00
socket.c Merge pull request #14505 from poettering/refuse-on-failure 2020-01-14 14:19:04 +01:00
socket.h core/socket: support "systemctl clean" for socket units 2019-08-28 23:09:54 +09:00
swap.c swap: finish the secondary swap units' jobs if deactivation of the primary swap unit fails 2020-02-27 08:40:51 +01:00
swap.h core: swap priority can be negative 2019-12-04 08:57:08 +01:00
system.conf.in core: rename ShutdownWatchdogSec to RebootWatchdogSec 2019-07-23 20:29:03 +01:00
systemd.pc.in pkgconf: add full generator paths 2020-01-18 17:48:28 +01:00
target.c core: adjust load functions for other unit types to be more like service 2019-10-11 13:46:05 +02:00
target.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
timer.c core: clearly refuse OnFailure= deps on units that can't fail 2020-01-09 11:03:53 +01:00
timer.h core: optionally, trigger .timer units on timezone and clock changes 2019-04-02 08:20:10 +02:00
transaction.c job: Don't mark as redundant if deps are relevant 2020-01-03 15:58:10 +01:00
transaction.h core: Add triggering job mode 2019-11-05 11:17:38 -08:00
triggers.systemd.in Drop my copyright headers 2018-06-14 13:03:20 +02:00
unit-printf.c core: mark unit_*_printf() functions as taking a const Unit* 2019-10-16 16:21:56 +02:00
unit-printf.h core: mark unit_*_printf() functions as taking a const Unit* 2019-10-16 16:21:56 +02:00
unit.c Merge pull request #14156 from fbuihuu/deal-with-aliases-when-disabling 2020-02-06 10:46:21 +01:00
unit.h core: unit_label_path(): take const unit 2020-02-04 18:36:19 +01:00
user.conf.in Add config and kernel commandline option to use short identifiers 2019-07-10 13:35:26 +02:00