]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd/ops_executer: Fix usage of Message's connection 51312/head
authorMatan Breizman <mbreizma@redhat.com>
Tue, 2 May 2023 09:07:00 +0000 (09:07 +0000)
committerMatan Breizman <mbreizma@redhat.com>
Wed, 3 May 2023 09:12:27 +0000 (09:12 +0000)
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 <mbreizma@redhat.com>
src/crimson/osd/ops_executer.h
src/crimson/osd/pg.h

index 697adffdb2184f92a039ce47ff23cb66498dbb07..97e0bbda856d7f2ca0657e28d256ce0085ffe682 100644 (file)
@@ -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 ImplT>
   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<ExecutableMessagePimpl<MsgT>>{},
-          &msg},
+          &msg,
+          conn},
         conn,
         snapc) {
   }
index 46a08c6202942582e9dbfbea3e3cec163e8662aa..d7720707d8692b003549d26dc89e9a38b57a0d08 100644 (file)
@@ -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;