mirror of
https://github.com/minio/minio.git
synced 2025-11-09 05:34:56 -05:00
handle racy updates to globalSite config (#19750)
``` ================== WARNING: DATA RACE Read at 0x0000082be990 by goroutine 205: github.com/minio/minio/cmd.setCommonHeaders() Previous write at 0x0000082be990 by main goroutine: github.com/minio/minio/cmd.lookupConfigs() ```
This commit is contained in:
@@ -57,7 +57,7 @@ func parseLocationConstraint(r *http.Request) (location string, s3Error APIError
|
||||
} // else for both err as nil or io.EOF
|
||||
location = locationConstraint.Location
|
||||
if location == "" {
|
||||
location = globalSite.Region
|
||||
location = globalSite.Region()
|
||||
}
|
||||
if !isValidLocation(location) {
|
||||
return location, ErrInvalidRegion
|
||||
@@ -69,7 +69,8 @@ func parseLocationConstraint(r *http.Request) (location string, s3Error APIError
|
||||
// Validates input location is same as configured region
|
||||
// of MinIO server.
|
||||
func isValidLocation(location string) bool {
|
||||
return globalSite.Region == "" || globalSite.Region == location
|
||||
region := globalSite.Region()
|
||||
return region == "" || region == location
|
||||
}
|
||||
|
||||
// Supported headers that needs to be extracted.
|
||||
@@ -243,7 +244,7 @@ func extractReqParams(r *http.Request) map[string]string {
|
||||
return nil
|
||||
}
|
||||
|
||||
region := globalSite.Region
|
||||
region := globalSite.Region()
|
||||
cred := getReqAccessCred(r, region)
|
||||
|
||||
principalID := cred.AccessKey
|
||||
|
||||
Reference in New Issue
Block a user