From d569703a5f35a48ef042d61702eaa86a6e2d48bd Mon Sep 17 00:00:00 2001 From: Matan Breizman Date: Tue, 2 May 2023 09:07:00 +0000 Subject: [PATCH] crimson/osd/ops_executer: Fix usage of Message's connection See #50835. In crimson, conn is independently maintained outside Message. Therefore, when trying to use the message's connection for `get_orig_source_inst()` we won't be able to get the peer address. Fixes: https://tracker.ceph.com/issues/59589 Signed-off-by: Matan Breizman --- src/crimson/osd/ops_executer.h | 19 ++++++++++++++++--- src/crimson/osd/pg.h | 5 +++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/crimson/osd/ops_executer.h b/src/crimson/osd/ops_executer.h index 697adffdb21..97e0bbda856 100644 --- a/src/crimson/osd/ops_executer.h +++ b/src/crimson/osd/ops_executer.h @@ -106,14 +106,20 @@ public: virtual entity_inst_t get_orig_source_inst() const = 0; virtual uint64_t get_features() const = 0; virtual bool has_flag(uint32_t flag) const = 0; + virtual entity_name_t get_source() const = 0; }; template class ExecutableMessagePimpl final : ExecutableMessage { const ImplT* pimpl; + // In crimson, conn is independently maintained outside Message. + const crimson::net::ConnectionRef conn; public: - ExecutableMessagePimpl(const ImplT* pimpl) : pimpl(pimpl) { + ExecutableMessagePimpl(const ImplT* pimpl, + const crimson::net::ConnectionRef conn) + : pimpl(pimpl), conn(conn) { } + osd_reqid_t get_reqid() const final { return pimpl->get_reqid(); } @@ -127,7 +133,13 @@ public: return pimpl->get_map_epoch(); } entity_inst_t get_orig_source_inst() const final { - return pimpl->get_orig_source_inst(); + // We can't get the origin source address from the message + // since (In Crimson) the connection is maintained + // outside of the Message. + return entity_inst_t(get_source(), conn->get_peer_addr()); + } + entity_name_t get_source() const final { + return pimpl->get_source(); } uint64_t get_features() const final { return pimpl->get_features(); @@ -377,7 +389,8 @@ public: op_info, abstracted_msg_t{ std::in_place_type_t>{}, - &msg}, + &msg, + conn}, conn, snapc) { } diff --git a/src/crimson/osd/pg.h b/src/crimson/osd/pg.h index 46a08c62029..d7720707d86 100644 --- a/src/crimson/osd/pg.h +++ b/src/crimson/osd/pg.h @@ -784,6 +784,11 @@ struct PG::do_osd_ops_params_t { return false; } + // Only used by ExecutableMessagePimpl + entity_name_t get_source() const { + return orig_source_inst.name; + } + crimson::net::ConnectionRef &conn; osd_reqid_t reqid; utime_t mtime; -- 2.39.5