From 44bea358045e09f228ee0fbc594ec0f77bc71112 Mon Sep 17 00:00:00 2001 From: Manu Gupta Date: Mon, 13 Jun 2022 18:16:10 -0700 Subject: [PATCH] Return unwrapped ErrNotExist when EvalSymlink returns PathError By default filepath.EvalSymlink returns PathError. When a file is not found, we should unwrap it and return ErrNotExist as this is what this function expects. Similar to the comment at: https://github.com/kubernetes/kubernetes/pull/109217#discussion_r896272206 --- staging/src/k8s.io/mount-utils/mount_linux.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/staging/src/k8s.io/mount-utils/mount_linux.go b/staging/src/k8s.io/mount-utils/mount_linux.go index 1ef4b6199c0..0f8bf1ac1bf 100644 --- a/staging/src/k8s.io/mount-utils/mount_linux.go +++ b/staging/src/k8s.io/mount-utils/mount_linux.go @@ -732,6 +732,9 @@ func (mounter *Mounter) IsMountPoint(file string) (bool, error) { // Resolve any symlinks in file, kernel would do the same and use the resolved path in /proc/mounts. resolvedFile, err := filepath.EvalSymlinks(file) if err != nil { + if errors.Is(isMntErr, fs.ErrNotExist) { + return false, fs.ErrNotExist + } return false, err }