]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: fix the truncation of an int by int division 45376/head
authorRonen Friedman <rfriedma@redhat.com>
Sat, 25 Sep 2021 11:42:56 +0000 (11:42 +0000)
committerRonen Friedman <rfriedma@redhat.com>
Mon, 14 Mar 2022 12:56:21 +0000 (12:56 +0000)
The 'r' coeff calculated in OSD::tick() was always 0.

Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
(cherry picked from commit 6f2b4d3dd26b0ee072949888560b40bbeb3dc27e)

src/osd/OSD.cc

index ce9079796e1c8f88a778c5f73017e9db3f517d27..ac9bd245f2d17e4c78b7432c893f985e6378dbe7 100644 (file)
@@ -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;