Loading pkg/mounter/mounter.go +23 −23 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ import ( "errors" "fmt" "io/ioutil" "math" "os" "os/exec" "strings" Loading Loading @@ -87,7 +88,7 @@ func FuseUnmount(path string) error { return nil } glog.Infof("Found fuse pid %v of mount %s, checking if it still runs", process.Pid, path) return waitForProcess(process, 1) return waitForProcess(process, 20) } func waitForMount(path string, timeout time.Duration) error { Loading Loading @@ -128,10 +129,8 @@ func findFuseMountProcess(path string) (*os.Process, error) { return nil, nil } func waitForProcess(p *os.Process, backoff int) error { if backoff == 20 { return fmt.Errorf("Timeout waiting for PID %v to end", p.Pid) } func waitForProcess(p *os.Process, limit int) error { for backoff := 0; backoff < limit; backoff++ { cmdLine, err := getCmdLine(p.Pid) if err != nil { glog.Warningf("Error checking cmdline of PID %v, assuming it is dead: %s", p.Pid, err) Loading @@ -149,8 +148,9 @@ func waitForProcess(p *os.Process, backoff int) error { return nil } glog.Infof("Fuse process with PID %v still active, waiting...", p.Pid) time.Sleep(time.Duration(backoff*100) * time.Millisecond) return waitForProcess(p, backoff+1) time.Sleep(time.Duration(math.Pow(1.5, float64(backoff))*100) * time.Millisecond) } return fmt.Errorf("Timeout waiting for PID %v to end", p.Pid) } func getCmdLine(pid int) (string, error) { Loading Loading
pkg/mounter/mounter.go +23 −23 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ import ( "errors" "fmt" "io/ioutil" "math" "os" "os/exec" "strings" Loading Loading @@ -87,7 +88,7 @@ func FuseUnmount(path string) error { return nil } glog.Infof("Found fuse pid %v of mount %s, checking if it still runs", process.Pid, path) return waitForProcess(process, 1) return waitForProcess(process, 20) } func waitForMount(path string, timeout time.Duration) error { Loading Loading @@ -128,10 +129,8 @@ func findFuseMountProcess(path string) (*os.Process, error) { return nil, nil } func waitForProcess(p *os.Process, backoff int) error { if backoff == 20 { return fmt.Errorf("Timeout waiting for PID %v to end", p.Pid) } func waitForProcess(p *os.Process, limit int) error { for backoff := 0; backoff < limit; backoff++ { cmdLine, err := getCmdLine(p.Pid) if err != nil { glog.Warningf("Error checking cmdline of PID %v, assuming it is dead: %s", p.Pid, err) Loading @@ -149,8 +148,9 @@ func waitForProcess(p *os.Process, backoff int) error { return nil } glog.Infof("Fuse process with PID %v still active, waiting...", p.Pid) time.Sleep(time.Duration(backoff*100) * time.Millisecond) return waitForProcess(p, backoff+1) time.Sleep(time.Duration(math.Pow(1.5, float64(backoff))*100) * time.Millisecond) } return fmt.Errorf("Timeout waiting for PID %v to end", p.Pid) } func getCmdLine(pid int) (string, error) { Loading