]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/cgroup: always submit unit to realize queue if all controllers are being invalidated 38194/head
authorMike Yuan <me@yhndnzj.com>
Sat, 12 Jul 2025 15:39:14 +0000 (17:39 +0200)
committerMike Yuan <me@yhndnzj.com>
Sat, 12 Jul 2025 15:41:52 +0000 (17:41 +0200)
Alternative to #38190
Fixes #38112

src/core/cgroup.c

index c2f6f47e6e0f689f5d1b1c520eb5f61d1159a411..980d9b0f0ba938b48219a8a794a654d54042cfb7 100644 (file)
@@ -3950,7 +3950,11 @@ bool unit_invalidate_cgroup(Unit *u, CGroupMask m) {
         if (!crt)
                 return false;
 
-        if (FLAGS_SET(crt->cgroup_invalidated_mask, m)) /* NOP? */
+        /* If all controllers shall be invalidated, let's unconditionally submit the unit to realize queue.
+         * We initialize the field to _CGROUP_MASK_ALL after all, and semantically it makes sense to use
+         * it as a special signal to forcibly re-realize cgroup. */
+        if (m != _CGROUP_MASK_ALL &&
+            FLAGS_SET(crt->cgroup_invalidated_mask, m)) /* NOP? */
                 return false;
 
         crt->cgroup_invalidated_mask |= m;