summaryrefslogtreecommitdiffhomepage
path: root/runsc
diff options
context:
space:
mode:
authorLantao Liu <lantaol@google.com>2019-01-28 11:57:22 -0800
committerShentubot <shentubot@google.com>2019-01-28 11:58:25 -0800
commit52b3cd873dafcc114c00fd95111bcf57818b7903 (patch)
tree36117c892a70a048535cb348b33cc8defdf9dd95 /runsc
parent1cedccf8e9b63757c182477f803afcb27bd9e17e (diff)
runsc: Only uninstall cgroup for sandbox stop.
PiperOrigin-RevId: 231263114 Change-Id: I57467a34fe94e395fdd3685462c4fe9776d040a3
Diffstat (limited to 'runsc')
-rw-r--r--runsc/container/container.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/runsc/container/container.go b/runsc/container/container.go
index 1b410c63a..37969d8c5 100644
--- a/runsc/container/container.go
+++ b/runsc/container/container.go
@@ -721,7 +721,10 @@ func (c *Container) stop() error {
if err := c.Sandbox.DestroyContainer(c.ID); err != nil {
return fmt.Errorf("destroying container %q: %v", c.ID, err)
}
- cgroup = c.Sandbox.Cgroup
+ // Only uninstall cgroup for sandbox stop.
+ if c.Sandbox.IsRootContainer(c.ID) {
+ cgroup = c.Sandbox.Cgroup
+ }
// Only set sandbox to nil after it has been told to destroy the container.
c.Sandbox = nil
}