From bdca2004303936cbcf4e5d427b87e00e585bb08e Mon Sep 17 00:00:00 2001 From: Roman Bednar Date: Wed, 6 May 2026 17:47:38 +0200 Subject: [PATCH] kubelet: Do not use deprecated function for checking mount point mount.IsNotMount point has been deprecated and mounter.IsMountPoint is now preffered. This small refactor if prepareSubpathTarget() should not pose any risk because IsNotMountPoint directly calls IsMountPoint and just returns its negated value. --- pkg/volume/util/subpath/subpath_linux.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/volume/util/subpath/subpath_linux.go b/pkg/volume/util/subpath/subpath_linux.go index 18eae61e01d..f746b35d2fe 100644 --- a/pkg/volume/util/subpath/subpath_linux.go +++ b/pkg/volume/util/subpath/subpath_linux.go @@ -94,15 +94,15 @@ func safeOpenSubPath(mounter mount.Interface, subpath Subpath) (int, error) { func prepareSubpathTarget(mounter mount.Interface, subpath Subpath) (bool, string, error) { // Early check for already bind-mounted subpath. bindPathTarget := getSubpathBindTarget(subpath) - notMount, err := mount.IsNotMountPoint(mounter, bindPathTarget) + isMount, err := mounter.IsMountPoint(bindPathTarget) if err != nil { if !os.IsNotExist(err) { return false, "", fmt.Errorf("error checking path %s for mount: %s", bindPathTarget, err) } // Ignore ErrorNotExist: the file/directory will be created below if it does not exist yet. - notMount = true + isMount = false } - if !notMount { + if isMount { // It's already mounted, so check if it's bind-mounted to the same path samePath, err := checkSubPathFileEqual(subpath, bindPathTarget) if err != nil {