overlay: ignore EINVAL for cleanup unmount

ignore EINVAL for unmount in the cleanup function as it means the
directory is not a mount point.  It can happen if the cleanup happens
before the mount point is created.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano 2024-09-02 23:39:15 +02:00
parent 8bc8379af2
commit 16b6757422
No known key found for this signature in database
GPG Key ID: 67E38F7A8BA21772
1 changed files with 5 additions and 1 deletions

View File

@ -1475,7 +1475,11 @@ func (d *Driver) get(id string, disableShifting bool, options graphdriver.MountO
if retErr != nil {
if c := d.ctr.Decrement(mergedDir); c <= 0 {
if mntErr := unix.Unmount(mergedDir, 0); mntErr != nil {
logrus.Errorf("Unmounting %v: %v", mergedDir, mntErr)
// Ignore EINVAL, it means the directory is not a mount point and it can happen
// if the current function fails before the mount point is created.
if !errors.Is(mntErr, unix.EINVAL) {
logrus.Errorf("Unmounting %v: %v", mergedDir, mntErr)
}
}
}
}