From: Lennart Poettering Date: Tue, 9 Oct 2018 13:56:27 +0000 (+0200) Subject: core: tiny tweak for cgroup trimming during manager_free() X-Git-Tag: v240~585^2~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=86036b26a1da4d90ca274d37e77c56980ab689fd;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/core/manager.c b/src/core/manager.c index f0261a16e20..0f2bff0cac6 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);