]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: handle MOSDPGInfo 40394/head
authorKefu Chai <kchai@redhat.com>
Thu, 25 Mar 2021 04:33:50 +0000 (12:33 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 25 Mar 2021 04:52:04 +0000 (12:52 +0800)
this change partially reverts b37e959238e75690d38873744515fa54413f4393,
which introduced a regression where we fail to handle MOSDPGInfo
messages sent by osd before aba13c7661bf8a62f2879513512053dc9857c003
and/or f7130db7a9fa85e475f14e4feed0097bf2d0b964.

Fixes: https://tracker.ceph.com/issues/49963
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/osd/OSD.cc
src/osd/OSD.h

index 7175792bc2a159c3040abbdfd008379f7559f605..ba7fb98f02da6d2ec63c7efade316a88d5a03b10 100644 (file)
@@ -95,6 +95,7 @@
 #include "messages/MOSDPGQuery2.h"
 #include "messages/MOSDPGLog.h"
 #include "messages/MOSDPGRemove.h"
+#include "messages/MOSDPGInfo.h"
 #include "messages/MOSDPGInfo2.h"
 #include "messages/MOSDPGCreate.h"
 #include "messages/MOSDPGCreate2.h"
@@ -7140,6 +7141,8 @@ void OSD::ms_fast_dispatch(Message *m)
     return handle_fast_pg_create(static_cast<MOSDPGCreate2*>(m));
   case MSG_OSD_PG_NOTIFY:
     return handle_fast_pg_notify(static_cast<MOSDPGNotify*>(m));
+  case MSG_OSD_PG_INFO:
+    return handle_fast_pg_info(static_cast<MOSDPGInfo*>(m));
   case MSG_OSD_PG_REMOVE:
     return handle_fast_pg_remove(static_cast<MOSDPGRemove*>(m));
     // these are single-pg messages that handle themselves
@@ -9376,6 +9379,29 @@ void OSD::handle_fast_pg_notify(MOSDPGNotify* m)
   m->put();
 }
 
+void OSD::handle_fast_pg_info(MOSDPGInfo* m)
+{
+  dout(7) << __func__ << " " << *m << " from " << m->get_source() << dendl;
+  if (!require_osd_peer(m)) {
+    m->put();
+    return;
+  }
+  int from = m->get_source().num();
+  for (auto& p : m->pg_list) {
+    enqueue_peering_evt(
+      spg_t(p.info.pgid.pgid, p.to),
+      PGPeeringEventRef(
+       std::make_shared<PGPeeringEvent>(
+         p.epoch_sent, p.query_epoch,
+         MInfoRec(
+           pg_shard_t(from, p.from),
+           p.info,
+           p.epoch_sent)))
+      );
+  }
+  m->put();
+}
+
 void OSD::handle_fast_pg_remove(MOSDPGRemove *m)
 {
   dout(7) << __func__ << " " << *m << " from " << m->get_source() << dendl;
index aed0523a2eb87ab70a9728fd3646df9032c253b6..846e43c10e7b91ddd6a5f572198b6c6c9e7a6349 100644 (file)
@@ -86,6 +86,7 @@ class LogChannel;
 
 class MOSDPGCreate2;
 class MOSDPGNotify;
+class MOSDPGInfo;
 class MOSDPGRemove;
 class MOSDForceRecovery;
 class MMonGetPurgedSnapsReply;
@@ -1919,6 +1920,7 @@ protected:
   void handle_pg_query_nopg(const MQuery& q);
   void handle_fast_pg_notify(MOSDPGNotify *m);
   void handle_pg_notify_nopg(const MNotifyRec& q);
+  void handle_fast_pg_info(MOSDPGInfo *m);
   void handle_fast_pg_remove(MOSDPGRemove *m);
 
 public: