From 1c6f583f316479c8da0ac910ad2cae3de593f7dd Mon Sep 17 00:00:00 2001 From: andyzhangx Date: Fri, 19 Apr 2024 07:27:57 +0000 Subject: [PATCH] cleanup: refine extensiveMountCheck usage in unmount --- pkg/azurefile/azure_common_linux.go | 8 ++++---- pkg/mounter/safe_mounter_host_process_windows.go | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pkg/azurefile/azure_common_linux.go b/pkg/azurefile/azure_common_linux.go index b3e98cf4af..a61f94b10c 100644 --- a/pkg/azurefile/azure_common_linux.go +++ b/pkg/azurefile/azure_common_linux.go @@ -33,12 +33,12 @@ func SMBMount(m *mount.SafeFormatAndMount, source, target, fsType string, option return m.MountSensitive(source, target, fsType, options, sensitiveMountOptions) } -func SMBUnmount(m *mount.SafeFormatAndMount, target string, _, _ bool) error { - return mount.CleanupMountPoint(target, m.Interface, true /*extensiveMountPointCheck*/) +func SMBUnmount(m *mount.SafeFormatAndMount, target string, extensiveMountCheck, _ bool) error { + return mount.CleanupMountPoint(target, m.Interface, extensiveMountCheck) } -func CleanupMountPoint(m *mount.SafeFormatAndMount, target string, _ bool) error { - return mount.CleanupMountPoint(target, m.Interface, true /*extensiveMountPointCheck*/) +func CleanupMountPoint(m *mount.SafeFormatAndMount, target string, extensiveMountCheck bool) error { + return mount.CleanupMountPoint(target, m.Interface, extensiveMountCheck) } func preparePublishPath(_ string, _ *mount.SafeFormatAndMount) error { diff --git a/pkg/mounter/safe_mounter_host_process_windows.go b/pkg/mounter/safe_mounter_host_process_windows.go index 0e93819299..48736fc39d 100644 --- a/pkg/mounter/safe_mounter_host_process_windows.go +++ b/pkg/mounter/safe_mounter_host_process_windows.go @@ -143,8 +143,7 @@ func (mounter *winMounter) Unmount(target string) error { remoteServer, err := smb.GetRemoteServerFromTarget(target) if err == nil { klog.V(2).Infof("remote server path: %s, local path: %s", remoteServer, target) - hasDupSMBMount, err := smb.CheckForDuplicateSMBMounts(driverGlobalMountPath, target, remoteServer) - if err == nil { + if hasDupSMBMount, err := smb.CheckForDuplicateSMBMounts(driverGlobalMountPath, target, remoteServer); err == nil { if !hasDupSMBMount { remoteServer = strings.Replace(remoteServer, "UNC\\", "\\\\", 1) if err := smb.RemoveSmbGlobalMapping(remoteServer); err != nil {