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

vfs: fix data race discovered by the race detector

Nick Craig-Wood687a3b1832ab
diff --git a/vfs/vfscache/item.go b/vfs/vfscache/item.go
index baecaa8f3..8fffb2bc5 100644
--- a/vfs/vfscache/item.go
+++ b/vfs/vfscache/item.go
@@ -605,8 +605,9 @@ func (item *Item) _store(ctx context.Context, storeFn StoreFn) (err error) {
fs.Debugf(item.name, "vfs cache: writeback object to VFS layer")
// Write the object back to the VFS layer as last
// thing we do with mutex unlocked
+ o := item.o
item.mu.Unlock()
- storeFn(item.o)
+ storeFn(o)
item.mu.Lock()
}
return nil