a59965a
From fca7e7a4d9e325236893a3774472ebfdeb6540ad Mon Sep 17 00:00:00 2001
a59965a
From: Brandon Philips <brandon@ifup.co>
a59965a
Date: Fri, 25 Apr 2014 09:31:59 -0600
a59965a
Subject: [PATCH] job: add waiting jobs to run queue in unit_coldplug
a59965a
a59965a
When we have job installed and added to run queue for service which is
a59965a
still in dead state and systemd initiates reload then after reload we
a59965a
never add deserialized job to the run queue again. This is caused by
a59965a
check in service_coldplug() where we check if deserialized state is
a59965a
something else than dead state, which is not the case thus we never call
a59965a
service_set_state() and finally unit_notify() where we would have added
a59965a
job to the run queue.
a59965a
a59965a
Thanks to Michal Sekletar <msekleta@redhat.com> for the original patch.
a59965a
a59965a
(cherry picked from commit 20a83d7bf4542875f8033b68682a4da4993010e8)
a59965a
a59965a
Conflicts:
a59965a
	src/core/job.c
a59965a
a59965a
(cherry picked from commit 39cdf9313c28c3853aa001bbb522f71703cbfcc3)
a59965a
a59965a
Conflicts:
a59965a
	src/core/job.c
a59965a
a59965a
This includes the fixup in ae6feb2a01f6954af682bc3580c95d99721dcf46.
a59965a
---
a59965a
 src/core/job.c | 3 +++
a59965a
 1 file changed, 3 insertions(+)
a59965a
a59965a
diff --git a/src/core/job.c b/src/core/job.c
a59965a
index 7d2b994..c6bf08f 100644
a59965a
--- a/src/core/job.c
a59965a
+++ b/src/core/job.c
a59965a
@@ -1070,6 +1070,9 @@ int job_coldplug(Job *j) {
a59965a
                 .events = EPOLLIN,
a59965a
         };
a59965a
 
a59965a
+        if (j->state == JOB_WAITING)
a59965a
+                job_add_to_run_queue(j);
a59965a
+
a59965a
         if (j->timer_watch.type != WATCH_JOB_TIMER)
a59965a
                 return 0;
a59965a