From 86036b26a1da4d90ca274d37e77c56980ab689fd Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 9 Oct 2018 15:56:27 +0200 Subject: [PATCH] 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. --- src/core/manager.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/manager.c b/src/core/manager.c index f0261a16e2..0f2bff0cac 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -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);