manager: also use the reloading "cleanup" function in manager_startup

Here the behaviour is nominally changed, because we will decrease the
counter on error. But the only caller quits the program if error occurs,
so this makes no practical difference.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2018-10-10 13:41:44 +02:00
parent d147e2b66b
commit 4df7d537c8

View file

@ -1653,10 +1653,14 @@ int manager_startup(Manager *m, FILE *serialization, FDSet *fds) {
manager_build_unit_path_cache(m);
/* If we will deserialize make sure that during enumeration this is already known, so we increase the counter
* here already */
{
/* This block is (optionally) done with the reloading counter bumped */
_cleanup_(manager_reloading_stopp) Manager *reloading = NULL;
/* If we will deserialize make sure that during enumeration this is already known, so we increase the
* counter here already */
if (serialization)
m->n_reloading++;
reloading = manager_reloading_start(m);
/* First, enumerate what we can from all config files */
dual_timestamp_get(m->timestamps + manager_timestamp_initrd_mangle(MANAGER_TIMESTAMP_UNITS_LOAD_START));
@ -1671,8 +1675,9 @@ int manager_startup(Manager *m, FILE *serialization, FDSet *fds) {
return log_error_errno(r, "Deserialization failed: %m");
}
/* Any fds left? Find some unit which wants them. This is useful to allow container managers to pass some file
* descriptors to us pre-initialized. This enables socket-based activation of entire containers. */
/* Any fds left? Find some unit which wants them. This is useful to allow container managers to pass
* some file descriptors to us pre-initialized. This enables socket-based activation of entire
* containers. */
manager_distribute_fds(m, fds);
/* We might have deserialized the notify fd, but if we didn't then let's create the bus now */
@ -1706,12 +1711,9 @@ int manager_startup(Manager *m, FILE *serialization, FDSet *fds) {
/* Clean up runtime objects */
manager_vacuum(m);
if (serialization) {
assert(m->n_reloading > 0);
m->n_reloading--;
/* Let's wait for the UnitNew/JobNew messages being sent, before we notify that the reload is
* finished */
if (serialization)
/* Let's wait for the UnitNew/JobNew messages being sent, before we notify that the
* reload is finished */
m->send_reloading_done = true;
}