From: Radoslaw Zarzynski Date: Tue, 26 Jul 2022 09:39:08 +0000 (+0000) Subject: crimson/monc: renew_rotating_keyring() doesn't assume the clock is monotonic X-Git-Tag: v18.0.0~421^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F47277%2Fhead;p=ceph.git crimson/monc: renew_rotating_keyring() doesn't assume the clock is monotonic According to the `seastar::lowres_system_clock` reference: > This clock has the same granularity as lowres_clock, > but it is not required to be monotonic and its time > points correspond to system time. we should similar check as the classical `MonClient` does: ```cpp if ((now > last_rotating_renew_sent) && double(now - last_rotating_renew_sent) < 1) { ldout(cct, 10) << __func__ << " called too often (last: " << last_rotating_renew_sent << "), skipping refresh" << dendl; return 0; } ``` This check is rather paranoidal and the main reason behind it in crimson is replicating the classical behaviour. Signed-off-by: Radoslaw Zarzynski --- diff --git a/src/crimson/mon/MonClient.cc b/src/crimson/mon/MonClient.cc index aee0c5170190..263228c1571c 100644 --- a/src/crimson/mon/MonClient.cc +++ b/src/crimson/mon/MonClient.cc @@ -165,8 +165,10 @@ seastar::future<> Connection::renew_rotating_keyring() logger().info("renew_rotating_keyring renewing rotating keys " " (they expired before {})", cutoff); } - if (now - last_rotating_renew_sent < std::chrono::seconds{1}) { - logger().info("renew_rotating_keyring called too often"); + if ((now > last_rotating_renew_sent) && + (now - last_rotating_renew_sent < std::chrono::seconds{1})) { + logger().info("renew_rotating_keyring called too often (last: {})", + utime_t{last_rotating_renew_sent}); return seastar::now(); } last_rotating_renew_sent = now;