summaryrefslogtreecommitdiff
path: root/src/basic
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-02-19 15:59:21 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-02-22 11:52:31 -0500
commit1b59cf04aee20525179f81928f1e1794ce970551 (patch)
tree4eedd6ff0980be83d54faa39e7b50e9779d2f98b /src/basic
parenta4464b952238cdcdab64f3dadb288700dcd25065 (diff)
core/mount-setup: if unified hierarchy is not supported, fall back to legacy
We need this to gracefully support older or strangely configured kernels. v2: - do not install a callback handler, just embed the right conditions into cg_is_*_wanted() v3: - fix bug in cg_is_legacy_wanted()
Diffstat (limited to 'src/basic')
-rw-r--r--src/basic/cgroup-util.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c
index 0b8bda89ea..8d60ded5fe 100644
--- a/src/basic/cgroup-util.c
+++ b/src/basic/cgroup-util.c
@@ -2429,7 +2429,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) {
@@ -2438,11 +2445,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)