"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
cmount: don't attempt to unmount if fs has been destroyed already #4957
Nick Craig-Wood2f67681e3b61
diff --git a/cmd/cmount/fs.go b/cmd/cmount/fs.goindex 34b5b7f66..32a6b8c21 100644--- a/cmd/cmount/fs.go+++ b/cmd/cmount/fs.go@@ -9,6 +9,7 @@ import ("os""path""sync"+ "sync/atomic""time""github.com/billziss-gh/cgofuse/fuse"@@ -23,11 +24,12 @@ const fhUnset = ^uint64(0)// FS represents the top level filing systemtype FS struct {- VFS *vfs.VFS- f fs.Fs- ready chan (struct{})- mu sync.Mutex // to protect the below- handles []vfs.Handle+ VFS *vfs.VFS+ f fs.Fs+ ready chan (struct{})+ mu sync.Mutex // to protect the below+ handles []vfs.Handle+ destroyed int32 // read/write with sync/atomic}// NewFS makes a new FS@@ -187,6 +189,7 @@ func (fsys *FS) Init() {// Destroy call).func (fsys *FS) Destroy() {defer log.Trace(fsys.f, "")("")+ atomic.StoreInt32(&fsys.destroyed, 1)}// Getattr reads the attributes for pathdiff --git a/cmd/cmount/mount.go b/cmd/cmount/mount.goindex ecfabe3f4..de5691399 100644--- a/cmd/cmount/mount.go+++ b/cmd/cmount/mount.go@@ -12,6 +12,7 @@ import ("fmt""os""runtime"+ "sync/atomic""time""github.com/billziss-gh/cgofuse/fuse"@@ -168,7 +169,10 @@ func mount(VFS *vfs.VFS, mountPath string, opt *mountlib.Options) (<-chan error,// Shutdown the VFSfsys.VFS.Shutdown()var umountOK bool- if atexit.Signalled() {+ if atomic.LoadInt32(&fsys.destroyed) != 0 {+ fs.Debugf(nil, "Not calling host.Unmount as mount already Destroyed")+ umountOK = true+ } else if atexit.Signalled() {// If we have received a signal then FUSE will be shutting down alreadyfs.Debugf(nil, "Not calling host.Unmount as signal received")umountOK = true