diff --git a/br/pkg/storage/s3.go b/br/pkg/storage/s3.go index b3708d2159909..c127c7de745e2 100644 --- a/br/pkg/storage/s3.go +++ b/br/pkg/storage/s3.go @@ -965,14 +965,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) }