]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/OSD.cc: fix UNINTENDED_INTEGER_DIVISION
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Thu, 17 Sep 2015 15:01:17 +0000 (17:01 +0200)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Fri, 29 Jan 2016 20:51:17 +0000 (21:51 +0100)
Fix for:

CID 1297883 (#1 of 1): Result is not floating-point (UNINTENDED_INTEGER_DIVISION)
 integer_division: Dividing integer expressions this->cct->_conf->osd_heartbeat_grace
 and 2, and then converting the integer quotient to type double. Any remainder,
 or fractional part of the quotient, is ignored.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
src/osd/OSD.cc

index 4c6821ccd2efd49db70fb98d491498ed3ffe1d1c..760fe49ac4d0a2a9618c519019e54caeb187f6c4 100644 (file)
@@ -3848,7 +3848,7 @@ void OSD::heartbeat_check()
   assert(heartbeat_lock.is_locked());
   utime_t now = ceph_clock_now(cct);
   double age = hbclient_messenger->get_dispatch_queue_max_age(now);
-  if (age > (cct->_conf->osd_heartbeat_grace / 2)) {
+  if (age > ((double)cct->_conf->osd_heartbeat_grace / 2.0)) {
     derr << "skipping heartbeat_check, hbqueue max age: " << age << dendl;
     return; // hb dispatch is too backed up for our hb status to be meaningful
   }