mirror of https://github.com/k3s-io/k3s
Update FindCgroupMountpointAndRoot to be compatible with newer runc
parent
4ce15bb26b
commit
0d6e3b06a8
|
@ -38,7 +38,7 @@ func GetPids(cgroupPath string) ([]int, error) {
|
||||||
func getCgroupPath(cgroupPath string) (string, error) {
|
func getCgroupPath(cgroupPath string) (string, error) {
|
||||||
cgroupPath = libcontainerutils.CleanPath(cgroupPath)
|
cgroupPath = libcontainerutils.CleanPath(cgroupPath)
|
||||||
|
|
||||||
mnt, root, err := libcontainercgroups.FindCgroupMountpointAndRoot("devices")
|
mnt, root, err := libcontainercgroups.FindCgroupMountpointAndRoot(cgroupPath, "devices")
|
||||||
// If we didn't mount the subsystem, there is no point we make the path.
|
// If we didn't mount the subsystem, there is no point we make the path.
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
|
|
|
@ -23,11 +23,11 @@ const (
|
||||||
|
|
||||||
// https://www.kernel.org/doc/Documentation/cgroup-v1/cgroups.txt
|
// https://www.kernel.org/doc/Documentation/cgroup-v1/cgroups.txt
|
||||||
func FindCgroupMountpoint(subsystem string) (string, error) {
|
func FindCgroupMountpoint(subsystem string) (string, error) {
|
||||||
mnt, _, err := FindCgroupMountpointAndRoot(subsystem)
|
mnt, _, err := FindCgroupMountpointAndRoot("", subsystem)
|
||||||
return mnt, err
|
return mnt, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func FindCgroupMountpointAndRoot(subsystem string) (string, string, error) {
|
func FindCgroupMountpointAndRoot(_, subsystem string) (string, string, error) {
|
||||||
// We are not using mount.GetMounts() because it's super-inefficient,
|
// We are not using mount.GetMounts() because it's super-inefficient,
|
||||||
// parsing it directly sped up x10 times because of not using Sscanf.
|
// parsing it directly sped up x10 times because of not using Sscanf.
|
||||||
// It was one of two major performance drawbacks in container start.
|
// It was one of two major performance drawbacks in container start.
|
||||||
|
@ -257,7 +257,7 @@ func GetInitCgroupPath(subsystem string) (string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func getCgroupPathHelper(subsystem, cgroup string) (string, error) {
|
func getCgroupPathHelper(subsystem, cgroup string) (string, error) {
|
||||||
mnt, root, err := FindCgroupMountpointAndRoot(subsystem)
|
mnt, root, err := FindCgroupMountpointAndRoot("", subsystem)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue