Use MNT_DETACH for SHM unmount instead of retry loop

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 <hony.com@seznam.cz>
This commit is contained in:
Jan Rodák 2026-06-05 17:47:37 +02:00
parent 81fceb48d2
commit ee986cd7c9
No known key found for this signature in database
GPG key ID: D458A9B20435C2BF

View file

@ -45,12 +45,12 @@ func (c *Container) mountSHM(shmOptions string) error {
} }
func (c *Container) unmountSHM(mount string) error { func (c *Container) unmountSHM(mount string) error {
if err := unix.Unmount(mount, 0); err != nil { if err := unix.Unmount(mount, unix.MNT_DETACH); err != nil {
if err != syscall.EINVAL && err != syscall.ENOENT { if err == syscall.EINVAL || err == syscall.ENOENT {
return fmt.Errorf("unmounting container %s SHM mount %s: %w", c.ID(), mount, err) 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 return fmt.Errorf("unmounting container %s SHM mount %s: %w", c.ID(), mount, err)
logrus.Debugf("Container %s failed to unmount %s : %v", c.ID(), mount, err)
} }
return nil return nil
} }