core: bring manager_startup() and manager_reload() more inline

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.
This commit is contained in:
Lennart Poettering 2018-10-09 17:37:57 +02:00
parent 6eb3af7a6e
commit 3ad2afb6a2
1 changed files with 10 additions and 2 deletions

View 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 */