rc: handle external unmount when mounting

Before this change, if the a mount was created via the rc but unmounted
externally with `fusermount -u` say, rclone would still believe the mount
was active when it wasn't.
This commit is contained in:
Isaac Aymerich 2022-10-03 12:24:58 +02:00 committed by GitHub
parent a3c06b9bbe
commit c5109408c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -122,7 +122,15 @@ func mountRc(ctx context.Context, in rc.Params) (out rc.Params, err error) {
log.Printf("mount FAILED: %v", err)
return nil, err
}
go func() {
if err = mnt.Wait(); err != nil {
log.Printf("unmount FAILED: %v", err)
return
}
mountMu.Lock()
defer mountMu.Unlock()
delete(liveMounts, mountPoint)
}()
// Add mount to list if mount point was successfully created
liveMounts[mountPoint] = mnt