"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: fix deadlock between RWFileHandle.close and File.Remove - fixes #2857
Nick Craig-Wood2cfe2354dfe1
diff --git a/vfs/file.go b/vfs/file.goindex 8e9f91ecc..47fdf22ab 100644--- a/vfs/file.go+++ b/vfs/file.go@@ -444,19 +444,19 @@ func (f *File) Remove() error {if f.d.vfs.Opt.ReadOnly {return EROFS}- f.mu.Lock()- f.muRW.Lock()+ f.muRW.Lock() // muRW must be locked before mu to avoid+ f.mu.Lock() // deadlock in RWFileHandle.openPending and .closeif f.o != nil {err := f.o.Remove()if err != nil {fs.Errorf(f, "File.Remove file error: %v", err)- f.muRW.Unlock()f.mu.Unlock()+ f.muRW.Unlock()return err}}- f.muRW.Unlock()f.mu.Unlock()+ f.muRW.Unlock()// Remove the item from the directory listingf.d.delObject(f.Name())