From 3f4217bc69a579b543334b543b8d0e6a46a618da Mon Sep 17 00:00:00 2001 From: kvaps Date: Wed, 18 Mar 2020 09:15:17 +0100 Subject: [PATCH] Fix subPath mountpint check --- mount_helper_common.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/mount_helper_common.go b/mount_helper_common.go index 81f91a8be8d..36bb32b463d 100644 --- a/mount_helper_common.go +++ b/mount_helper_common.go @@ -48,9 +48,9 @@ func CleanupMountPoint(mountPath string, mounter Interface, extensiveMountPointC // if corruptedMnt is true, it means that the mountPath is a corrupted mountpoint, and the mount point check // will be skipped func doCleanupMountPoint(mountPath string, mounter Interface, extensiveMountPointCheck bool, corruptedMnt bool) error { + var notMnt bool + var err error if !corruptedMnt { - var notMnt bool - var err error if extensiveMountPointCheck { notMnt, err = IsNotMountPoint(mounter, mountPath) } else { @@ -73,9 +73,13 @@ func doCleanupMountPoint(mountPath string, mounter Interface, extensiveMountPoin return err } - notMnt, mntErr := mounter.IsLikelyNotMountPoint(mountPath) - if mntErr != nil { - return mntErr + if extensiveMountPointCheck { + notMnt, err = IsNotMountPoint(mounter, mountPath) + } else { + notMnt, err = mounter.IsLikelyNotMountPoint(mountPath) + } + if err != nil { + return err } if notMnt { klog.V(4).Infof("%q is unmounted, deleting the directory", mountPath)