diff options
author | Valentin Rothberg <rothberg@redhat.com> | 2019-05-28 15:39:13 +0200 |
---|---|---|
committer | Valentin Rothberg <rothberg@redhat.com> | 2019-05-28 15:54:26 +0200 |
commit | 6ddf47ca38d2ebb93b2c9b774c187ba6c89177b8 (patch) | |
tree | 9d8126c1ca0e2c1acf178b64e25b8a0567edb921 /libpod/runtime.go | |
parent | 25f8c21ea8ac1994cd1e8468c72e3d3481be8102 (diff) | |
download | podman-6ddf47ca38d2ebb93b2c9b774c187ba6c89177b8.tar.gz podman-6ddf47ca38d2ebb93b2c9b774c187ba6c89177b8.tar.bz2 podman-6ddf47ca38d2ebb93b2c9b774c187ba6c89177b8.zip |
runtime: unlock the alive lock only once
Unlock the alive lock only once in the deferred func call.
Fixes: #3207
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'libpod/runtime.go')
-rw-r--r-- | libpod/runtime.go | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/libpod/runtime.go b/libpod/runtime.go index def7ba639..1f8dd98b4 100644 --- a/libpod/runtime.go +++ b/libpod/runtime.go @@ -877,10 +877,9 @@ func makeRuntime(ctx context.Context, runtime *Runtime) (err error) { // TODO: we can't close the FD in this lock, so we should keep it around // and use it to lock important operations aliveLock.Lock() - locked := true doRefresh := false defer func() { - if locked { + if aliveLock.Locked() { aliveLock.Unlock() } }() @@ -891,7 +890,7 @@ func makeRuntime(ctx context.Context, runtime *Runtime) (err error) { // no containers running. Create immediately a namespace, as // we will need to access the storage. if os.Geteuid() != 0 { - aliveLock.Unlock() + aliveLock.Unlock() // Unlock to avoid deadlock as BecomeRootInUserNS will reexec. pausePid, err := util.GetRootlessPauseProcessPidPath() if err != nil { return errors.Wrapf(err, "could not get pause process pid file path") |