summaryrefslogtreecommitdiffhomepage
path: root/runsc
diff options
context:
space:
mode:
Diffstat (limited to 'runsc')
-rw-r--r--runsc/cgroup/cgroup.go6
-rw-r--r--runsc/cgroup/cgroup_test.go11
2 files changed, 16 insertions, 1 deletions
diff --git a/runsc/cgroup/cgroup.go b/runsc/cgroup/cgroup.go
index 0ceeb3f28..15071387b 100644
--- a/runsc/cgroup/cgroup.go
+++ b/runsc/cgroup/cgroup.go
@@ -229,7 +229,11 @@ func (c *Cgroup) Uninstall() error {
defer cancel()
b := backoff.WithContext(backoff.NewConstantBackOff(100*time.Millisecond), ctx)
if err := backoff.Retry(func() error {
- return syscall.Rmdir(path)
+ err := syscall.Rmdir(path)
+ if os.IsNotExist(err) {
+ return nil
+ }
+ return err
}, b); err != nil {
return fmt.Errorf("error removing cgroup path %q: %v", path, err)
}
diff --git a/runsc/cgroup/cgroup_test.go b/runsc/cgroup/cgroup_test.go
index 4a4713d4f..ecc184f74 100644
--- a/runsc/cgroup/cgroup_test.go
+++ b/runsc/cgroup/cgroup_test.go
@@ -18,6 +18,17 @@ import (
"testing"
)
+func TestUninstallEnoent(t *testing.T) {
+ c := Cgroup{
+ // set a non-existent name
+ Name: "runsc-test-uninstall-656e6f656e740a",
+ Own: true,
+ }
+ if err := c.Uninstall(); err != nil {
+ t.Errorf("Uninstall() failed: %v", err)
+ }
+}
+
func TestCountCpuset(t *testing.T) {
for _, tc := range []struct {
str string