X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fbasic%2Fcgroup-util.c;h=0079ff9a49d1f936ac94674c7202d7a6df8601ba;hb=d2fee9031f20cefd32465836193982f5382baebc;hp=ad412235347b6376dc9336c31e6505236a460dc4;hpb=98b626ac20d3f24be8a5f3755db8f1e7b611bad4;p=elogind.git diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c index ad4122353..0079ff9a4 100644 --- a/src/basic/cgroup-util.c +++ b/src/basic/cgroup-util.c @@ -2495,7 +2495,14 @@ bool cg_is_unified_wanted(void) { } bool cg_is_legacy_wanted(void) { - return !cg_is_unified_wanted(); + /* Check if we have cgroups2 already mounted. */ + if (cg_unified_flush() >= 0 && + unified_cache == CGROUP_UNIFIED_ALL) + return false; + + /* Otherwise, assume that at least partial legacy is wanted, + * since cgroups2 should already be mounted at this point. */ + return true; } bool cg_is_hybrid_wanted(void) { @@ -2504,11 +2511,6 @@ bool cg_is_hybrid_wanted(void) { bool b; const bool is_default = DEFAULT_HIERARCHY == CGROUP_UNIFIED_SYSTEMD; - /* If the unified hierarchy is requested in full, no need to - * bother with this. */ - if (cg_is_unified_wanted()) - return 0; - /* If the hierarchy is already mounted, then follow whatever * was chosen for it. */ if (cg_unified_flush() >= 0)