package driver import ( "errors" "time" "k8s.io/mount-utils" ) var mountutil = mount.New("") func waitForMount(path string, timeout time.Duration) error { var elapsed time.Duration var interval = 10 * time.Millisecond for { notMount, err := mountutil.IsLikelyNotMountPoint(path) if err != nil { return err } if !notMount { return nil } time.Sleep(interval) elapsed = elapsed + interval if elapsed >= timeout { return errors.New("timeout waiting for mount") } } }