47 lines
1.7 KiB
Diff
47 lines
1.7 KiB
Diff
From 07e13151c566588b5f679e2576d3dfc2125c6e7c Mon Sep 17 00:00:00 2001
|
|
From: huangkaibin <huangkaibin@huawei.com>
|
|
Date: Sun, 22 Apr 2018 18:49:19 +0800
|
|
Subject: [PATCH] systemd-core: nop_job of a unit must also be coldpluged after
|
|
deserization.
|
|
|
|
When a unit is not in-active, and systemctl try-restart is executed for this unit,
|
|
systemd will do nothing for it and just accept it as a nop_job for the unit.
|
|
When then nop-job is still in the running queue, then daemon-reload is performed, this nop job
|
|
will be dropped from the unit since it is not coldpluged in the unit_coldplug function.
|
|
After then, the systemctl try-restart command will hang forever since no JOB_DONE dbus signal will be sent
|
|
to it from systemd.
|
|
This patch fix this problem by do coldplug for the nop_job in unit_coldplug function.
|
|
---
|
|
src/core/unit.c | 15 +++++++++++----
|
|
1 file changed, 11 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/src/core/unit.c b/src/core/unit.c
|
|
index 2da6f61..a862b79 100644
|
|
--- a/src/core/unit.c
|
|
+++ b/src/core/unit.c
|
|
@@ -3028,10 +3028,17 @@ int unit_coldplug(Unit *u) {
|
|
r = q;
|
|
}
|
|
|
|
- if (u->job) {
|
|
- q = job_coldplug(u->job);
|
|
- if (q < 0 && r >= 0)
|
|
- r = q;
|
|
+ if (u->job || u->nop_job) {
|
|
+ if (u->job) {
|
|
+ q = job_coldplug(u->job);
|
|
+ if (q < 0 && r >= 0)
|
|
+ r = q;
|
|
+ }
|
|
+ if (u->nop_job) {
|
|
+ q = job_coldplug(u->nop_job);
|
|
+ if (q < 0 && r >= 0)
|
|
+ r = q;
|
|
+ }
|
|
}
|
|
|
|
return r;
|
|
--
|
|
1.8.3.1
|
|
|