mirror of
https://github.com/minio/minio
synced 2024-11-05 17:34:01 +00:00
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
1 changed files with 4 additions and 1 deletions
|
@ -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 a new issue