mirror of
https://github.com/minio/minio.git
synced 2025-11-10 05:59:43 -05:00
Return bit-rot verified data instead of re-reading from disk (#5568)
- Data from disk was being read after bitrot verification to return data for GetObject. Strictly speaking this does not guarantee bitrot protection, as disks may return bad data even temporarily. - This fix reads data from disk, verifies data for bitrot and then returns data to the client directly.
This commit is contained in:
committed by
Harshavardhana
parent
52eea7b9c1
commit
ea8973b7d7
20
cmd/utils.go
20
cmd/utils.go
@@ -294,3 +294,23 @@ func jsonSave(f interface {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ceilFrac takes a numerator and denominator representing a fraction
|
||||
// and returns its ceiling. If denominator is 0, it returns 0 instead
|
||||
// of crashing.
|
||||
func ceilFrac(numerator, denominator int64) (ceil int64) {
|
||||
if denominator == 0 {
|
||||
// do nothing on invalid input
|
||||
return
|
||||
}
|
||||
// Make denominator positive
|
||||
if denominator < 0 {
|
||||
numerator = -numerator
|
||||
denominator = -denominator
|
||||
}
|
||||
ceil = numerator / denominator
|
||||
if numerator > 0 && numerator%denominator != 0 {
|
||||
ceil++
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user