From 3fdb72b30370b0a2588900787f3191d21e4e61c8 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Thu, 18 Oct 2018 18:29:49 +0800 Subject: [PATCH] osd: cast `whoami` to unsigned so it can be used as the seed for RNG default_random_engine's result_type is `unsigned int`, so we need to pass an `unsigned int` as its seed. Fixes: http://tracker.ceph.com/issues/26890 Signed-off-by: Kefu Chai Conflicts: src/osd/OSD.cc: this breaks the build with clang. and in master we are not using std::default_random_engine for setting the scrub interval. so this change is not cherry-picked from master. --- src/osd/OSD.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 042097bb35e..e2d1a6db7a5 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -2055,7 +2055,7 @@ double OSD::get_tick_interval() const { // vary +/- 5% to avoid scrub scheduling livelocks constexpr auto delta = 0.05; - std::default_random_engine rng{whoami}; + std::default_random_engine rng{static_cast(whoami)}; return (OSD_TICK_INTERVAL * std::uniform_real_distribution<>{1.0 - delta, 1.0 + delta}(rng)); } -- 2.47.3