Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

rc: handle external unmount when mounting

Isaac Aymerichc5109408c02d
diff --git a/cmd/mountlib/rc.go b/cmd/mountlib/rc.go
index 7a89787fe..b675abda9 100644
--- a/cmd/mountlib/rc.go
+++ b/cmd/mountlib/rc.go
@@ -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