Skip to content

Commit

Permalink
overlay: Put should ignore ENINVAL for Unmount
Browse files Browse the repository at this point in the history
It seems there are cases where underlying layers can be already
unmounted in such case the layer directory is not removed and put fails
early with `EINVAL` causing dangling directory for these layers.

Following case may be a hidden underlying issue with `unmounting` of
`c/stoage` which needs more investigation however prior discussion shows
that this is a long standing issue in `storage` and which was never
caught till containers#1607

Signed-off-by: Aditya R <[email protected]>
  • Loading branch information
flouthoc committed Aug 14, 2023
1 parent 82ebd53 commit 6469e60
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/overlay/overlay.go
Original file line number Diff line number Diff line change
Expand Up @@ -1879,7 +1879,9 @@ 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 !errors.Is(err, unix.EINVAL) {
return fmt.Errorf("unmounting %q: %w", mountpoint, err)
}
}
}

Expand Down

0 comments on commit 6469e60

Please sign in to comment.