mirror of
https://github.com/systemd/systemd.git
synced 2024-11-05 06:52:22 +03:00
service: make start jobs wait, not fail, when an automatic restart is queued
When an automatic restart is already queued, then make subsequent start jobs wait until the restart can be handled (i.e. after the holdhoff time), instead of simply fail.
This commit is contained in:
parent
6b78f9b435
commit
a8bb2e6503
8
TODO
8
TODO
@ -36,10 +36,6 @@ Features:
|
|||||||
|
|
||||||
* syscall filter: add knowledge about compat syscalls
|
* syscall filter: add knowledge about compat syscalls
|
||||||
|
|
||||||
* flush jobs when switching root
|
|
||||||
|
|
||||||
* autorestart of journald after switch-root is broken
|
|
||||||
|
|
||||||
* logind: wakelock/opportunistic suspend support
|
* logind: wakelock/opportunistic suspend support
|
||||||
|
|
||||||
* switch-root: sockets need relabelling
|
* switch-root: sockets need relabelling
|
||||||
@ -56,8 +52,6 @@ Features:
|
|||||||
|
|
||||||
* refuse taking lower-case variable names in sd_journal_send() and friends.
|
* refuse taking lower-case variable names in sd_journal_send() and friends.
|
||||||
|
|
||||||
* when running as user instance: implicitly default to WorkingDirectory=$HOME for all services.
|
|
||||||
|
|
||||||
* Merge KillUnit()'s mode and who params into one
|
* Merge KillUnit()'s mode and who params into one
|
||||||
|
|
||||||
* load-fragment: when loading a unit file via a chain of symlinks
|
* load-fragment: when loading a unit file via a chain of symlinks
|
||||||
@ -101,8 +95,6 @@ Features:
|
|||||||
|
|
||||||
* change Requires=basic.target to RequisiteOverride=basic.target
|
* change Requires=basic.target to RequisiteOverride=basic.target
|
||||||
|
|
||||||
* exclude processes marked with argv[0][0]=@ from the normal service killing too
|
|
||||||
|
|
||||||
* support rd.luks.allow-discards= kernel cmdline params in cryptsetup generator
|
* support rd.luks.allow-discards= kernel cmdline params in cryptsetup generator
|
||||||
|
|
||||||
* systemctl: when stopping a service which has triggres and warning about it actually check the TriggeredBy= deps fields
|
* systemctl: when stopping a service which has triggres and warning about it actually check the TriggeredBy= deps fields
|
||||||
|
@ -2258,10 +2258,12 @@ static void service_enter_restart(Service *s) {
|
|||||||
assert(s);
|
assert(s);
|
||||||
dbus_error_init(&error);
|
dbus_error_init(&error);
|
||||||
|
|
||||||
if (UNIT(s)->job) {
|
if (UNIT(s)->job && UNIT(s)->job->type == JOB_STOP) {
|
||||||
log_info("Job pending for unit, delaying automatic restart.");
|
/* Don't restart things if we are going down anyway */
|
||||||
|
log_info("Stop job pending for unit, delaying automatic restart.");
|
||||||
|
|
||||||
if ((r = unit_watch_timer(UNIT(s), s->restart_usec, &s->timer_watch)) < 0)
|
r = unit_watch_timer(UNIT(s), s->restart_usec, &s->timer_watch);
|
||||||
|
if (r < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -2275,6 +2277,10 @@ static void service_enter_restart(Service *s) {
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
/* Note that we stay in the SERVICE_AUTO_RESTART state here,
|
||||||
|
* it will be canceled as part of the service_stop() call that
|
||||||
|
* is executed as part of JOB_RESTART. */
|
||||||
|
|
||||||
log_debug("%s scheduled restart job.", UNIT(s)->id);
|
log_debug("%s scheduled restart job.", UNIT(s)->id);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -2473,7 +2479,7 @@ static int service_start(Unit *u) {
|
|||||||
* service should be manually restarted, not started. */
|
* service should be manually restarted, not started. */
|
||||||
if (s->state == SERVICE_AUTO_RESTART) {
|
if (s->state == SERVICE_AUTO_RESTART) {
|
||||||
log_warning("%s automatic restart is pending, must be stopped before issuing start request.", UNIT(s)->id);
|
log_warning("%s automatic restart is pending, must be stopped before issuing start request.", UNIT(s)->id);
|
||||||
return -ECANCELED;
|
return -EAGAIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(s->state == SERVICE_DEAD || s->state == SERVICE_FAILED);
|
assert(s->state == SERVICE_DEAD || s->state == SERVICE_FAILED);
|
||||||
|
Loading…
Reference in New Issue
Block a user