mirror of
https://github.com/troglobit/finit.git
synced 2026-11-06 15:51:03 +00:00
shutdown: use cond_clear_noupdate() to prevent nested service_stop()
When the system shuts down, or user changes runlevels, we don't have to call cond_clear_update(), because this can lead to nested service_stop() calls, which in turn lead to out of sync progress updates: [ .. ] Stopping Foo [ OK ] Stopping Bar [ OK ] Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
248f7d3110
commit
c221823654
2 files changed
+8
-2
No files matched your search
+5
-1
@@ -35,6 +35,7 @@
|
|||||||
#include "cond.h"
|
#include "cond.h"
|
||||||
#include "pid.h"
|
#include "pid.h"
|
||||||
#include "service.h"
|
#include "service.h"
|
||||||
|
#include "sm.h"
|
||||||
|
|
||||||
struct cond_boot {
|
struct cond_boot {
|
||||||
TAILQ_ENTRY(cond_boot) link;
|
TAILQ_ENTRY(cond_boot) link;
|
||||||
@@ -214,7 +215,10 @@ static int do_delete(const char *fpath, const struct stat *sb, int tflag, struct
|
|||||||
err(1, "Failed removing condition %s", fpath);
|
err(1, "Failed removing condition %s", fpath);
|
||||||
|
|
||||||
cond = ptr + strlen(COND_BASE) + 1;
|
cond = ptr + strlen(COND_BASE) + 1;
|
||||||
cond_update(cond);
|
if (sm_is_in_teardown(&sm))
|
||||||
|
cond_clear_noupdate(cond);
|
||||||
|
else
|
||||||
|
cond_update(cond);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -2261,7 +2261,7 @@ static void svc_set_state(svc_t *svc, svc_state_t new_state)
|
|||||||
/* if PID isn't collected within SVC_TERM_TIMEOUT msec, kill it! */
|
/* if PID isn't collected within SVC_TERM_TIMEOUT msec, kill it! */
|
||||||
if (new_state == SVC_STOPPING_STATE) {
|
if (new_state == SVC_STOPPING_STATE) {
|
||||||
dbg("%s is stopping, wait %d sec before sending SIGKILL ...",
|
dbg("%s is stopping, wait %d sec before sending SIGKILL ...",
|
||||||
svc_ident(svc, NULL, 0), svc->killdelay / 1000);
|
svc_ident(svc, NULL, 0), svc->killdelay / 1000);
|
||||||
service_timeout_cancel(svc);
|
service_timeout_cancel(svc);
|
||||||
service_timeout_after(svc, svc->killdelay, service_kill);
|
service_timeout_after(svc, svc->killdelay, service_kill);
|
||||||
}
|
}
|
||||||
@@ -2299,6 +2299,8 @@ static void svc_set_state(svc_t *svc, svc_state_t new_state)
|
|||||||
if ((old_state == SVC_RUNNING_STATE && new_state == SVC_PAUSED_STATE) ||
|
if ((old_state == SVC_RUNNING_STATE && new_state == SVC_PAUSED_STATE) ||
|
||||||
(old_state == SVC_PAUSED_STATE && new_state == SVC_RUNNING_STATE))
|
(old_state == SVC_PAUSED_STATE && new_state == SVC_RUNNING_STATE))
|
||||||
; /* only paused during reload, don't clear conds. */
|
; /* only paused during reload, don't clear conds. */
|
||||||
|
else if (sm_is_in_teardown(&sm))
|
||||||
|
cond_clear_noupdate(cond);
|
||||||
else
|
else
|
||||||
cond_clear(cond);
|
cond_clear(cond);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user