summaryrefslogtreecommitdiff
path: root/libpod/runtime.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2018-08-23 15:13:41 -0400
committerMatthew Heon <matthew.heon@pm.me>2019-01-04 09:51:09 -0500
commit3de560053f4b391c8386554160f61a2a086c1564 (patch)
tree0903fde38cc39d0b0041643cb8e04a5f2727902f /libpod/runtime.go
parenta364b656eaef1be5329abfd02d3fcd2dbcd37d64 (diff)
downloadpodman-3de560053f4b391c8386554160f61a2a086c1564.tar.gz
podman-3de560053f4b391c8386554160f61a2a086c1564.tar.bz2
podman-3de560053f4b391c8386554160f61a2a086c1564.zip
Convert containers to SHM locking
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
Diffstat (limited to 'libpod/runtime.go')
-rw-r--r--libpod/runtime.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/libpod/runtime.go b/libpod/runtime.go
index 238a7a9db..7c665bbc2 100644
--- a/libpod/runtime.go
+++ b/libpod/runtime.go
@@ -830,19 +830,22 @@ func (r *Runtime) refresh(alivePath string) error {
if err != nil {
return errors.Wrapf(err, "error retrieving all pods from state")
}
+ // No locks are taken during pod and container refresh.
+ // Furthermore, the pod and container refresh() functions are not
+ // allowed to take locks themselves.
+ // We cannot assume that any pod or container has a valid lock until
+ // after this function has returned.
+ // The runtime alive lock should suffice to provide mutual exclusion
+ // until this has run.
for _, ctr := range ctrs {
- ctr.lock.Lock()
if err := ctr.refresh(); err != nil {
logrus.Errorf("Error refreshing container %s: %v", ctr.ID(), err)
}
- ctr.lock.Unlock()
}
for _, pod := range pods {
- pod.lock.Lock()
if err := pod.refresh(); err != nil {
logrus.Errorf("Error refreshing pod %s: %v", pod.ID(), err)
}
- pod.lock.Unlock()
}
// Create a file indicating the runtime is alive and ready