From 69f4b4871919ee3dc726228b8d295b2a70050c6e Mon Sep 17 00:00:00 2001 From: Ivan Andreev Date: Thu, 19 Aug 2021 18:58:44 +0300 Subject: [PATCH] ftp: fix deadlock after failed update when concurrency=1 --- backend/ftp/ftp.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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)