ryantimwilson / rpms / systemd

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