Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

cgroups: fix failed to remove sandbox cgroup #1264

Merged
merged 1 commit into from
Feb 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions virtcontainers/cgroups.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ func cgroupNoConstraintsPath(path string) string {
}

// return the parent cgroup for the given path
func parentCgroup(path string) (cgroups.Cgroup, error) {
func parentCgroup(hierarchy cgroups.Hierarchy, path string) (cgroups.Cgroup, error) {
// append '/' just in case CgroupsPath doesn't start with it
parent := filepath.Dir("/" + path)

parentCgroup, err := cgroupsLoadFunc(cgroups.V1,
parentCgroup, err := cgroupsLoadFunc(hierarchy,
cgroups.StaticPath(parent))
if err != nil {
return nil, fmt.Errorf("Could not load parent cgroup %v: %v", parent, err)
Expand Down Expand Up @@ -186,7 +186,7 @@ func (s *Sandbox) deleteCgroups() error {
}

// move running process here, that way cgroup can be removed
parent, err := parentCgroup(path)
parent, err := parentCgroup(V1NoConstraints, path)
if err != nil {
// parent cgroup doesn't exist, that means there are no process running
// and the no constraints cgroup was removed.
Expand Down
2 changes: 1 addition & 1 deletion virtcontainers/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -1315,7 +1315,7 @@ func (c *Container) deleteCgroups() error {
}

// move running process here, that way cgroup can be removed
parent, err := parentCgroup(c.state.CgroupPath)
parent, err := parentCgroup(cgroups.V1, c.state.CgroupPath)
if err != nil {
// parent cgroup doesn't exist, that means there are no process running
// and the container cgroup was removed.
Expand Down