mirror of
https://github.com/containers/podman.git
synced 2025-06-22 09:58:10 +08:00
Merge pull request #2089 from rhatdan/locks
Rootless with shmlocks was not working.
This commit is contained in:
@ -48,7 +48,7 @@ func CreateSHMLock(path string, numLocks uint32) (*SHMLocks, error) {
|
|||||||
lockStruct := C.setup_lock_shm(cPath, C.uint32_t(numLocks), &errCode)
|
lockStruct := C.setup_lock_shm(cPath, C.uint32_t(numLocks), &errCode)
|
||||||
if lockStruct == nil {
|
if lockStruct == nil {
|
||||||
// We got a null pointer, so something errored
|
// 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
|
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)
|
lockStruct := C.open_lock_shm(cPath, C.uint32_t(numLocks), &errCode)
|
||||||
if lockStruct == nil {
|
if lockStruct == nil {
|
||||||
// We got a null pointer, so something errored
|
// 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
|
locks.lockStruct = lockStruct
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package libpod
|
package libpod
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
@ -695,7 +696,7 @@ func makeRuntime(runtime *Runtime) (err error) {
|
|||||||
var manager lock.Manager
|
var manager lock.Manager
|
||||||
lockPath := DefaultSHMLockPath
|
lockPath := DefaultSHMLockPath
|
||||||
if rootless.IsRootless() {
|
if rootless.IsRootless() {
|
||||||
lockPath = DefaultRootlessSHMLockPath
|
lockPath = fmt.Sprintf("%s_%d", DefaultRootlessSHMLockPath, rootless.GetRootlessUID())
|
||||||
}
|
}
|
||||||
if doRefresh {
|
if doRefresh {
|
||||||
// If SHM locks already exist, delete them and reinitialize
|
// 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)
|
manager, err = lock.NewSHMLockManager(lockPath, runtime.config.NumLocks)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "error creating SHM locks for libpod")
|
return err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
manager, err = lock.OpenSHMLockManager(lockPath, runtime.config.NumLocks)
|
manager, err = lock.OpenSHMLockManager(lockPath, runtime.config.NumLocks)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "error opening libpod SHM locks")
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
runtime.lockManager = manager
|
runtime.lockManager = manager
|
||||||
|
Reference in New Issue
Block a user