aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2022-04-02 11:13:50 -0700
committerGitHub <noreply@github.com>2022-04-02 11:13:50 -0700
commit937a0dc33f212e86adc096188a72262b398deda8 (patch)
tree53158e42a4c093f39a7f89b872dda4ee60da1054
parent498a0af0ee54b2c06dd0710cf6fd84722ea75912 (diff)
parentabe92bac90030a0120f7f6cc5d90aaffcf52e4f4 (diff)
downloadseaweedfs-csi-driver-937a0dc33f212e86adc096188a72262b398deda8.tar.xz
seaweedfs-csi-driver-937a0dc33f212e86adc096188a72262b398deda8.zip
Merge pull request #53 from kvaster/unmount-fix
Do not fail if path is already unmounted
-rw-r--r--pkg/driver/mounter.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/pkg/driver/mounter.go b/pkg/driver/mounter.go
index 82da5f6..9d4aff3 100644
--- a/pkg/driver/mounter.go
+++ b/pkg/driver/mounter.go
@@ -38,9 +38,14 @@ func fuseMount(path string, command string, args []string) error {
}
func fuseUnmount(path string) error {
- if err := mount.New("").Unmount(path); err != nil {
- return err
+ m := mount.New("")
+
+ if ok, _ := m.IsLikelyNotMountPoint(path); !ok {
+ if err := m.Unmount(path); err != nil {
+ return err
+ }
}
+
// as fuse quits immediately, we will try to wait until the process is done
process, err := findFuseMountProcess(path)
if err != nil {