From: Cory Snyder Date: Thu, 3 Feb 2022 19:48:05 +0000 (-0500) Subject: rgw: fix segfault in OpsLogRados::log when realm is reloaded X-Git-Tag: v18.0.0~1437^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F44893%2Fhead;p=ceph.git rgw: fix segfault in OpsLogRados::log when realm is reloaded We weren't previously handling the deallocation of the store when a realm was reloaded. Now passing a const reference to the pointer. Fixes: https://tracker.ceph.com/issues/54130 Signed-off-by: Cory Snyder --- diff --git a/src/rgw/rgw_log.cc b/src/rgw/rgw_log.cc index 4214708ef156..bd2c360655cf 100644 --- a/src/rgw/rgw_log.cc +++ b/src/rgw/rgw_log.cc @@ -472,7 +472,7 @@ int OpsLogSocket::log_json(struct req_state* s, bufferlist& bl) return 0; } -OpsLogRados::OpsLogRados(rgw::sal::Store* store): store(store) +OpsLogRados::OpsLogRados(rgw::sal::Store* const& store): store(store) { } diff --git a/src/rgw/rgw_log.h b/src/rgw/rgw_log.h index a087aa130980..3495ef086290 100644 --- a/src/rgw/rgw_log.h +++ b/src/rgw/rgw_log.h @@ -199,9 +199,11 @@ public: }; class OpsLogRados : public OpsLogSink { - rgw::sal::Store* store; + // main()'s Store pointer as a reference, possibly modified by RGWRealmReloader + rgw::sal::Store* const& store; + public: - OpsLogRados(rgw::sal::Store* store); + OpsLogRados(rgw::sal::Store* const& store); int log(struct req_state* s, struct rgw_log_entry& entry) override; };