daandemeyer / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
9ab0c5
From e932760979f8658ff62b93b039a98a6d7f0f4656 Mon Sep 17 00:00:00 2001
9ab0c5
From: Lennart Poettering <lennart@poettering.net>
9ab0c5
Date: Tue, 29 Sep 2015 13:06:28 +0200
9ab0c5
Subject: [PATCH] core: add a "Requires=" dependency between units and the
9ab0c5
 slices they are located in
9ab0c5
9ab0c5
We place the processes we fork off in the cgroup anyway, and we probably
9ab0c5
shouldn't be able to get that far if we couldn't set up the slice due to
9ab0c5
resource problems or unmet conditions. Hence upgrade the dependency
9ab0c5
between units and the slices they are located in from Wants= to
9ab0c5
Requires=.
9ab0c5
9ab0c5
(cherry picked from commit 8c8da0e0cb498245c765732cf9caa081a70c560f)
9ab0c5
(cherry picked from commit 0600681f04e3818282a2d518ec3e6afee85f7978)
9ab0c5
9ab0c5
Related: #1729228
9ab0c5
---
9ab0c5
 src/core/unit.c | 6 +++---
9ab0c5
 1 file changed, 3 insertions(+), 3 deletions(-)
9ab0c5
9ab0c5
diff --git a/src/core/unit.c b/src/core/unit.c
9ab0c5
index 37fac8db3a..1dff541ac3 100644
9ab0c5
--- a/src/core/unit.c
9ab0c5
+++ b/src/core/unit.c
9ab0c5
@@ -1113,12 +1113,12 @@ static int unit_add_slice_dependencies(Unit *u) {
9ab0c5
                 return 0;
9ab0c5
 
9ab0c5
         if (UNIT_ISSET(u->slice))
9ab0c5
-                return unit_add_two_dependencies(u, UNIT_AFTER, UNIT_WANTS, UNIT_DEREF(u->slice), true);
9ab0c5
+                return unit_add_two_dependencies(u, UNIT_AFTER, UNIT_REQUIRES, UNIT_DEREF(u->slice), true);
9ab0c5
 
9ab0c5
-        if (streq(u->id, SPECIAL_ROOT_SLICE))
9ab0c5
+        if (unit_has_name(u, SPECIAL_ROOT_SLICE))
9ab0c5
                 return 0;
9ab0c5
 
9ab0c5
-        return unit_add_two_dependencies_by_name(u, UNIT_AFTER, UNIT_WANTS, SPECIAL_ROOT_SLICE, NULL, true);
9ab0c5
+        return unit_add_two_dependencies_by_name(u, UNIT_AFTER, UNIT_REQUIRES, SPECIAL_ROOT_SLICE, NULL, true);
9ab0c5
 }
9ab0c5
 
9ab0c5
 static int unit_add_mount_dependencies(Unit *u) {