dryang / rpms / systemd

Forked from rpms/systemd a year ago
Clone
9fc0f6
From 95f08deefa7c0611854d2831960e77be9a814969 Mon Sep 17 00:00:00 2001
9fc0f6
From: Michal Sekletar <msekleta@redhat.com>
9fc0f6
Date: Wed, 2 Apr 2014 15:13:18 +0200
9fc0f6
Subject: [PATCH] unit: add waiting jobs to run queue in unit_coldplug
9fc0f6
9fc0f6
When we have job installed and added to run queue for service which is still in
9fc0f6
dead state and systemd initiates reload then after reload we never add
9fc0f6
deserialized job to the run queue again. This is caused by check in
9fc0f6
service_coldplug() where we check if deserialized state is something else than
9fc0f6
dead state, which is not the case thus we never call service_set_state() and
9fc0f6
finally unit_notify() where we would have added job to the run queue.
9fc0f6
---
9fc0f6
 src/core/unit.c | 3 +++
9fc0f6
 1 file changed, 3 insertions(+)
9fc0f6
9fc0f6
diff --git a/src/core/unit.c b/src/core/unit.c
9fc0f6
index 6ee34ec..a4e6c18 100644
9fc0f6
--- a/src/core/unit.c
9fc0f6
+++ b/src/core/unit.c
9fc0f6
@@ -2539,6 +2539,9 @@ int unit_coldplug(Unit *u) {
9fc0f6
                 r = job_coldplug(u->job);
9fc0f6
                 if (r < 0)
9fc0f6
                         return r;
9fc0f6
+
9fc0f6
+                if (u->job->state == JOB_WAITING)
9fc0f6
+                        job_add_to_run_queue(u->job);
9fc0f6
         } else if (u->deserialized_job >= 0) {
9fc0f6
                 /* legacy */
9fc0f6
                 r = manager_add_job(u->manager, u->deserialized_job, u, JOB_IGNORE_REQUIREMENTS, false, NULL, NULL);