diff --git a/br/pkg/storage/s3.go b/br/pkg/storage/s3.go index d6d29706825bc..67c95bfccbd01 100644 --- a/br/pkg/storage/s3.go +++ b/br/pkg/storage/s3.go @@ -969,14 +969,14 @@ func (rl retryerWithLog) ShouldRetry(r *request.Request) bool { r.Error = errors.New("read tcp *.*.*.*:*->*.*.*.*:*: read: connection reset by peer") } }) - if isConnectionResetError(r.Error) { - return true - } - if isDeadlineExceedError(r.Error) && r.HTTPRequest.URL.Host == ec2MetaAddress { + if r.HTTPRequest.URL.Host == ec2MetaAddress && (isDeadlineExceedError(r.Error) || isConnectionResetError(r.Error)) { // fast fail for unreachable linklocal address in EC2 containers. log.Warn("failed to get EC2 metadata. skipping.", logutil.ShortError(r.Error)) return false } + if isConnectionResetError(r.Error) { + return true + } return rl.DefaultRetryer.ShouldRetry(r) }