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 20a83d7bf4)

Conflicts:
	src/core/job.c
This commit is contained in:
Brandon Philips
2014-06-07 18:25:59 -04:00
committed by Zbigniew Jędrzejewski-Szmek
parent 83d57a349f
commit 39cdf9313c
+3
View File
@@ -1057,6 +1057,9 @@ int job_coldplug(Job *j) {
if (j->timer_event_source)
j->timer_event_source = sd_event_source_unref(j->timer_event_source);
if (j->state == JOB_WAITING)
job_add_to_run_queue(j);
r = sd_event_add_monotonic(j->manager->event, &j->timer_event_source, j->begin_usec + j->unit->job_timeout, 0, job_dispatch_timer, j);
if (r < 0)
log_debug("Failed to restart timeout for job: %s", strerror(-r));