From 1601100b3e9935f4239529c9117c76b8dd5d762a Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Thu, 11 Jul 2019 13:24:39 +0200 Subject: cgroups: attempt a recursive rmdir if the cgroup cannot be deleted, then attempt to delete all its subdirectories and try again. Signed-off-by: Giuseppe Scrivano --- pkg/cgroups/memory.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'pkg/cgroups/memory.go') diff --git a/pkg/cgroups/memory.go b/pkg/cgroups/memory.go index 80e88d17c..b3991f7e3 100644 --- a/pkg/cgroups/memory.go +++ b/pkg/cgroups/memory.go @@ -2,7 +2,6 @@ package cgroups import ( "fmt" - "os" "path/filepath" spec "github.com/opencontainers/runtime-spec/specs-go" @@ -33,7 +32,7 @@ func (c *memHandler) Create(ctr *CgroupControl) (bool, error) { // Destroy the cgroup func (c *memHandler) Destroy(ctr *CgroupControl) error { - return os.Remove(ctr.getCgroupv1Path(Memory)) + return rmDirRecursively(ctr.getCgroupv1Path(Memory)) } // Stat fills a metrics structure with usage stats for the controller -- cgit v1.2.3-54-g00ecf