"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
core: fix data race in walk
Nick Craig-Wood5250fcdf08fc
diff --git a/fs/walk.go b/fs/walk.goindex 509dead44..a52569393 100644--- a/fs/walk.go+++ b/fs/walk.go@@ -117,9 +117,20 @@ func walk(f Fs, path string, includeAll bool, maxLevel int, fn WalkFunc, listDirreturn}entries, err := listDir(f, includeAll, job.remote)+ var jobs []listJob+ if err == nil && job.depth != 0 {+ entries.ForDir(func(dir *Dir) {+ // Recurse for the directory+ jobs = append(jobs, listJob{+ remote: dir.Remote(),+ depth: job.depth - 1,+ })+ })+ }mu.Lock()err = fn(job.remote, entries, err)mu.Unlock()+ // NB once we have passed entries to fn we mustn't touch it againif err != nil && err != ErrorSkipDir {traversing.Done()Stats.Error()@@ -132,17 +143,7 @@ func walk(f Fs, path string, includeAll bool, maxLevel int, fn WalkFunc, listDir}continue}- var jobs []listJob- if job.depth != 0 && err == nil {- entries.ForDir(func(dir *Dir) {- // Recurse for the directory- jobs = append(jobs, listJob{- remote: dir.Remote(),- depth: job.depth - 1,- })- })- }- if len(jobs) > 0 {+ if err == nil && len(jobs) > 0 {traversing.Add(len(jobs))go func() {// Now we have traversed this directory, send these