summaryrefslogtreecommitdiff
path: root/libpod/container_internal.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@pm.me>2020-11-11 15:57:06 -0500
committerMatthew Heon <matthew.heon@pm.me>2020-11-11 16:06:03 -0500
commit0f637e09da85b2aaefa279cfb571b004a2cc6d59 (patch)
treeb9fcdd548ba1b0064c204fb49d450ac069a776aa /libpod/container_internal.go
parentdc58d4e2858bf6688a775277adf8f775afc30e73 (diff)
downloadpodman-0f637e09da85b2aaefa279cfb571b004a2cc6d59.tar.gz
podman-0f637e09da85b2aaefa279cfb571b004a2cc6d59.tar.bz2
podman-0f637e09da85b2aaefa279cfb571b004a2cc6d59.zip
Ensure we do not double-lock the same volume in create
When making containers, we want to lock all named volumes we are adding the container to, to ensure they aren't removed from under us while we are working. Unfortunately, this code did not account for a container having the same volume mounted in multiple places so it could deadlock. Add a map to ensure that we don't lock the same name more than once to resolve this. Fixes #8221 Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'libpod/container_internal.go')
-rw-r--r--libpod/container_internal.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go
index 0aeaae43d..3a8566760 100644
--- a/libpod/container_internal.go
+++ b/libpod/container_internal.go
@@ -1503,6 +1503,7 @@ func (c *Container) mountStorage() (_ string, deferredErr error) {
// config.
// Returns the volume that was mounted.
func (c *Container) mountNamedVolume(v *ContainerNamedVolume, mountpoint string) (*Volume, error) {
+ logrus.Debugf("Going to mount named volume %s", v.Name)
vol, err := c.runtime.state.Volume(v.Name)
if err != nil {
return nil, errors.Wrapf(err, "error retrieving named volume %s for container %s", v.Name, c.ID())