mirror of
https://github.com/ceph/ceph
synced 2024-12-16 08:26:25 +00:00
Merge pull request #17116 from Synesis-LLC/fix-20934
rgw: Prevent overflow of cached stats values Reviewed-by: Orit Wasserman <owasserm@redhat.com>
This commit is contained in:
commit
fb90cbbd95
@ -241,19 +241,19 @@ public:
|
||||
const uint64_t rounded_added = rgw_rounded_objsize(added_bytes);
|
||||
const uint64_t rounded_removed = rgw_rounded_objsize(removed_bytes);
|
||||
|
||||
if ((entry->stats.size + added_bytes - removed_bytes) >= 0) {
|
||||
if (((int64_t)(entry->stats.size + added_bytes - removed_bytes)) >= 0) {
|
||||
entry->stats.size += added_bytes - removed_bytes;
|
||||
} else {
|
||||
entry->stats.size = 0;
|
||||
}
|
||||
|
||||
if ((entry->stats.size_rounded + rounded_added - rounded_removed) >= 0) {
|
||||
if (((int64_t)(entry->stats.size_rounded + rounded_added - rounded_removed)) >= 0) {
|
||||
entry->stats.size_rounded += rounded_added - rounded_removed;
|
||||
} else {
|
||||
entry->stats.size_rounded = 0;
|
||||
}
|
||||
|
||||
if ((entry->stats.num_objects + objs_delta) >= 0) {
|
||||
if (((int64_t)(entry->stats.num_objects + objs_delta)) >= 0) {
|
||||
entry->stats.num_objects += objs_delta;
|
||||
} else {
|
||||
entry->stats.num_objects = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user