naccyde / rpms / systemd

Forked from rpms/systemd a year ago
Clone
4cad4c
From ca843e40587fb87fe20bd0561b6ccb42aaafc4ab Mon Sep 17 00:00:00 2001
4cad4c
From: Lennart Poettering <lennart@poettering.net>
4cad4c
Date: Thu, 9 Jan 2020 17:30:31 +0100
4cad4c
Subject: [PATCH] core: fix re-realization of cgroup siblings
4cad4c
4cad4c
This is a fix-up for eef85c4a3f8054d29383a176f6cebd1ef3a15b9a which
4cad4c
broke this.
4cad4c
4cad4c
Tracked down by @w-simon
4cad4c
4cad4c
Fixes: #14453
4cad4c
(cherry picked from commit 65f6b6bdcb500c576674b5838e4cc4c35e18bfde)
4cad4c
4cad4c
Related: #1818054
4cad4c
---
4cad4c
 src/core/cgroup.c | 21 +++++++--------------
4cad4c
 1 file changed, 7 insertions(+), 14 deletions(-)
4cad4c
4cad4c
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
4cad4c
index 664d269483..3f7665b755 100644
4cad4c
--- a/src/core/cgroup.c
4cad4c
+++ b/src/core/cgroup.c
4cad4c
@@ -1796,32 +1796,25 @@ unsigned manager_dispatch_cgroup_realize_queue(Manager *m) {
4cad4c
 static void unit_add_siblings_to_cgroup_realize_queue(Unit *u) {
4cad4c
         Unit *slice;
4cad4c
 
4cad4c
-        /* This adds the siblings of the specified unit and the
4cad4c
-         * siblings of all parent units to the cgroup queue. (But
4cad4c
-         * neither the specified unit itself nor the parents.) */
4cad4c
+        /* This adds the siblings of the specified unit and the siblings of all parent units to the cgroup
4cad4c
+         * queue. (But neither the specified unit itself nor the parents.) */
4cad4c
 
4cad4c
         while ((slice = UNIT_DEREF(u->slice))) {
4cad4c
                 Iterator i;
4cad4c
                 Unit *m;
4cad4c
                 void *v;
4cad4c
 
4cad4c
-                HASHMAP_FOREACH_KEY(v, m, u->dependencies[UNIT_BEFORE], i) {
4cad4c
-                        if (m == u)
4cad4c
-                                continue;
4cad4c
-
4cad4c
-                        /* Skip units that have a dependency on the slice
4cad4c
-                         * but aren't actually in it. */
4cad4c
+                HASHMAP_FOREACH_KEY(v, m, slice->dependencies[UNIT_BEFORE], i) {
4cad4c
+                        /* Skip units that have a dependency on the slice but aren't actually in it. */
4cad4c
                         if (UNIT_DEREF(m->slice) != slice)
4cad4c
                                 continue;
4cad4c
 
4cad4c
-                        /* No point in doing cgroup application for units
4cad4c
-                         * without active processes. */
4cad4c
+                        /* No point in doing cgroup application for units without active processes. */
4cad4c
                         if (UNIT_IS_INACTIVE_OR_FAILED(unit_active_state(m)))
4cad4c
                                 continue;
4cad4c
 
4cad4c
-                        /* If the unit doesn't need any new controllers
4cad4c
-                         * and has current ones realized, it doesn't need
4cad4c
-                         * any changes. */
4cad4c
+                        /* If the unit doesn't need any new controllers and has current ones realized, it
4cad4c
+                         * doesn't need any changes. */
4cad4c
                         if (unit_has_mask_realized(m,
4cad4c
                                                    unit_get_target_mask(m),
4cad4c
                                                    unit_get_enable_mask(m),