Fix state machine ordering issue

This patch fixes an ordering issue where the configuration generation is
stepped before all old/disabled services had been stopped.  Finit should
ensure disabled services are stopped before entering the next generation.

If the genation is stepped first, all conditions are put in "flux" state,
so, e.g, a podman container running as a sysv service may lock-up until
it is killed by Finit.  Found in the Infix OS project.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2025-08-29 12:47:43 +02:00
parent 6415aeebac
commit e7f97f8264
+5 -2
View File
@@ -359,6 +359,8 @@ restart:
break;
case SM_RELOAD_CHANGE_STATE:
sm.in_reload = 1;
/* First reload all *.conf in /etc/finit.d/ */
conf_reload();
@@ -367,10 +369,11 @@ restart:
* let all affected services move to WAITING/HALTED
*/
dbg("Stopping services not allowed after reconf ...");
sm.in_reload = 1;
cond_reload();
service_step_all(SVC_TYPE_ANY);
/* Step the generation ... */
cond_reload();
sm.state = SM_RELOAD_WAIT_STATE;
break;