diff options
author | Matthew Heon <matthew.heon@pm.me> | 2019-01-10 15:40:56 -0500 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2019-01-10 15:41:19 -0500 |
commit | 76c57f55cacb7916ca451e378d181b1c30c94032 (patch) | |
tree | 775fafbd2dcefae1b1731744219dc2410e985800 /libpod/pod_internal.go | |
parent | 6e8aeab472154e2b1eff92683803d16af06d2b30 (diff) | |
download | podman-76c57f55cacb7916ca451e378d181b1c30c94032.tar.gz podman-76c57f55cacb7916ca451e378d181b1c30c94032.tar.bz2 podman-76c57f55cacb7916ca451e378d181b1c30c94032.zip |
Revert "Merge pull request #1235 from mheon/shm_locking"
This reverts commit bf5f779331870d31863c486619daae3fcea458eb, reversing
changes made to 6868b5aa1444404113bc6a4582203fbbf89490c2.
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'libpod/pod_internal.go')
-rw-r--r-- | libpod/pod_internal.go | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/libpod/pod_internal.go b/libpod/pod_internal.go index 0f1f115e8..39a25c004 100644 --- a/libpod/pod_internal.go +++ b/libpod/pod_internal.go @@ -7,13 +7,14 @@ import ( "strings" "time" + "github.com/containers/storage" "github.com/containers/storage/pkg/stringid" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) // Creates a new, empty pod -func newPod(runtime *Runtime) (*Pod, error) { +func newPod(lockDir string, runtime *Runtime) (*Pod, error) { pod := new(Pod) pod.config = new(PodConfig) pod.config.ID = stringid.GenerateNonCryptoID() @@ -23,6 +24,15 @@ func newPod(runtime *Runtime) (*Pod, error) { pod.state = new(podState) pod.runtime = runtime + // Path our lock file will reside at + lockPath := filepath.Join(lockDir, pod.config.ID) + // Grab a lockfile at the given path + lock, err := storage.GetLockfile(lockPath) + if err != nil { + return nil, errors.Wrapf(err, "error creating lockfile for new pod") + } + pod.lock = lock + return pod, nil } @@ -45,8 +55,6 @@ func (p *Pod) save() error { } // Refresh a pod's state after restart -// This cannot lock any other pod, but may lock individual containers, as those -// will have refreshed by the time pod refresh runs. func (p *Pod) refresh() error { // Need to to an update from the DB to pull potentially-missing state if err := p.runtime.state.UpdatePod(p); err != nil { @@ -57,13 +65,6 @@ func (p *Pod) refresh() error { return ErrPodRemoved } - // Retrieve the pod's lock - lock, err := p.runtime.lockManager.RetrieveLock(p.config.LockID) - if err != nil { - return errors.Wrapf(err, "error retrieving lock for pod %s", p.ID()) - } - p.lock = lock - // We need to recreate the pod's cgroup if p.config.UsePodCgroup { switch p.runtime.config.CgroupManager { |