diff options
author | Matthew Heon <matthew.heon@gmail.com> | 2019-01-10 15:29:51 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-10 15:29:51 -0500 |
commit | b3428d028c5c1bc5444a4f4d66d0b244e54e6c55 (patch) | |
tree | e29c5451a9800d7d63b7e7abf57c9a755467cf98 | |
parent | 36d96c19f947aeac2675afe64a3b482e54f9e4c4 (diff) | |
parent | 482c8fd9a05f9866664806d4975bd6926c85dbd7 (diff) | |
download | podman-b3428d028c5c1bc5444a4f4d66d0b244e54e6c55.tar.gz podman-b3428d028c5c1bc5444a4f4d66d0b244e54e6c55.tar.bz2 podman-b3428d028c5c1bc5444a4f4d66d0b244e54e6c55.zip |
Merge pull request #2132 from containers/revert-2115-shm
Revert "If you fail to open shm lock then attempt to create it"
-rw-r--r-- | libpod/runtime.go | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/libpod/runtime.go b/libpod/runtime.go index c9471247c..ab8d02a4f 100644 --- a/libpod/runtime.go +++ b/libpod/runtime.go @@ -692,19 +692,25 @@ 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()) } - // 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 { + 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 { return err } } |