mirror of
https://github.com/minio/minio.git
synced 2025-01-11 15:03:22 -05:00
validate if cached value is empty before use (#13830)
fixes a crash reproduced while running hadoop tests ``` goroutine 201564 [running]: github.com/minio/minio/cmd.metaCacheEntries.resolve({0xc0206ab7a0, 0x4, 0xc0015b1908}, 0xc0212a7040) github.com/minio/minio/cmd/metacache-entries.go:352 +0x58a ``` Bonus: HeadBucket() should always provide content-type
This commit is contained in:
parent
be34fc9134
commit
b120bcb60a
@ -1210,7 +1210,7 @@ func (api objectAPIHandlers) HeadBucketHandler(w http.ResponseWriter, r *http.Re
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
writeSuccessResponseHeadersOnly(w)
|
writeResponse(w, http.StatusOK, nil, mimeXML)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteBucketHandler - Delete bucket
|
// DeleteBucketHandler - Delete bucket
|
||||||
|
@ -1131,7 +1131,9 @@ func (z *erasureServerPools) ListObjects(ctx context.Context, bucket, prefix, ma
|
|||||||
}
|
}
|
||||||
merged, err := z.listPath(ctx, &opts)
|
merged, err := z.listPath(ctx, &opts)
|
||||||
if err != nil && err != io.EOF {
|
if err != nil && err != io.EOF {
|
||||||
logger.LogIf(ctx, err)
|
if !isErrBucketNotFound(err) {
|
||||||
|
logger.LogIf(ctx, err)
|
||||||
|
}
|
||||||
return loi, err
|
return loi, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,7 +307,7 @@ func (m metaCacheEntries) resolve(r *metadataResolutionParams) (selected *metaCa
|
|||||||
// shallow decode.
|
// shallow decode.
|
||||||
xl, err := entry.xlmeta()
|
xl, err := entry.xlmeta()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.LogIf(context.Background(), err)
|
logger.LogIf(GlobalContext, err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
objsValid++
|
objsValid++
|
||||||
@ -339,11 +339,17 @@ func (m metaCacheEntries) resolve(r *metadataResolutionParams) (selected *metaCa
|
|||||||
if objsValid < r.objQuorum {
|
if objsValid < r.objQuorum {
|
||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
|
|
||||||
// If all objects agree.
|
// If all objects agree.
|
||||||
if selected != nil && objsAgree == objsValid {
|
if selected != nil && objsAgree == objsValid {
|
||||||
return selected, true
|
return selected, true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If cached is nil we shall skip the entry.
|
||||||
|
if selected.cached == nil {
|
||||||
|
return nil, false
|
||||||
|
}
|
||||||
|
|
||||||
// Merge if we have disagreement.
|
// Merge if we have disagreement.
|
||||||
// Create a new merged result.
|
// Create a new merged result.
|
||||||
selected = &metaCacheEntry{
|
selected = &metaCacheEntry{
|
||||||
|
Loading…
Reference in New Issue
Block a user