From ee986cd7c96d713fecb832bb7549afbc3d604571 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Rod=C3=A1k?= Date: Fri, 5 Jun 2026 17:47:37 +0200 Subject: [PATCH] Use MNT_DETACH for SHM unmount instead of retry loop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After checkpoint the SHM tmpfs can briefly return EBUSY while the kernel releases mount propagation references. Use lazy unmount instead of retrying, as suggested by review. Fixes flake: `podman checkpoint/restore ip and mac handling` Signed-off-by: Jan Rodák --- libpod/container_internal_linux.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go index 183dd3c493..b9a575beac 100644 --- a/libpod/container_internal_linux.go +++ b/libpod/container_internal_linux.go @@ -45,12 +45,12 @@ func (c *Container) mountSHM(shmOptions string) error { } func (c *Container) unmountSHM(mount string) error { - if err := unix.Unmount(mount, 0); err != nil { - if err != syscall.EINVAL && err != syscall.ENOENT { - return fmt.Errorf("unmounting container %s SHM mount %s: %w", c.ID(), mount, err) + if err := unix.Unmount(mount, unix.MNT_DETACH); err != nil { + if err == syscall.EINVAL || err == syscall.ENOENT { + logrus.Debugf("Container %s failed to unmount %s : %v", c.ID(), mount, err) + return nil } - // If it's just an EINVAL or ENOENT, debug logs only - logrus.Debugf("Container %s failed to unmount %s : %v", c.ID(), mount, err) + return fmt.Errorf("unmounting container %s SHM mount %s: %w", c.ID(), mount, err) } return nil }