anitazha / rpms / systemd

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