]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/PGMonitor: avoid uint64_t overflow when checking pool 'target/max' status. 5370/head
authorhuangjun <hjwsm1989@gmail.com>
Mon, 20 Jul 2015 02:50:20 +0000 (10:50 +0800)
committerLoic Dachary <ldachary@redhat.com>
Tue, 28 Jul 2015 12:53:42 +0000 (14:53 +0200)
Fixes: #12401
Signed-off-by: huangjun <hjwsm1989@gmail.com>
(cherry picked from commit f84e6b8157e78fd05cd1c8ac957c92df17e6ba06)

src/mon/PGMonitor.cc

index e699efb652b7bba4ea3d99c1c431d8cd738866e2..e21e1b8f32aab518e1aaec5297a23ea837f1beb0 100644 (file)
@@ -2113,7 +2113,7 @@ void PGMonitor::get_health(list<pair<health_status_t,string> >& summary,
       ((1000000 - p->second.cache_target_full_ratio_micro) *
        g_conf->mon_cache_target_full_warn_ratio);
     if (p->second.target_max_objects && (uint64_t)st.stats.sum.num_objects >
-       p->second.target_max_objects * ratio / 1000000) {
+       p->second.target_max_objects * (ratio / 1000000.0)) {
       nearfull = true;
       if (detail) {
        ostringstream ss;
@@ -2125,7 +2125,7 @@ void PGMonitor::get_health(list<pair<health_status_t,string> >& summary,
       }
     }
     if (p->second.target_max_bytes && (uint64_t)st.stats.sum.num_bytes >
-       p->second.target_max_bytes * ratio / 1000000) {
+       p->second.target_max_bytes * (ratio / 1000000.0)) {
       nearfull = true;
       if (detail) {
        ostringstream ss;