diff options
author | Matthew Heon <matthew.heon@pm.me> | 2019-10-10 14:45:56 -0400 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2019-10-10 14:53:29 -0400 |
commit | b6a7d88397c95a9f3a462274a890b65faafd4d7a (patch) | |
tree | 416ad704a77831173316325672f932ef1246e9ce /libpod/runtime_ctr.go | |
parent | 6f630bc09b3e937fe3ddc4a829715bacd5b6c779 (diff) | |
download | podman-b6a7d88397c95a9f3a462274a890b65faafd4d7a.tar.gz podman-b6a7d88397c95a9f3a462274a890b65faafd4d7a.tar.bz2 podman-b6a7d88397c95a9f3a462274a890b65faafd4d7a.zip |
When restoring containers, reset cgroup path
Previously, `podman checkport restore` with exported containers,
when told to create a new container based on the exported
checkpoint, would create a new container, with a new container
ID, but not reset CGroup path - which contained the ID of the
original container.
If this was done multiple times, the result was two containers
with the same cgroup paths. Operations on these containers would
this have a chance of crossing over to affect the other one; the
most notable was `podman rm` once it was changed to use the --all
flag when stopping the container; all processes in the cgroup,
including the ones in the other container, would be stopped.
Reset cgroups on restore to ensure that the path matches the ID
of the container actually being run.
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'libpod/runtime_ctr.go')
-rw-r--r-- | libpod/runtime_ctr.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go index c1d7571e2..411264d25 100644 --- a/libpod/runtime_ctr.go +++ b/libpod/runtime_ctr.go @@ -264,6 +264,14 @@ func (r *Runtime) setupContainer(ctx context.Context, ctr *Container) (c *Contai g.RemoveMount("/etc/hosts") g.RemoveMount("/run/.containerenv") g.RemoveMount("/run/secrets") + + // Regenerate CGroup paths so they don't point to the old + // container ID. + cgroupPath, err := ctr.getOCICgroupPath() + if err != nil { + return nil, err + } + g.SetLinuxCgroupsPath(cgroupPath) } // Set up storage for the container |