summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-03-05 11:37:03 -0500
committerGitHub <noreply@github.com>2021-03-05 11:37:03 -0500
commit44e6d2002393bbcff7457462bfac3a4f6c91bfa4 (patch)
tree8e7d92bd8eced39f74347eb2693927939e19034c /libpod
parent0bac30d724643cf84d49e643a17bd8fd304efde1 (diff)
parent5bb8fa30b04e08761df6b412e7ef3c7cc0970650 (diff)
downloadpodman-44e6d2002393bbcff7457462bfac3a4f6c91bfa4.tar.gz
podman-44e6d2002393bbcff7457462bfac3a4f6c91bfa4.tar.bz2
podman-44e6d2002393bbcff7457462bfac3a4f6c91bfa4.zip
Merge pull request #9624 from mheon/fix_9615
[NO TESTS NEEDED] Do not return from c.stop() before re-locking
Diffstat (limited to 'libpod')
-rw-r--r--libpod/container_internal.go16
1 files changed, 12 insertions, 4 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go
index a7da7f395..af57aaca0 100644
--- a/libpod/container_internal.go
+++ b/libpod/container_internal.go
@@ -1307,9 +1307,7 @@ func (c *Container) stop(timeout uint) error {
c.lock.Unlock()
}
- if err := c.ociRuntime.StopContainer(c, timeout, all); err != nil {
- return err
- }
+ stopErr := c.ociRuntime.StopContainer(c, timeout, all)
if !c.batched {
c.lock.Lock()
@@ -1318,13 +1316,23 @@ func (c *Container) stop(timeout uint) error {
// If the container has already been removed (e.g., via
// the cleanup process), there's nothing left to do.
case define.ErrNoSuchCtr, define.ErrCtrRemoved:
- return nil
+ return stopErr
default:
+ if stopErr != nil {
+ logrus.Errorf("Error syncing container %s status: %v", c.ID(), err)
+ return stopErr
+ }
return err
}
}
}
+ // We have to check stopErr *after* we lock again - otherwise, we have a
+ // change of panicing on a double-unlock. Ref: GH Issue 9615
+ if stopErr != nil {
+ return stopErr
+ }
+
// Since we're now subject to a race condition with other processes who
// may have altered the state (and other data), let's check if the
// state has changed. If so, we should return immediately and log a