From e4b7f4563a8d122056b9a01dda4219a13ae87db8 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Thu, 25 Mar 2021 12:33:50 +0800 Subject: [PATCH] osd: handle MOSDPGInfo 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 --- src/osd/OSD.cc | 26 ++++++++++++++++++++++++++ src/osd/OSD.h | 2 ++ 2 files changed, 28 insertions(+) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 7175792bc2a..ba7fb98f02d 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -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(m)); case MSG_OSD_PG_NOTIFY: return handle_fast_pg_notify(static_cast(m)); + case MSG_OSD_PG_INFO: + return handle_fast_pg_info(static_cast(m)); case MSG_OSD_PG_REMOVE: return handle_fast_pg_remove(static_cast(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( + 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; diff --git a/src/osd/OSD.h b/src/osd/OSD.h index aed0523a2eb..846e43c10e7 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -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: -- 2.39.5