aboutsummaryrefslogtreecommitdiff
path: root/init.d
diff options
context:
space:
mode:
authorWilliam Hubbs <w.d.hubbs@gmail.com>2018-02-23 15:07:04 -0600
committerWilliam Hubbs <w.d.hubbs@gmail.com>2018-02-23 15:07:04 -0600
commit38032626a6c2f8e869197999f32ac3634667cc86 (patch)
tree1b3eea206e51948f8bb9282820aa75a4f3929a1d /init.d
parentaa7d3a7911b658c550e7ce76cd6d7d46541fc323 (diff)
improve cgroup configuration checks
make the base/controller functions return successfully if cgroups v1/v2 are not configured in the kernel
Diffstat (limited to 'init.d')
-rw-r--r--init.d/cgroups.in13
1 files changed, 6 insertions, 7 deletions
diff --git a/init.d/cgroups.in b/init.d/cgroups.in
index fe21904c..8ec91ef6 100644
--- a/init.d/cgroups.in
+++ b/init.d/cgroups.in
@@ -42,7 +42,8 @@ cgroup1_base()
cgroup1_controllers()
{
- yesno "${rc_controller_cgroups:-YES}" && [ -e /proc/cgroups ] || return 0
+ yesno "${rc_controller_cgroups:-YES}" && [ -e /proc/cgroups ] &&
+ grep -qw cgroup /proc/filesystems || return 0
while read -r name _ _ enabled _; do
case "${enabled}" in
1) mountinfo -q "/sys/fs/cgroup/${name}" && continue
@@ -64,6 +65,7 @@ cgroup1_controllers()
cgroup2_base()
{
+ grep -qw cgroup2 /proc/filesystems || return 0
local base
base="$(cgroup2_find_path)"
mkdir -p "${base}"
@@ -74,6 +76,7 @@ cgroup2_base()
cgroup2_controllers()
{
+ grep -qw cgroup2 /proc/filesystems || return 0
local active cgroup_path x y
cgroup_path="$(cgroup2_find_path)"
[ -z "${cgroup_path}" ] && return 0
@@ -91,19 +94,15 @@ cgroup2_controllers()
cgroups_hybrid()
{
- grep -qw cgroup /proc/filesystems || return 0
cgroup1_base
- if grep -qw cgroup2 /proc/filesystems; then
- cgroup2_base
- cgroup2_controllers
- fi
+ cgroup2_base
+ cgroup2_controllers
cgroup1_controllers
return 0
}
cgroups_legacy()
{
- grep -qw cgroup /proc/filesystems || return 0
cgroup1_base
cgroup1_controllers
return 0