aboutsummaryrefslogtreecommitdiff
path: root/libpod/runtime_ctr.go
diff options
context:
space:
mode:
authorValentin Rothberg <vrothberg@suse.com>2018-08-10 11:50:25 +0200
committerAtomic Bot <atomic-devel@projectatomic.io>2018-08-10 13:26:58 +0000
commitc27b7cdc933f7102a3d093fa303f3ddb48209838 (patch)
treed01f31a03d4da46577db354050a16f83b90bf7f0 /libpod/runtime_ctr.go
parent38b3abf915de16a0ac2e7ed84bac603f90e88018 (diff)
downloadpodman-c27b7cdc933f7102a3d093fa303f3ddb48209838.tar.gz
podman-c27b7cdc933f7102a3d093fa303f3ddb48209838.tar.bz2
podman-c27b7cdc933f7102a3d093fa303f3ddb48209838.zip
removeContainer: fix deadlock
When checking if the container has already been removed, use c.state.HasContainer() instead of the runtime's API to avoid trying to take the already acquired lock. Fixes: #1245 Signed-off-by: Valentin Rothberg <vrothberg@suse.com> Closes: #1251 Approved by: baude
Diffstat (limited to 'libpod/runtime_ctr.go')
-rw-r--r--libpod/runtime_ctr.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go
index ffad9d649..051b3e85e 100644
--- a/libpod/runtime_ctr.go
+++ b/libpod/runtime_ctr.go
@@ -174,7 +174,7 @@ func (r *Runtime) RemoveContainer(ctx context.Context, c *Container, force bool)
// Locks the container, but does not lock the runtime
func (r *Runtime) removeContainer(ctx context.Context, c *Container, force bool) error {
if !c.valid {
- if ok, _ := r.HasContainer(c.ID()); !ok {
+ if ok, _ := r.state.HasContainer(c.ID()); !ok {
// Container probably already removed
// Or was never in the runtime to begin with
return nil