]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
manager: always close idle pipe when sending ready notification
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 29 Dec 2021 03:04:46 +0000 (12:04 +0900)
committerLuca Boccassi <luca.boccassi@gmail.com>
Wed, 29 Dec 2021 12:35:48 +0000 (12:35 +0000)
This fixes a bug introduced by 6d9326595592f98e8126eacb4176acd8c3516d5c.

The commit makes several functions skipped if the manager is already
in finished state, as
> In manager_check_finished(), more steps are skipped if MANAGER_IS_FINISHED().
> Those steps are idempotent, but no need to waste cycles trying to do them
> more than once.

However, the idle pipe may be re-opened after manager is finished:
manager_dispatch_run_queue() -> manager_watch_idle_pipe().
So, the closing the pipe is not idempotent here.

Fixes #21889.

src/core/manager.c

index 2946f5806666fbb387041bb149e044251823cb97..601e15f68920677124cc2568fedf2e10592aa36a 100644 (file)
@@ -3557,14 +3557,14 @@ void manager_check_finished(Manager *m) {
 
         manager_send_ready(m);
 
+        /* Notify Type=idle units that we are done now */
+        manager_close_idle_pipe(m);
+
         if (MANAGER_IS_FINISHED(m))
                 return;
 
         manager_flip_auto_status(m, false, "boot finished");
 
-        /* Notify Type=idle units that we are done now */
-        manager_close_idle_pipe(m);
-
         /* Turn off confirm spawn now */
         m->confirm_spawn = NULL;