Blob Blame History Raw
From fca7e7a4d9e325236893a3774472ebfdeb6540ad Mon Sep 17 00:00:00 2001
From: Brandon Philips <brandon@ifup.co>
Date: Fri, 25 Apr 2014 09:31:59 -0600
Subject: [PATCH] job: add waiting jobs to run queue in unit_coldplug

When we have job installed and added to run queue for service which is
still in dead state and systemd initiates reload then after reload we
never add deserialized job to the run queue again. This is caused by
check in service_coldplug() where we check if deserialized state is
something else than dead state, which is not the case thus we never call
service_set_state() and finally unit_notify() where we would have added
job to the run queue.

Thanks to Michal Sekletar <msekleta@redhat.com> for the original patch.

(cherry picked from commit 20a83d7bf4542875f8033b68682a4da4993010e8)

Conflicts:
	src/core/job.c

(cherry picked from commit 39cdf9313c28c3853aa001bbb522f71703cbfcc3)

Conflicts:
	src/core/job.c

This includes the fixup in ae6feb2a01f6954af682bc3580c95d99721dcf46.
---
 src/core/job.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/core/job.c b/src/core/job.c
index 7d2b994..c6bf08f 100644
--- a/src/core/job.c
+++ b/src/core/job.c
@@ -1070,6 +1070,9 @@ int job_coldplug(Job *j) {
                 .events = EPOLLIN,
         };
 
+        if (j->state == JOB_WAITING)
+                job_add_to_run_queue(j);
+
         if (j->timer_watch.type != WATCH_JOB_TIMER)
                 return 0;