core: tiny tweak for cgroup trimming during manager_free()

Instead of blacklisting when not to trim the cgroup tree, let's instead
whitelist when to do it, as an excercise of being careful when being
destructive.

This should not change behaviour with exception that during switch roots
we now won't attempt to trim the cgroup tree anymore. Which is more
correct behaviour after all we serialize/deserialize during the
transition and should be needlessly destructive.
This commit is contained in:
Lennart Poettering 2018-10-09 15:56:27 +02:00
parent 3ad228ce75
commit 86036b26a1
1 changed files with 3 additions and 3 deletions

View File

@ -1283,8 +1283,8 @@ static void manager_clear_jobs_and_units(Manager *m) {
}
Manager* manager_free(Manager *m) {
UnitType c;
ExecDirectoryType dt;
UnitType c;
if (!m)
return NULL;
@ -1295,8 +1295,8 @@ Manager* manager_free(Manager *m) {
if (unit_vtable[c]->shutdown)
unit_vtable[c]->shutdown(m);
/* If we reexecute ourselves, we keep the root cgroup around */
manager_shutdown_cgroup(m, m->objective != MANAGER_REEXECUTE);
/* Keep the cgroup hierarchy in place except when we know we are going down for good */
manager_shutdown_cgroup(m, IN_SET(m->objective, MANAGER_EXIT, MANAGER_REBOOT, MANAGER_POWEROFF, MANAGER_HALT, MANAGER_KEXEC));
lookup_paths_flush_generator(&m->lookup_paths);