]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
cgroup: extend reasons when we realize the enable mask
authorLennart Poettering <lennart@poettering.net>
Fri, 23 Nov 2018 00:03:18 +0000 (01:03 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 23 Nov 2018 12:41:37 +0000 (13:41 +0100)
After creating a cgroup we need to initialize its
"cgroup.subtree_control" file with the controllers its children want to
use. Currently we do so whenever the mkdir() on the cgroup succeeded,
i.e. when we know the cgroup is "fresh". Let's update the condition
slightly that we also do so when internally we assume a cgroup doesn't
exist yet, even if it already does (maybe left-over from a previous
run).

This shouldn't change anything IRL but make things a bit more robust.

src/core/cgroup.c

index 1dc62ba45fb355f0d9c070a458f0dab8c636075e..988813c38bfee38d4aad4e8b536cd6c1965fc211 100644 (file)
@@ -1615,7 +1615,7 @@ static int unit_create_cgroup(
         (void) unit_watch_cgroup(u);
 
         /* Preserve enabled controllers in delegated units, adjust others. */
-        if (created || !unit_cgroup_delegate(u)) {
+        if (created || !u->cgroup_realized || !unit_cgroup_delegate(u)) {
                 CGroupMask result_mask = 0;
 
                 /* Enable all controllers we need */