summaryrefslogtreecommitdiff
path: root/src/core/unit.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-04-24 15:27:19 +0200
committerLennart Poettering <lennart@poettering.net>2015-04-24 15:51:10 +0200
commitbe847e82cf95bf8eb589778df2aa2b3d1d7ae99e (patch)
tree91c85462c6741f4426ecb2334755994be81fd4c1 /src/core/unit.c
parent9211e875148588ca96988bb781a27b96ac33adfa (diff)
Revert "core: do not spawn jobs or touch other units during coldplugging"
This reverts commit 6e392c9c45643d106673c6643ac8bf4e65da13c1. We really shouldn't invent external state keeping hashmaps, if we can keep this state in the units themselves.
Diffstat (limited to 'src/core/unit.c')
-rw-r--r--src/core/unit.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/src/core/unit.c b/src/core/unit.c
index e921b48fc4..70a2b57fa3 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -2875,34 +2875,27 @@ int unit_add_node_link(Unit *u, const char *what, bool wants) {
return 0;
}
-static int unit_add_deserialized_job_coldplug(Unit *u) {
- int r;
-
- r = manager_add_job(u->manager, u->deserialized_job, u, JOB_IGNORE_REQUIREMENTS, false, NULL, NULL);
- if (r < 0)
- return r;
-
- u->deserialized_job = _JOB_TYPE_INVALID;
-
- return 0;
-}
-
-int unit_coldplug(Unit *u, Hashmap *deferred_work) {
+int unit_coldplug(Unit *u) {
int r;
assert(u);
if (UNIT_VTABLE(u)->coldplug)
- if ((r = UNIT_VTABLE(u)->coldplug(u, deferred_work)) < 0)
+ if ((r = UNIT_VTABLE(u)->coldplug(u)) < 0)
return r;
if (u->job) {
r = job_coldplug(u->job);
if (r < 0)
return r;
- } else if (u->deserialized_job >= 0)
+ } else if (u->deserialized_job >= 0) {
/* legacy */
- hashmap_put(deferred_work, u, &unit_add_deserialized_job_coldplug);
+ r = manager_add_job(u->manager, u->deserialized_job, u, JOB_IGNORE_REQUIREMENTS, false, NULL, NULL);
+ if (r < 0)
+ return r;
+
+ u->deserialized_job = _JOB_TYPE_INVALID;
+ }
return 0;
}