aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2019-01-05 07:30:03 -0500
committerDaniel J Walsh <dwalsh@redhat.com>2019-01-05 07:37:21 -0500
commita76256834a0a409dfb53943e04fd2458c7782361 (patch)
treefbfb8d1e16dd669793e6804a37d85e8a7918ad74
parent4e0c0ecbc383531cd1b38db9027583974a72070d (diff)
downloadpodman-a76256834a0a409dfb53943e04fd2458c7782361.tar.gz
podman-a76256834a0a409dfb53943e04fd2458c7782361.tar.bz2
podman-a76256834a0a409dfb53943e04fd2458c7782361.zip
Rootless with shmlocks was not working.
This patch makes the path unigue to each UID. Also cleans up some return code to return the path it is trying to lock. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
-rw-r--r--libpod/lock/shm/shm_lock.go4
-rw-r--r--libpod/runtime.go7
2 files changed, 6 insertions, 5 deletions
diff --git a/libpod/lock/shm/shm_lock.go b/libpod/lock/shm/shm_lock.go
index 3372a8c71..be5e5148f 100644
--- a/libpod/lock/shm/shm_lock.go
+++ b/libpod/lock/shm/shm_lock.go
@@ -48,7 +48,7 @@ func CreateSHMLock(path string, numLocks uint32) (*SHMLocks, error) {
lockStruct := C.setup_lock_shm(cPath, C.uint32_t(numLocks), &errCode)
if lockStruct == nil {
// We got a null pointer, so something errored
- return nil, syscall.Errno(-1 * errCode)
+ return nil, errors.Wrapf(syscall.Errno(-1*errCode), "failed to create %d locks in %s", numLocks, path)
}
locks.lockStruct = lockStruct
@@ -77,7 +77,7 @@ func OpenSHMLock(path string, numLocks uint32) (*SHMLocks, error) {
lockStruct := C.open_lock_shm(cPath, C.uint32_t(numLocks), &errCode)
if lockStruct == nil {
// We got a null pointer, so something errored
- return nil, syscall.Errno(-1 * errCode)
+ return nil, errors.Wrapf(syscall.Errno(-1*errCode), "failed to open %d locks in %s", numLocks, path)
}
locks.lockStruct = lockStruct
diff --git a/libpod/runtime.go b/libpod/runtime.go
index fcc1c6d82..ab8d02a4f 100644
--- a/libpod/runtime.go
+++ b/libpod/runtime.go
@@ -1,6 +1,7 @@
package libpod
import (
+ "fmt"
"io/ioutil"
"os"
"os/exec"
@@ -695,7 +696,7 @@ func makeRuntime(runtime *Runtime) (err error) {
var manager lock.Manager
lockPath := DefaultSHMLockPath
if rootless.IsRootless() {
- lockPath = DefaultRootlessSHMLockPath
+ lockPath = fmt.Sprintf("%s_%d", DefaultRootlessSHMLockPath, rootless.GetRootlessUID())
}
if doRefresh {
// If SHM locks already exist, delete them and reinitialize
@@ -705,12 +706,12 @@ func makeRuntime(runtime *Runtime) (err error) {
manager, err = lock.NewSHMLockManager(lockPath, runtime.config.NumLocks)
if err != nil {
- return errors.Wrapf(err, "error creating SHM locks for libpod")
+ return err
}
} else {
manager, err = lock.OpenSHMLockManager(lockPath, runtime.config.NumLocks)
if err != nil {
- return errors.Wrapf(err, "error opening libpod SHM locks")
+ return err
}
}
runtime.lockManager = manager