]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: bring manager_startup() and manager_reload() more inline
authorLennart Poettering <lennart@poettering.net>
Tue, 9 Oct 2018 15:37:57 +0000 (17:37 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 9 Oct 2018 17:43:43 +0000 (19:43 +0200)
Both functions do partly the same, let's make sure they do it in the
same order, and that we don't miss some calls.

This makes a number of changes:

1. Moves exec_runtime_vacuum() two calls down in manager_startup(). This
   should not have any effect but makes manager_startup() more like
   manager_reload().

2. Calls manager_recheck_journal(), manager_recheck_dbus(),
   manager_enqueue_sync_bus_names() in manager_startup() too. This is a
   good idea since during reeexec we pass through manager_startup() and
   hence can't assume dbus and journald weren't up yet, hence let's
   check if they are ready to be connected to.

3. Include manager_enumerate_perpetual() in manager_reload(), too. This
   is not strictly necessary, since these units are included in the
   serialization anyway, but it's still a nice thing, in particular as
   theoretically the deserialization could fail.

src/core/manager.c

index 97e693a58c664d4c4e6ca00fd9790ec53bc34358..5a5212f6c2fdfa8b7e0f2e9d58267230e782f531 100644 (file)
@@ -1665,12 +1665,12 @@ int manager_startup(Manager *m, FILE *serialization, FDSet *fds) {
         /* Release any dynamic users no longer referenced */
         dynamic_user_vacuum(m, true);
 
-        exec_runtime_vacuum(m);
-
         /* Release any references to UIDs/GIDs no longer referenced, and destroy any IPC owned by them */
         manager_vacuum_uid_refs(m);
         manager_vacuum_gid_refs(m);
 
+        exec_runtime_vacuum(m);
+
         if (serialization) {
                 assert(m->n_reloading > 0);
                 m->n_reloading--;
@@ -1680,6 +1680,13 @@ int manager_startup(Manager *m, FILE *serialization, FDSet *fds) {
                 m->send_reloading_done = true;
         }
 
+        /* It might be safe to log to the journal now and connect to dbus */
+        manager_recheck_journal(m);
+        manager_recheck_dbus(m);
+
+        /* Sync current state of bus names with our set of listening units */
+        (void) manager_enqueue_sync_bus_names(m);
+
         /* Let's finally catch up with any changes that took place while we were reloading/reexecing */
         manager_catchup(m);
 
@@ -3512,6 +3519,7 @@ int manager_reload(Manager *m) {
         manager_build_unit_path_cache(m);
 
         /* First, enumerate what we can from kernel and suchlike */
+        manager_enumerate_perpetual(m);
         manager_enumerate(m);
 
         /* Second, deserialize our stored data */