fix: return quorum error upon decode failures (#12184)

This commit is contained in:
Harshavardhana 2021-04-29 10:00:03 -07:00
parent db80965259
commit fe8d1dbb3e
2 changed files with 13 additions and 1 deletions

View file

@ -301,7 +301,7 @@ func (api objectAPIHandlers) ListBucketsHandler(w http.ResponseWriter, r *http.R
// Anonymous users, should be rejected.
if cred.AccessKey == "" {
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrAccessDenied), r.URL)
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrAccessDenied), r.URL, guessIsBrowserReq(r))
return
}

View file

@ -197,6 +197,18 @@ func (p *parallelReader) Read(dst [][]byte) ([][]byte, error) {
return newBuf, nil
}
if countErrs(p.errs, nil) == len(p.errs) {
// We have success from all drives this can mean that
// all local drives succeeded, but all remote drives
// failed to read since p.readers[i] was already nil
// for such remote servers - this condition was missed
// we would return instead `nil, nil` from this
// function - it is safer to simply return Quorum error
// when all errs are nil but erasure coding cannot decode
// the content.
return nil, errErasureReadQuorum
}
return nil, reduceReadQuorumErrs(context.Background(), p.errs, objectOpIgnoredErrs, p.dataBlocks)
}