naccyde / rpms / systemd

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