From: Mykola Golub Date: Mon, 7 Dec 2015 06:53:23 +0000 (+0200) Subject: osd: fix arithmetic exception when scrub_min_interval is small X-Git-Tag: v10.0.2~56^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a828a4df54f040a39f54c4cdecde234376301be5;p=ceph.git osd: fix arithmetic exception when scrub_min_interval is small Signed-off-by: Mykola Golub --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 7425cc7e6b6e..766dedfb9e53 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -6088,9 +6088,10 @@ OSDService::ScrubJob::ScrubJob(const spg_t& pg, const utime_t& timestamp, pool_scrub_max_interval : g_conf->osd_scrub_max_interval; sched_time += scrub_min_interval; - if (g_conf->osd_scrub_interval_randomize_ratio > 0) { - sched_time += rand() % (int)(scrub_min_interval * - g_conf->osd_scrub_interval_randomize_ratio); + int divisor = scrub_min_interval * + g_conf->osd_scrub_interval_randomize_ratio; + if (divisor > 0) { + sched_time += rand() % divisor; } deadline += scrub_max_interval; }