mirror of https://github.com/minio/minio.git
fix a integer divide by zero crash during rebalance (#17455)
A state is updated with a delete marker, which does not have parity or data blocks defined, which can cause the integer divide by zero panics. This commit fixes to avoid panics.
This commit is contained in:
parent
6806537eb3
commit
35ef35b5c1
|
@ -63,7 +63,10 @@ func (rs *rebalanceStats) update(bucket string, fi FileInfo) {
|
|||
}
|
||||
|
||||
rs.NumVersions++
|
||||
onDiskSz := fi.Size * int64(fi.Erasure.DataBlocks+fi.Erasure.ParityBlocks) / int64(fi.Erasure.DataBlocks)
|
||||
onDiskSz := int64(0)
|
||||
if !fi.Deleted {
|
||||
onDiskSz = fi.Size * int64(fi.Erasure.DataBlocks+fi.Erasure.ParityBlocks) / int64(fi.Erasure.DataBlocks)
|
||||
}
|
||||
rs.Bytes += uint64(onDiskSz)
|
||||
rs.Bucket = bucket
|
||||
rs.Object = fi.Name
|
||||
|
|
Loading…
Reference in New Issue