Skip to content

Commit

Permalink
fix: ignore EINVAL on unmount operations
Browse files Browse the repository at this point in the history
Fixes #3837

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
  • Loading branch information
smira authored and talos-bot committed Jun 24, 2021
1 parent 7672435 commit f9e01d0
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1041,7 +1041,11 @@ func UnmountPodMounts(seq runtime.Sequence, data interface{}) (runtime.TaskExecu
logger.Printf("unmounting %s\n", mountpoint)

if err = unix.Unmount(mountpoint, 0); err != nil {
return fmt.Errorf("error unmounting %s: %w", mountpoint, err)
if errors.Is(err, syscall.EINVAL) {
log.Printf("ignoring unmount error %s: %v", mountpoint, err)
} else {
return fmt.Errorf("error unmounting %s: %w", mountpoint, err)
}
}
}
}
Expand Down Expand Up @@ -1077,7 +1081,11 @@ func UnmountSystemDiskBindMounts(seq runtime.Sequence, data interface{}) (runtim
logger.Printf("unmounting %s\n", mountpoint)

if err = unix.Unmount(mountpoint, 0); err != nil {
return fmt.Errorf("error unmounting %s: %w", mountpoint, err)
if errors.Is(err, syscall.EINVAL) {
log.Printf("ignoring unmount error %s: %v", mountpoint, err)
} else {
return fmt.Errorf("error unmounting %s: %w", mountpoint, err)
}
}
}
}
Expand Down

0 comments on commit f9e01d0

Please sign in to comment.