From 36c85d0b2b46107bcec94a43297ad284bd4769ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Fri, 19 May 2023 18:55:05 +0200 Subject: [PATCH] RFC: Fail on unmount/rmdir in overlay.Driver.Put MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit instead of only logging a debug-level failure. We are seeing layers being mounted while our metadata claims that they are unmounted, and this seems to be a way how that could happen without leaving a visible trace. It's unclear to me why this silently succeeds; this behavior is very long-standing. Signed-off-by: Miloslav Trmač --- drivers/overlay/overlay.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/overlay/overlay.go b/drivers/overlay/overlay.go index 419ef52e68..675c5ab80d 100644 --- a/drivers/overlay/overlay.go +++ b/drivers/overlay/overlay.go @@ -1770,11 +1770,13 @@ func (d *Driver) Put(id string) error { if !unmounted { if err := unix.Unmount(mountpoint, unix.MNT_DETACH); err != nil && !os.IsNotExist(err) { logrus.Debugf("Failed to unmount %s overlay: %s - %v", id, mountpoint, err) + return err } } if err := unix.Rmdir(mountpoint); err != nil && !os.IsNotExist(err) { logrus.Debugf("Failed to remove mountpoint %s overlay: %s - %v", id, mountpoint, err) + return err } return nil