]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/core/cgroup.c
cgroup: Implicit unit_invalidate_cgroup_members_masks
[thirdparty/systemd.git] / src / core / cgroup.c
index 84512963a42c63202cec17b7e239bd8d1d462689..c1593107482c5d9ab4b50ab38a21f98b47e8b9ea 100644 (file)
@@ -2319,6 +2319,8 @@ void unit_add_siblings_to_cgroup_realize_queue(Unit *u) {
 
         /* This adds the path from the specified unit to root slice to the queue and siblings at each level.
          * The unit itself is excluded (assuming it's handled separately).
+         * The function must invalidate cgroup_members_mask of all ancestors in order to calculate up to date
+         * masks.
          *
          * Propagation of realization "side-ways" (i.e. towards siblings) is relevant on cgroup-v1 where
          * scheduling becomes very weird if two units that own processes reside in the same slice, but one is
@@ -2333,6 +2335,9 @@ void unit_add_siblings_to_cgroup_realize_queue(Unit *u) {
                 Unit *m;
                 void *v;
 
+                /* Children of slice likely changed when we're called */
+                slice->cgroup_members_mask_valid = false;
+
                 HASHMAP_FOREACH_KEY(v, m, slice->dependencies[UNIT_BEFORE], i) {
                         /* Skip units that have a dependency on the slice but aren't actually in it. */
                         if (UNIT_DEREF(m->slice) != slice)