ftp: fix deadlock after failed update when concurrency=1

This commit is contained in:
Ivan Andreev 2021-08-19 18:58:44 +03:00 committed by Nick Craig-Wood
parent e75d57d638
commit f988773230
1 changed files with 2 additions and 1 deletions

View File

@ -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)