From: Ronen Friedman Date: Sat, 25 Sep 2021 11:42:56 +0000 (+0000) Subject: osd: fix the truncation of an int by int division X-Git-Tag: v16.2.8~83^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=7faeef8568d561d140785399f9073f21f393e840;p=ceph.git osd: fix the truncation of an int by int division The 'r' coeff calculated in OSD::tick() was always 0. Signed-off-by: Ronen Friedman (cherry picked from commit 6f2b4d3dd26b0ee072949888560b40bbeb3dc27e) --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index ce9079796e1c8..ac9bd245f2d17 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -5960,7 +5960,7 @@ void OSD::tick() // use a seed that is stable for each scrub interval, but varies // by OSD to avoid any herds. rng.seed(whoami + superblock.last_purged_snaps_scrub.sec()); - double r = (rng() % 1024) / 1024; + double r = (rng() % 1024) / 1024.0; next += cct->_conf->osd_scrub_min_interval * cct->_conf->osd_scrub_interval_randomize_ratio * r;