From 0f637e09da85b2aaefa279cfb571b004a2cc6d59 Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Wed, 11 Nov 2020 15:57:06 -0500 Subject: 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 --- test/e2e/run_volume_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/e2e') diff --git a/test/e2e/run_volume_test.go b/test/e2e/run_volume_test.go index 1c8a67123..7c74cea78 100644 --- a/test/e2e/run_volume_test.go +++ b/test/e2e/run_volume_test.go @@ -540,4 +540,12 @@ VOLUME /test/` session = podmanTest.Podman([]string{"run", "--rm", "-v", fmt.Sprintf("%s:%s:O", mountPath, mountDest), "--mount", fmt.Sprintf("type=tmpfs,target=%s", mountDest), ALPINE}) Expect(session.ExitCode()).To(Not(Equal(0))) }) + + It("same volume in multiple places does not deadlock", func() { + volName := "testVol1" + session := podmanTest.Podman([]string{"run", "-t", "-i", "-v", fmt.Sprintf("%s:/test1", volName), "-v", fmt.Sprintf("%s:/test2", volName), "--rm", ALPINE, "sh", "-c", "mount | grep /test"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(len(session.OutputToStringArray())).To(Equal(2)) + }) }) -- cgit v1.2.3-54-g00ecf