* Detect mds-mds messages not of type MMDSOp.
* Return true from MetricAggregator::ms_dispatch2 only when the peer is an MDS and the metrics is handled.
Fixes: https://tracker.ceph.com/issues/46426
Signed-off-by: Jos Collin <jcollin@redhat.com>
}
bool MetricAggregator::ms_dispatch2(const ref_t<Message> &m) {
- if (m->get_type() == MSG_MDS_METRICS) {
- if (m->get_connection()->get_peer_type() == CEPH_ENTITY_TYPE_MDS) {
- handle_mds_metrics(ref_cast<MMDSMetrics>(m));
- }
+ if (m->get_type() == MSG_MDS_METRICS &&
+ m->get_connection()->get_peer_type() == CEPH_ENTITY_TYPE_MDS) {
+ const Message *msg = m.get();
+ const MMDSOp *op = dynamic_cast<const MMDSOp*>(msg);
+ if (!op)
+ dout(0) << typeid(*msg).name() << " is not an MMDSOp type" << dendl;
+ ceph_assert(op);
+ handle_mds_metrics(ref_cast<MMDSMetrics>(m));
return true;
}
return false;
m->get_connection()->get_peer_type() == CEPH_ENTITY_TYPE_CLIENT) {
handle_client_metrics(ref_cast<MClientMetrics>(m));
return true;
- }
- if (m->get_type() == MSG_MDS_PING &&
- m->get_connection()->get_peer_type() == CEPH_ENTITY_TYPE_MDS) {
+ } else if (m->get_type() == MSG_MDS_PING &&
+ m->get_connection()->get_peer_type() == CEPH_ENTITY_TYPE_MDS) {
+ const Message *msg = m.get();
+ const MMDSOp *op = dynamic_cast<const MMDSOp*>(msg);
+ if (!op)
+ dout(0) << typeid(*msg).name() << " is not an MMDSOp type" << dendl;
+ ceph_assert(op);
handle_mds_ping(ref_cast<MMDSPing>(m));
return true;
}
-
return false;
}