cgroup2_set_limits: verify that the cgroup2 path is a mount point

prior to cgroups getting mounted, /sys/fs/cgroup will still exist,
but attempts to make directories in it will fail, change cgroup2_set_limits() to
verify that cgroups are mounted instead of just checking that /sys/fs/cgroup
exists.

This fixes #307.
This fixes #321.
This commit is contained in:
E5ten 2019-08-27 11:48:21 -04:00 committed by William Hubbs
parent 8e31614c4b
commit 87cfad3d6c

View File

@ -181,7 +181,7 @@ cgroup2_set_limits()
{
local cgroup_path
cgroup_path="$(cgroup2_find_path)"
[ -d "${cgroup_path}" ] || return 0
mountinfo -q "${cgroup_path}"|| return 0
rc_cgroup_path="${cgroup_path}/${RC_SVCNAME}"
[ ! -d "${rc_cgroup_path}" ] && mkdir "${rc_cgroup_path}"
[ -f "${rc_cgroup_path}"/cgroup.procs ] &&