Skip to content

Commit f0914f6

Browse files
committed
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>
1 parent 7090321 commit f0914f6

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

src/api.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ static int restart(svc_t *svc, void *user_data)
112112

113113
static int reload(svc_t *svc, void *user_data)
114114
{
115+
char cond[MAX_COND_LEN];
116+
115117
(void)user_data;
116118

117119
if (!svc)
@@ -122,6 +124,20 @@ static int reload(svc_t *svc, void *user_data)
122124
else
123125
service_timeout_cancel(svc);
124126

127+
/*
128+
* Clear conditions before reload to ensure dependent services
129+
* are properly updated. The conditions are reasserted when
130+
* the service touches its PID file after processing SIGHUP.
131+
*
132+
* Note: only clear 'ready' for services where the pidfile
133+
* inotify handler reasserts it (pid/none). For s6/systemd
134+
* services readiness relies on their respective notification
135+
* mechanism which may not re-trigger on SIGHUP.
136+
*/
137+
cond_clear(mkcond(svc, cond, sizeof(cond)));
138+
if (svc->notify == SVC_NOTIFY_PID || svc->notify == SVC_NOTIFY_NONE)
139+
service_ready(svc, 0);
140+
125141
svc_mark_dirty(svc);
126142
service_step(svc);
127143

0 commit comments

Comments
 (0)