Skip to content

Commit

Permalink
RFC: Fail on unmount/rmdir in overlay.Driver.Put
Browse files Browse the repository at this point in the history
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č <[email protected]>
  • Loading branch information
mtrmac committed May 19, 2023
1 parent ceaf6ce commit 19fdd6e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/overlay/overlay.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 fmt.Errorf("unmounting %q: %w", mountpoint, 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 fmt.Errorf("removing mount point %q: %w", mountpoint, err)
}

return nil
Expand Down

0 comments on commit 19fdd6e

Please sign in to comment.