Skip to content

Commit 6caef36

Browse files
authored
fix: only allow fuse mode to unmount if an error occurs first (#537)
1 parent f6e8b3e commit 6caef36

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

proxy/fuse/fuse.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,17 @@ func NewConnSrc(mountdir, tmpdir string, client *proxy.Client, connset *proxy.Co
7070
return nil, nil, err
7171
}
7272

73-
if err := fuse.Unmount(mountdir); err != nil {
74-
// The error is too verbose to be useful to print out
75-
}
7673
logging.Verbosef("Mounting %v...", mountdir)
7774
c, err := fuse.Mount(mountdir, fuse.AllowOther())
7875
if err != nil {
79-
return nil, nil, fmt.Errorf("cannot mount %q: %v", mountdir, err)
76+
// a common cause of failed mounts is that a previous instance did not shutdown cleanly, leaving an abandoned mount
77+
logging.Errorf("WARNING: Mount failed - attempting to unmount dir to resolve...", mountdir)
78+
if err = fuse.Unmount(mountdir); err != nil {
79+
logging.Errorf("Unmount failed: %v", err)
80+
}
81+
if c, err = fuse.Mount(mountdir, fuse.AllowOther()); err != nil {
82+
return nil, nil, fmt.Errorf("cannot mount %q: %v", mountdir, err)
83+
}
8084
}
8185
logging.Infof("Mounted %v", mountdir)
8286

0 commit comments

Comments
 (0)