summaryrefslogtreecommitdiff
path: root/libpod/runtime.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@pm.me>2019-01-03 10:43:19 -0500
committerMatthew Heon <matthew.heon@pm.me>2019-01-04 09:51:09 -0500
commit16a5cbfac580c875dfde95ce29ac90f150b0b6f7 (patch)
treed397b0d1ea2d9d300936b8524c20e43a9a50a99c /libpod/runtime.go
parent31df5e0e85d26c008f7781ec94e1c5c9e8c7238d (diff)
downloadpodman-16a5cbfac580c875dfde95ce29ac90f150b0b6f7.tar.gz
podman-16a5cbfac580c875dfde95ce29ac90f150b0b6f7.tar.bz2
podman-16a5cbfac580c875dfde95ce29ac90f150b0b6f7.zip
When refreshing libpod, if SHM locks exist, remove them
This will hopefully help cases where libpod is initialized multiple times on the same system (as on our CI tests). We still run into potential issues where multiple Podmans with multiple tmp paths try to run on the same system - we could end up thrashing the locks. I think we need a file locks driver for situations like that. We can also see about storing paths in the SHM segment, to make sure multiple libpod instances aren't using the same one. Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'libpod/runtime.go')
-rw-r--r--libpod/runtime.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/libpod/runtime.go b/libpod/runtime.go
index ae4b77bd4..59264d0f5 100644
--- a/libpod/runtime.go
+++ b/libpod/runtime.go
@@ -540,6 +540,11 @@ func makeRuntime(runtime *Runtime) (err error) {
lockPath = DefaultRootlessSHMLockPath
}
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 errors.Wrapf(err, "error creating SHM locks for libpod")