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

vfscache: fix fatal error: sync: unlock of unlocked mutex error

Nick Craig-Woodbc705e14d8ea
diff --git a/vfs/vfscache/item.go b/vfs/vfscache/item.go
index d6a6e20b8..2c8145870 100644
--- a/vfs/vfscache/item.go
+++ b/vfs/vfscache/item.go
@@ -1131,6 +1131,17 @@ func (item *Item) _ensure(offset, size int64) (err error) {
// Downloaders can be nil here if the file has been
// renamed, so need to make some more downloaders
// OK to call downloaders constructor with item.mu held
+
+ // item.o can also be nil under some circumstances
+ // See: https://github.com/rclone/rclone/issues/6190
+ // See: https://github.com/rclone/rclone/issues/6235
+ if item.o == nil {
+ o, err := item.c.fremote.NewObject(context.Background(), item.name)
+ if err != nil {
+ return err
+ }
+ item.o = o
+ }
item.downloaders = downloaders.New(item, item.c.opt, item.name, item.o)
}
return item.downloaders.Download(r)