From 07e13151c566588b5f679e2576d3dfc2125c6e7c Mon Sep 17 00:00:00 2001 From: huangkaibin 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 | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/core/unit.c b/src/core/unit.c index 0a2f3c8..b9bd102 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -3601,11 +3601,17 @@ int unit_coldplug(Unit *u) { r = q; } - uj = u->job ?: u->nop_job; - if (uj) { - q = job_coldplug(uj); - 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; -- 2.27.0