Skip to content

Commit 31ba217

Browse files
committed
fixup
1 parent 56c8d3d commit 31ba217

3 files changed

Lines changed: 12 additions & 1 deletion

File tree

src/service.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2873,8 +2873,12 @@ int service_step(svc_t *svc)
28732873
if (svc_is_removed(svc) && svc_has_cleanup(svc)) {
28742874
svc_set_state(svc, SVC_CLEANUP_STATE);
28752875
service_cleanup_script(svc);
2876-
} else
2876+
} else {
2877+
/* Unblock remain tasks after post script so they can restart */
2878+
if (svc_is_remain(svc))
2879+
svc_unblock(svc);
28772880
svc_set_state(svc, SVC_HALTED_STATE);
2881+
}
28782882
}
28792883
break;
28802884

src/sm.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,9 @@ void sm_step(void)
461461
/* First reload all *.conf in /etc/finit.d/ */
462462
conf_reload();
463463

464+
/* Handle remain tasks that need to run post script before restart */
465+
service_runtask_clean();
466+
464467
/*
465468
* Then, mark all affected service conditions as in-flux and
466469
* let all affected services move to WAITING/HALTED

src/svc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,10 @@ svc_t *svc_stop_completed(void)
344344
for (svc = svc_iterator(&iter, 1); svc; svc = svc_iterator(&iter, 0)) {
345345
if (svc->state == SVC_STOPPING_STATE && svc->pid > 1)
346346
return svc;
347+
348+
/* Also wait for remain tasks running their post script */
349+
if (svc_is_remain(svc) && svc->state == SVC_TEARDOWN_STATE && svc->pid > 1)
350+
return svc;
347351
}
348352

349353
return NULL;

0 commit comments

Comments
 (0)