mountlib: restore daemon mode after #5415

This commit is contained in:
Ivan Andreev 2021-07-26 13:44:02 +03:00
parent 63a24255f8
commit 55e766f4e8
2 changed files with 11 additions and 11 deletions

View file

@ -145,8 +145,8 @@ func NewMountCommand(commandName string, hidden bool, mount MountFn) *cobra.Comm
VFSOpt: vfsflags.Opt,
}
err := mnt.Mount()
if err == nil {
daemonized, err := mnt.Mount()
if !daemonized && err == nil {
err = mnt.Wait()
}
if err != nil {
@ -167,21 +167,21 @@ func NewMountCommand(commandName string, hidden bool, mount MountFn) *cobra.Comm
}
// Mount the remote at mountpoint
func (m *MountPoint) Mount() (err error) {
func (m *MountPoint) Mount() (daemonized bool, err error) {
if err = m.CheckOverlap(); err != nil {
return err
return false, err
}
if err = m.CheckAllowings(); err != nil {
return err
return false, err
}
m.SetVolumeName(m.MountOpt.VolumeName)
// Start background task if --background is specified
// Start background task if --daemon is specified
if m.MountOpt.Daemon {
daemonized := startBackgroundMode()
daemonized = startBackgroundMode()
if daemonized {
return nil
return true, nil
}
}
@ -189,9 +189,9 @@ func (m *MountPoint) Mount() (err error) {
m.ErrChan, m.UnmountFn, err = m.MountFn(m.VFS, m.MountPoint, &m.MountOpt)
if err != nil {
return errors.Wrap(err, "failed to mount FUSE fs")
return false, errors.Wrap(err, "failed to mount FUSE fs")
}
return nil
return false, nil
}
// CheckOverlap checks that root doesn't overlap with mountpoint

View file

@ -270,7 +270,7 @@ func (vol *Volume) mount(id string) error {
return errors.New("volume filesystem is not ready")
}
if err := vol.mnt.Mount(); err != nil {
if _, err := vol.mnt.Mount(); err != nil {
return err
}
vol.mnt.MountedOn = time.Now()