diff options
| author | Viktor Kuzmin <kvaster@gmail.com> | 2023-08-06 20:55:56 +0300 |
|---|---|---|
| committer | Viktor Kuzmin <kvaster@gmail.com> | 2023-08-06 20:55:56 +0300 |
| commit | eca9cde95a899ab5645b00d8c0d547abd4bc7e8e (patch) | |
| tree | e3c646e031c35b0299d58407994b10b5ed38a89a /pkg/driver/mounter.go | |
| parent | cb920765f5d0b3b7a6a54b9bacf5e9be28b46102 (diff) | |
| download | seaweedfs-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.go | 8 |
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 } } |
