From bce34dd68634d241b451111dcf2e931837eb4bfd Mon Sep 17 00:00:00 2001 From: Cory Snyder Date: Tue, 5 Oct 2021 19:07:11 +0000 Subject: [PATCH] rgw/rgw_rados: make RGW request IDs non-deterministic Use a random number vs. incremental counter for first component of request ID. Fixes: https://tracker.ceph.com/issues/52818 Signed-off-by: Cory Snyder --- src/rgw/rgw_rados.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index 26b603b128b01..cb96b9dbb2e59 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -9,6 +9,7 @@ #include "include/rados/librados.hpp" #include "include/Context.h" +#include "include/random.h" #include "common/RefCountedObj.h" #include "common/ceph_time.h" #include "common/Timer.h" @@ -355,7 +356,7 @@ class RGWRados int open_pool_ctx(const DoutPrefixProvider *dpp, const rgw_pool& pool, librados::IoCtx& io_ctx, bool mostly_omap); - std::atomic max_req_id = { 0 }; + ceph::mutex lock = ceph::make_mutex("rados_timer_lock"); SafeTimer *timer; @@ -506,7 +507,7 @@ public: } uint64_t get_new_req_id() { - return ++max_req_id; + return ceph::util::generate_random_number(); } librados::IoCtx* get_lc_pool_ctx() { -- 2.39.5