diff options
author | Matthew Heon <matthew.heon@gmail.com> | 2018-04-09 11:15:05 -0400 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-04-12 03:48:40 +0000 |
commit | 49f93972172dc5ab807abab6c97718380a0580ee (patch) | |
tree | 38d9e112c53ec4e07a22e2b66b2a52b67543cc81 | |
parent | 8b67fbb3f23b72497d56e8902f56e46a690a77da (diff) | |
download | podman-49f93972172dc5ab807abab6c97718380a0580ee.tar.gz podman-49f93972172dc5ab807abab6c97718380a0580ee.tar.bz2 podman-49f93972172dc5ab807abab6c97718380a0580ee.zip |
Do not lock all containers during pod kill
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
Closes: #600
Approved by: rhatdan
-rw-r--r-- | libpod/pod.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/libpod/pod.go b/libpod/pod.go index e6a2ba3dc..2126e9228 100644 --- a/libpod/pod.go +++ b/libpod/pod.go @@ -298,26 +298,26 @@ func (p *Pod) Kill(signal uint) (map[string]error, error) { return nil, err } - // We need to lock all the containers + ctrErrors := make(map[string]error) + + // Send a signal to all containers for _, ctr := range allCtrs { ctr.lock.Lock() - defer ctr.lock.Unlock() if err := ctr.syncContainer(); err != nil { - return nil, err + ctr.lock.Unlock() + ctrErrors[ctr.ID()] = err + continue } - } - - ctrErrors := make(map[string]error) - // Send a signal to all containers - for _, ctr := range allCtrs { // Ignore containers that are not running if ctr.state.State != ContainerStateRunning { + ctr.lock.Unlock() continue } if err := ctr.runtime.ociRuntime.killContainer(ctr, signal); err != nil { + ctr.lock.Unlock() ctrErrors[ctr.ID()] = err continue } |