summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-01-09 13:41:07 -0800
committerGitHub <noreply@github.com>2019-01-09 13:41:07 -0800
commita60090cfba3674c5c1223b270c5f46600e6ee07e (patch)
tree122263c3285fd8fec1ca17e1d757f828df030812
parentc37f73159609b203545ca6fe54c86b9deacfca21 (diff)
parent8c25a645accbd5039b55d3b73c18768967f63074 (diff)
downloadpodman-a60090cfba3674c5c1223b270c5f46600e6ee07e.tar.gz
podman-a60090cfba3674c5c1223b270c5f46600e6ee07e.tar.bz2
podman-a60090cfba3674c5c1223b270c5f46600e6ee07e.zip
Merge pull request #2115 from rhatdan/shm
If you fail to open shm lock then attempt to create it
-rw-r--r--libpod/runtime.go24
1 files changed, 9 insertions, 15 deletions
diff --git a/libpod/runtime.go b/libpod/runtime.go
index ab8d02a4f..c9471247c 100644
--- a/libpod/runtime.go
+++ b/libpod/runtime.go
@@ -692,25 +692,19 @@ func makeRuntime(runtime *Runtime) (err error) {
}
}
- // Set up the lock manager
- var manager lock.Manager
lockPath := DefaultSHMLockPath
if rootless.IsRootless() {
lockPath = fmt.Sprintf("%s_%d", DefaultRootlessSHMLockPath, rootless.GetRootlessUID())
}
- if doRefresh {
- // If SHM locks already exist, delete them and reinitialize
- if err := os.Remove(filepath.Join("/dev/shm", lockPath)); err != nil && !os.IsNotExist(err) {
- return errors.Wrapf(err, "error deleting existing libpod SHM segment %s", lockPath)
- }
-
- manager, err = lock.NewSHMLockManager(lockPath, runtime.config.NumLocks)
- if err != nil {
- return err
- }
- } else {
- manager, err = lock.OpenSHMLockManager(lockPath, runtime.config.NumLocks)
- if err != nil {
+ // Set up the lock manager
+ manager, err := lock.OpenSHMLockManager(lockPath, runtime.config.NumLocks)
+ if err != nil {
+ if os.IsNotExist(errors.Cause(err)) {
+ manager, err = lock.NewSHMLockManager(lockPath, runtime.config.NumLocks)
+ if err != nil {
+ return err
+ }
+ } else {
return err
}
}