aboutsummaryrefslogtreecommitdiff
path: root/pkg/driver/mounter.go
diff options
context:
space:
mode:
authorViktor Kuzmin <kvaster@gmail.com>2023-08-06 20:55:56 +0300
committerViktor Kuzmin <kvaster@gmail.com>2023-08-06 20:55:56 +0300
commiteca9cde95a899ab5645b00d8c0d547abd4bc7e8e (patch)
treee3c646e031c35b0299d58407994b10b5ed38a89a /pkg/driver/mounter.go
parentcb920765f5d0b3b7a6a54b9bacf5e9be28b46102 (diff)
downloadseaweedfs-csi-driver-eca9cde95a899ab5645b00d8c0d547abd4bc7e8e.tar.xz
seaweedfs-csi-driver-eca9cde95a899ab5645b00d8c0d547abd4bc7e8e.zip
Use single instance of mount utility - mount.New is expensive
Diffstat (limited to 'pkg/driver/mounter.go')
-rw-r--r--pkg/driver/mounter.go8
1 files changed, 3 insertions, 5 deletions
diff --git a/pkg/driver/mounter.go b/pkg/driver/mounter.go
index 34e0461..64eae33 100644
--- a/pkg/driver/mounter.go
+++ b/pkg/driver/mounter.go
@@ -79,7 +79,7 @@ func fuseMount(path string, command string, args []string) (Unmounter, error) {
// make sure we'll have no stale mounts
time.Sleep(time.Millisecond * 100)
- _ = mount.New("").Unmount(path)
+ _ = mountutil.Unmount(path)
close(fu.finished)
}()
@@ -122,10 +122,8 @@ func (fu *fuseUnmounter) waitFinished(timeout time.Duration) error {
}
func (fu *fuseUnmounter) Unmount() error {
- m := mount.New("")
-
- if ok, err := m.IsLikelyNotMountPoint(fu.path); !ok || mount.IsCorruptedMnt(err) {
- if err := m.Unmount(fu.path); err != nil {
+ if ok, err := mountutil.IsLikelyNotMountPoint(fu.path); !ok || mount.IsCorruptedMnt(err) {
+ if err := mountutil.Unmount(fu.path); err != nil {
return err
}
}