]> git.ipfire.org Git - thirdparty/systemd.git/commit
core: Make (user) instance aware of delegated cgroup controllers
authorMichal Koutný <mkoutny@suse.com>
Tue, 26 Jan 2021 18:15:45 +0000 (19:15 +0100)
committerMichal Koutný <mkoutny@suse.com>
Thu, 11 Feb 2021 15:58:34 +0000 (16:58 +0100)
commit0fa7b50053695a3012af71c719dd86c12ab10fc6
tree827b7be95414024a3e18f8d5fd523025a22f80de
parent81504017f462db1ef4ce2c1f617535f261fe01cc
core: Make (user) instance aware of delegated cgroup controllers

systemd user instance assumed same controllers are available to it as to
PID 1. That is not true generally, in v1 (legacy, hybrid) we don't delegate any
controllers to anyone and in v2 (unified) we may delegate only subset of
controllers.
The user instance would fail silently when the controller cgroup cannot
be created or the controller cannot be enabled on the unified hierarchy.

The changes in 7b63961415 ("cgroup: Swap cgroup v1 deletion and
migration") caused some attempts of operating on non-delegated
controllers to be logged.

Make the user instance first check what controllers are availble to it
and narrow operations only to these controllers. The original checks are
kept in place.

Note that daemon-reexec needs to be invoked in order to update the set
of unabled controllers after a change.

Fixes: #18047
Fixes: #17862
src/basic/cgroup-util.c
src/basic/cgroup-util.h
src/core/cgroup.c