Commit 6ae819ee authored by Tollef Fog Heen's avatar Tollef Fog Heen
Browse files

Avoid reloading services when shutting down

Doing so won't work and makes no sense.  Thanks to Michael Stapelberg
for the patch.  Closes: #624599.
parent afffb464
......@@ -3,6 +3,9 @@ systemd (44-5) UNRELEASED; urgency=low
* disable killing on entering START_PRE, START, thanks to Michael
Stapelberg for patch. This avoids killing VMs run through libvirt
when restarting libvirtd. Closes: #688635.
* Avoid reloading services when shutting down, since that won't work and
makes no sense. Thanks to Michael Stapelberg for the patch.
Closes: #624599.
-- Tollef Fog Heen <tfheen@debian.org> Tue, 16 Oct 2012 18:09:10 +0200
......
......@@ -1700,6 +1700,8 @@ static int transaction_add_isolate_jobs(Manager *m) {
int manager_add_job(Manager *m, JobType type, Unit *unit, JobMode mode, bool override, DBusError *e, Job **_ret) {
int r;
Job *ret;
Job *j;
Iterator i;
assert(m);
assert(type < _JOB_TYPE_MAX);
......@@ -1711,6 +1713,30 @@ int manager_add_job(Manager *m, JobType type, Unit *unit, JobMode mode, bool ove
return -EINVAL;
}
if (type == JOB_RELOAD || type == JOB_RELOAD_OR_START || type == JOB_RESTART || type == JOB_TRY_RESTART) {
/* If final.target is queued (happens on poweroff, reboot and
* halt), we will not accept new reload jobs. They would not be
* executed ever anyways (since the shutdown comes first), but
* they block the shutdown process: when systemd tries to stop
* a unit such as ifup@eth0.service, that unit might invoke a
* systemctl reload command, which blockingly waits (but only
* gets executed after all other queued units for the shutdown
* have been executed).
*
* See http://bugs.debian.org/624599 and
* http://bugs.debian.org/635777 */
HASHMAP_FOREACH(j, m->jobs, i) {
assert(j->installed);
if (strcmp(j->unit->id, "final.target") == 0) {
log_debug("final.target is queued, ignoring %s request for unit %s", job_type_to_string(type), unit->id);
dbus_set_error(e, BUS_ERROR_INVALID_JOB_MODE, "final.target is queued, ignoring %s request for unit %s", job_type_to_string(type), unit->id);
return -EINVAL;
}
}
}
if (mode == JOB_ISOLATE && !unit->allow_isolate) {
dbus_set_error(e, BUS_ERROR_NO_ISOLATION, "Operation refused, unit may not be isolated.");
return -EPERM;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment