diff --git a/cmd/cmount/fs.go b/cmd/cmount/fs.go index a60bd8336..4ba22ea30 100644 --- a/cmd/cmount/fs.go +++ b/cmd/cmount/fs.go @@ -30,7 +30,7 @@ type FS struct { ready chan (struct{}) mu sync.Mutex // to protect the below handles []vfs.Handle - destroyed int32 // read/write with sync/atomic + destroyed atomic.Int32 } // NewFS makes a new FS @@ -190,7 +190,7 @@ func (fsys *FS) Init() { // Destroy call). func (fsys *FS) Destroy() { defer log.Trace(fsys.f, "")("") - atomic.StoreInt32(&fsys.destroyed, 1) + fsys.destroyed.Store(1) } // Getattr reads the attributes for path diff --git a/cmd/cmount/mount.go b/cmd/cmount/mount.go index 7eb6a209c..9649b1be6 100644 --- a/cmd/cmount/mount.go +++ b/cmd/cmount/mount.go @@ -13,7 +13,6 @@ import ( "os" "runtime" "strings" - "sync/atomic" "time" "github.com/rclone/rclone/cmd/mountlib" @@ -192,7 +191,7 @@ func mount(VFS *vfs.VFS, mountPath string, opt *mountlib.Options) (<-chan error, // Shutdown the VFS fsys.VFS.Shutdown() var umountOK bool - if atomic.LoadInt32(&fsys.destroyed) != 0 { + if fsys.destroyed.Load() != 0 { fs.Debugf(nil, "Not calling host.Unmount as mount already Destroyed") umountOK = true } else if atexit.Signalled() {