anitazha / rpms / systemd

Forked from rpms/systemd 3 years ago
Clone

Blame SOURCES/0334-core-don-t-dispatch-load-queue-when-setting-Slice-fo.patch

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