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

ftp: fix deadlock after failed update when concurrency=1

Ivan Andreev69f4b4871919
diff --git a/backend/ftp/ftp.go b/backend/ftp/ftp.go
index 28db54430..b5cfe2f24 100644
--- a/backend/ftp/ftp.go
+++ b/backend/ftp/ftp.go
@@ -1062,8 +1062,9 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, op
}
if err != nil {
_ = c.Quit() // toss this connection to avoid sync errors
- remove()
+ // recycle connection in advance to let remove() find free token
o.fs.putFtpConnection(nil, err)
+ remove()
return errors.Wrap(err, "update stor")
}
o.fs.putFtpConnection(&c, nil)