Skip to content

Commit

Permalink
osd: fix arithmetic exception when scrub_min_interval is small
Browse files Browse the repository at this point in the history
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
  • Loading branch information
Mykola Golub committed Dec 7, 2015
1 parent 4b0c2b7 commit e4925a7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/osd/OSD.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit e4925a7

Please sign in to comment.