valeriyvdovin / rpms / systemd

Forked from rpms/systemd 3 years ago
Clone

Blame SOURCES/0231-unit-add-waiting-jobs-to-run-queue-in-unit_coldplug.patch

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