mirror of
https://github.com/containers/podman.git
synced 2026-07-09 06:44:58 -04:00
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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user