mirror of
https://github.com/minio/minio.git
synced 2025-11-07 21:02:58 -05:00
Make ReqInfo concurrency safe (#15204)
Some read/writes of ReqInfo did not get appropriate locks, leading to races. Make sure reading and writing holds appropriate locks.
This commit is contained in:
@@ -148,7 +148,7 @@ func (c *Client) Call(ctx context.Context, method string, values url.Values, bod
|
||||
atomic.AddUint64(&networkErrsCounter, 1)
|
||||
}
|
||||
if c.MarkOffline() {
|
||||
logger.LogIf(context.Background(), fmt.Errorf("Marking %s temporary offline; caused by %w", c.url.String(), err))
|
||||
logger.LogIf(ctx, fmt.Errorf("Marking %s temporary offline; caused by %w", c.url.String(), err))
|
||||
}
|
||||
}
|
||||
return nil, &NetworkError{err}
|
||||
@@ -171,7 +171,7 @@ func (c *Client) Call(ctx context.Context, method string, values url.Values, bod
|
||||
// fully it should make sure to respond with '412'
|
||||
// instead, see cmd/storage-rest-server.go for ideas.
|
||||
if c.HealthCheckFn != nil && resp.StatusCode == http.StatusPreconditionFailed {
|
||||
logger.LogIf(context.Background(), fmt.Errorf("Marking %s temporary offline; caused by PreconditionFailed with disk ID mismatch", c.url.String()))
|
||||
logger.LogIf(ctx, fmt.Errorf("Marking %s temporary offline; caused by PreconditionFailed with disk ID mismatch", c.url.String()))
|
||||
c.MarkOffline()
|
||||
}
|
||||
defer xhttp.DrainBody(resp.Body)
|
||||
@@ -183,7 +183,7 @@ func (c *Client) Call(ctx context.Context, method string, values url.Values, bod
|
||||
atomic.AddUint64(&networkErrsCounter, 1)
|
||||
}
|
||||
if c.MarkOffline() {
|
||||
logger.LogIf(context.Background(), fmt.Errorf("Marking %s temporary offline; caused by %w", c.url.String(), err))
|
||||
logger.LogIf(ctx, fmt.Errorf("Marking %s temporary offline; caused by %w", c.url.String(), err))
|
||||
}
|
||||
}
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user