From d54478d8eaec9481d482942b87065af36995d39a Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Thu, 7 Jan 2021 13:13:36 +0100 Subject: container stop: release lock before calling the runtime Podman defers stopping the container to the runtime, which can take some time. Keeping the lock while waiting for the runtime to complete the stop procedure, prevents other commands from acquiring the lock as shown in #8501. To improve the user experience, release the lock before invoking the runtime, and re-acquire the lock when the runtime is finished. Also introduce an intermediate "stopping" to properly distinguish from "stopped" containers etc. Fixes: #8501 Signed-off-by: Valentin Rothberg --- libpod/rootless_cni_linux.go | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libpod/rootless_cni_linux.go') diff --git a/libpod/rootless_cni_linux.go b/libpod/rootless_cni_linux.go index ce8a87759..9a980750f 100644 --- a/libpod/rootless_cni_linux.go +++ b/libpod/rootless_cni_linux.go @@ -110,6 +110,8 @@ func DeallocRootlessCNI(ctx context.Context, c *Container) error { logrus.Warn(err) } logrus.Debugf("rootless CNI: removing infra container %q", infra.ID()) + infra.lock.Lock() + defer infra.lock.Unlock() if err := c.runtime.removeContainer(ctx, infra, true, false, true); err != nil { return err } -- cgit v1.2.3-54-g00ecf