diff options
author | Andrei Vagin <avagin@google.com> | 2018-10-25 11:45:37 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-10-25 11:46:35 -0700 |
commit | 479cd52a6075066e93ce0c1bd0f183bb5df4fcc7 (patch) | |
tree | 60914b9e18cc61c3fa35b33655a3ec3dd4304bbb /runsc/cgroup/cgroup.go | |
parent | a5fe397cf806cbc488757dbd73a3d83eb5da11cd (diff) |
Uninstall() should not fail if a cgroup directory doesn't exist
It can be occurred if two controllers are mounted together or if Uninstall() is called on a error path.
PiperOrigin-RevId: 218723886
Change-Id: I69d7a3c0685a7da38527ea8b7b301dbe96268285
Diffstat (limited to 'runsc/cgroup/cgroup.go')
-rw-r--r-- | runsc/cgroup/cgroup.go | 6 |
1 files changed, 5 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) } |