"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
mountlib: make sure we don't call umount more than once #4804
Nick Craig-Wood1cfce703b2d0
diff --git a/cmd/mountlib/mount.go b/cmd/mountlib/mount.goindex 2cd824ce9..74e48051f 100644--- a/cmd/mountlib/mount.go+++ b/cmd/mountlib/mount.go@@ -8,6 +8,7 @@ import ("path/filepath""runtime""strings"+ "sync""syscall""time"@@ -460,10 +461,14 @@ func Mount(VFS *vfs.VFS, mountpoint string, mount MountFn, opt *Options) error {}// Unmount on exit- fnHandle := atexit.Register(func() {- _ = sysdnotify.Stopping()- _ = unmount()- })+ var finaliseOnce sync.Once+ finalise := func() {+ finaliseOnce.Do(func() {+ _ = sysdnotify.Stopping()+ _ = unmount()+ })+ }+ fnHandle := atexit.Register(finalise)defer atexit.Unregister(fnHandle)// Notify systemd@@ -492,8 +497,7 @@ waitloop:}}- _ = sysdnotify.Stopping()- _ = unmount()+ finalise()if err != nil {return errors.Wrap(err, "failed to umount FUSE fs")