naccyde / rpms / systemd

Forked from rpms/systemd a year ago
Clone
923a60
From b3207925388c6423a7665b9363eea90f41a30576 Mon Sep 17 00:00:00 2001
923a60
From: Lennart Poettering <lennart@poettering.net>
923a60
Date: Fri, 22 Apr 2016 17:30:08 +0200
923a60
Subject: [PATCH] core: don't dispatch load queue when setting Slice= for
923a60
 transient units
923a60
923a60
Let's be more careful when setting up the Slice= property of transient units:
923a60
let's use manager_load_unit_prepare() instead of manager_load_unit(), so that
923a60
the load queue isn't dispatched right away, because our own transient unit is
923a60
in it, and we don#t want to have it loaded until we finished initializing it.
923a60
923a60
(cherry picked from commit aea529e5b2c864d536941ee18220abcc1a9015a0)
923a60
Resolves: #1343904
923a60
---
923a60
 src/core/dbus-unit.c | 6 +++++-
923a60
 1 file changed, 5 insertions(+), 1 deletion(-)
923a60
923a60
diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c
923a60
index 227915efc2..49770bfda1 100644
923a60
--- a/src/core/dbus-unit.c
923a60
+++ b/src/core/dbus-unit.c
923a60
@@ -930,10 +930,14 @@ static int bus_unit_set_transient_property(
923a60
                 } else {
923a60
                         Unit *slice;
923a60
 
923a60
-                        r = manager_load_unit(u->manager, s, NULL, error, &slice);
923a60
+                        /* Note that we do not dispatch the load queue here yet, as we don't want our own transient unit to be
923a60
+                         * loaded while we are still setting it up. Or in other words, we use manager_load_unit_prepare()
923a60
+                         * instead of manager_load_unit() on purpose, here. */
923a60
+                        r = manager_load_unit_prepare(u->manager, s, NULL, error, &slice);
923a60
                         if (r < 0)
923a60
                                 return r;
923a60
 
923a60
+
923a60
                         if (slice->type != UNIT_SLICE)
923a60
                                 return -EINVAL;
923a60