summaryrefslogtreecommitdiff
path: root/libpod/runtime.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-05-28 17:19:56 +0200
committerGitHub <noreply@github.com>2019-05-28 17:19:56 +0200
commitbc7afd6d71da4173e4894ff352667a25987fa2ea (patch)
tree379a0e891e52a8b6cb11c3c7d70f219209ee2e33 /libpod/runtime.go
parent08dd8b2d76c368ff9fb4b42f3bb33f937f99b7b6 (diff)
parent6ddf47ca38d2ebb93b2c9b774c187ba6c89177b8 (diff)
downloadpodman-bc7afd6d71da4173e4894ff352667a25987fa2ea.tar.gz
podman-bc7afd6d71da4173e4894ff352667a25987fa2ea.tar.bz2
podman-bc7afd6d71da4173e4894ff352667a25987fa2ea.zip
Merge pull request #3208 from vrothberg/fix-3207
runtime: unlock the alive lock only once
Diffstat (limited to 'libpod/runtime.go')
-rw-r--r--libpod/runtime.go5
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")