]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/core/unit.c
cgroup: when we unload a unit, also update all its parent's members mask
[thirdparty/systemd.git] / src / core / unit.c
index a8c0f08e95651973f2a15c53f8165e8e90bb92af..df340548bb7acd3cfb1251030547c1f9d743384e 100644 (file)
@@ -570,6 +570,14 @@ void unit_free(Unit *u) {
         if (!u)
                 return;
 
+        if (UNIT_ISSET(u->slice)) {
+                /* A unit is being dropped from the tree, make sure our parent slice recalculates the member mask */
+                unit_invalidate_cgroup_members_masks(UNIT_DEREF(u->slice));
+
+                /* And make sure the parent is realized again, updating cgroup memberships */
+                unit_add_to_cgroup_realize_queue(UNIT_DEREF(u->slice));
+        }
+
         u->transient_file = safe_fclose(u->transient_file);
 
         if (!MANAGER_IS_RELOADING(u->manager))