richardphibel / rpms / systemd

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