mirror of
https://github.com/troglobit/finit.git
synced 2026-10-02 14:02:52 +07:00
Fix 'initctl reload NAME' not updating conditions for dependents
When reloading a specific service with 'initctl reload foo', the pid/foo and service/foo/ready conditions were never cleared, so dependent services were not notified of the reload. Clear the service's pid condition and, for pid/none notify types, the ready condition before reloading. The conditions are then reasserted by the pidfile inotify handler when the service touches its PID file after processing SIGHUP. For s6/systemd services the ready condition is left intact since their readiness notification may not re-trigger on SIGHUP. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
@@ -112,6 +112,8 @@ static int restart(svc_t *svc, void *user_data)
|
||||
|
||||
static int reload(svc_t *svc, void *user_data)
|
||||
{
|
||||
char cond[MAX_COND_LEN];
|
||||
|
||||
(void)user_data;
|
||||
|
||||
if (!svc)
|
||||
@@ -122,6 +124,20 @@ static int reload(svc_t *svc, void *user_data)
|
||||
else
|
||||
service_timeout_cancel(svc);
|
||||
|
||||
/*
|
||||
* Clear conditions before reload to ensure dependent services
|
||||
* are properly updated. The conditions are reasserted when
|
||||
* the service touches its PID file after processing SIGHUP.
|
||||
*
|
||||
* Note: only clear 'ready' for services where the pidfile
|
||||
* inotify handler reasserts it (pid/none). For s6/systemd
|
||||
* services readiness relies on their respective notification
|
||||
* mechanism which may not re-trigger on SIGHUP.
|
||||
*/
|
||||
cond_clear(mkcond(svc, cond, sizeof(cond)));
|
||||
if (svc->notify == SVC_NOTIFY_PID || svc->notify == SVC_NOTIFY_NONE)
|
||||
service_ready(svc, 0);
|
||||
|
||||
svc_mark_dirty(svc);
|
||||
service_step(svc);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user