mds: detect mds-mds messages not of type MMDSOp

* 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>
This commit is contained in:
Jos Collin 2020-10-15 17:00:50 +05:30
parent 18c1386f1d
commit 05b6cbe908
No known key found for this signature in database
GPG Key ID: 10DA18C384692C82
2 changed files with 15 additions and 8 deletions

View File

@ -78,10 +78,14 @@ void MetricAggregator::ms_fast_dispatch2(const ref_t<Message> &m) {
}
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;

View File

@ -34,13 +34,16 @@ bool MetricsHandler::ms_dispatch2(const ref_t<Message> &m) {
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;
}