"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
vfs: update cached copy if we know it has changed even if pending opens
Nick Craig-Wood5795bd7db6d7
diff --git a/vfs/read_write.go b/vfs/read_write.goindex 2b8e9525b..b612fdf1d 100644--- a/vfs/read_write.go+++ b/vfs/read_write.go@@ -112,8 +112,8 @@ func (fh *RWFileHandle) openPending(truncate bool) (err error) {// if not truncating the file, need to read it firstif fh.flags&os.O_TRUNC == 0 && !truncate {// If the remote object exists AND its cached file exists locally AND there are no- // other handles with it open writers, then attempt to update it.- if o != nil && fh.d.vfs.cache.opens(fh.remote) <= 1 {+ // other RW handles with it open, then attempt to update it.+ if o != nil && fh.file.rwOpens() == 0 {cacheObj, err := fh.d.vfs.cache.f.NewObject(fh.remote)if err == nil && cacheObj != nil {cacheObj, err = copyObj(fh.d.vfs.cache.f, cacheObj, fh.remote, o)