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

cmount: check for filesystem blowing up before Init is called

Nick Craig-Woode6ffe3464c17
diff --git a/cmd/cmount/mount.go b/cmd/cmount/mount.go
index 8847e6004..c462fafa0 100644
--- a/cmd/cmount/mount.go
+++ b/cmd/cmount/mount.go
@@ -269,8 +269,15 @@ func mount(f fs.Fs, mountpoint string) (*mountlib.FS, <-chan error, func() error
return errors.New("host unmount failed")
}
- // Wait for the filesystem to become ready
- <-fsys.ready
+ // Wait for the filesystem to become ready, checking the file
+ // system didn't blow up before starting
+ select {
+ case err := <-errChan:
+ err = errors.Wrap(err, "mount stopped before calling Init")
+ return nil, nil, nil, err
+ case <-fsys.ready:
+ }
+
return fsys.FS, errChan, unmount, nil
}