From f7c44d17bc51f400511f13ea9b180819cf4bb68b Mon Sep 17 00:00:00 2001 From: alxtkr77 <3098237+alxtkr77@users.noreply.github.com> Date: Tue, 10 Sep 2019 09:51:03 +0300 Subject: [PATCH] IG-11363: Fix unmount of degenerated mountpoints (#21) --- pkg/flex/utils.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pkg/flex/utils.go b/pkg/flex/utils.go index f757e4f..77f29c5 100644 --- a/pkg/flex/utils.go +++ b/pkg/flex/utils.go @@ -3,6 +3,7 @@ package flex import ( "fmt" "os/exec" + "strings" "syscall" "github.com/v3io/flex-fuse/pkg/journal" @@ -26,14 +27,16 @@ func isStaleMount(path string) bool { func isMountPoint(path string) bool { journal.Debug("calling isMountPoint command", "target", path) - cmd := exec.Command("mountpoint", path) - err := cmd.Run() + cmd := exec.Command("mount") + mountList, err := cmd.CombinedOutput() if err != nil { - journal.Debug("calling isMountPoint command", "target", path, "result", false) + journal.Debug("calling isMountPoint command", "target", path, "result", false, "error", err) return false } - journal.Debug("calling isMountPoint command", "target", path, "result", true) - return true + mountListString := string(mountList) + result := strings.Contains(mountListString, path+" type") + journal.Debug("calling isMountPoint command", "target", path, "result", result) + return result } func MakeResponse(status, message string) *Response {