"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
union: fix deadlock when one part of a multi-upload fails
Nick Craig-Wood5dd51e6149c7
diff --git a/backend/union/entry.go b/backend/union/entry.goindex 1123183d8..efd2cbaef 100644--- a/backend/union/entry.go+++ b/backend/union/entry.go@@ -4,6 +4,7 @@ import ("context""fmt""io"+ "io/ioutil""sync""time"@@ -84,6 +85,10 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, operr := o.Update(ctx, readers[i], src, options...)if err != nil {errs[i] = fmt.Errorf("%s: %w", o.UpstreamFs().Name(), err)+ if len(entries) > 1 {+ // Drain the input buffer to allow other uploads to continue+ _, _ = io.Copy(ioutil.Discard, readers[i])+ }}} else {errs[i] = fs.ErrorNotAFilediff --git a/backend/union/union.go b/backend/union/union.goindex 0b01bddce..46c697a64 100644--- a/backend/union/union.go+++ b/backend/union/union.go@@ -6,6 +6,7 @@ import ("errors""fmt""io"+ "io/ioutil""path""path/filepath""strings"@@ -486,6 +487,10 @@ func (f *Fs) put(ctx context.Context, in io.Reader, src fs.ObjectInfo, stream bo}if err != nil {errs[i] = fmt.Errorf("%s: %w", u.Name(), err)+ if len(upstreams) > 1 {+ // Drain the input buffer to allow other uploads to continue+ _, _ = io.Copy(ioutil.Discard, readers[i])+ }return}objs[i] = u.WrapObject(o)