cgroup: freezer action must be NOP when cgroup v2 freezer is not available v239-41
authorMichal Sekletár <msekleta@redhat.com>
Tue, 8 Sep 2020 12:51:39 +0000 (14:51 +0200)
committerJan Synacek <jan.synacek@gmail.com>
Wed, 7 Oct 2020 08:20:26 +0000 (10:20 +0200)
commit45d093a37b6f8c2ceae9bfd090c5265f35413b46
tree51e98bb04699ca1172de6d20eff614382cdecc06
parent37f2576684d7494c916fd1f13275982f3c43f44f
cgroup: freezer action must be NOP when cgroup v2 freezer is not available

Low-level cgroup freezer state manipulation is invoked directly from the
job engine when we are about to execute the job in order to make sure
the unit is not frozen and job execution is not blocked because of
that.

Currently with cgroup v1 we would needlessly do a bunch of work in the
function and even falsely update the freezer state. Don't do any of this
and skip the function silently when v2 freezer is not available.

Following bug is fixed by this commit,

$ systemd-run --unit foo.service /bin/sleep infinity
$ systemctl restart foo.service
$ systemctl show -p FreezerState foo.service

Before (cgroup v1, i.e. full "legacy" mode):
FreezerState=thawing

After:
FreezerState=running

(cherry picked from commit 9a1e90aee556b7a30d87553a891a4175ae77ed68)

Resolves: #1868831
src/core/cgroup.c