Skip to content

Commit

Permalink
IG-11363: Fix unmount of degenerated mountpoints (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
alxtkr77 authored and pavius committed Sep 10, 2019
1 parent d2b34c4 commit f7c44d1
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions pkg/flex/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package flex
import (
"fmt"
"os/exec"
"strings"
"syscall"

"github.com/v3io/flex-fuse/pkg/journal"
Expand All @@ -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 {
Expand Down

0 comments on commit f7c44d1

Please sign in to comment.