Skip to contentSkip to conversation

ceph: only send metrics when the MDS rank is ready

PATCH Superseded [email protected] 1 participant 1 message May 31, 2023 Ceph client

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ceph: only send metrics when the MDS rank is ready

From: Xiubo Li <[email protected]>

When the MDS rank is in clientreplay state these metrics requests will be discard directly. Especially when there are a lot of known client requests need to replay these useless metrics requests will slow down the MDS rank.

With this we will send the metrics requests only when the MDS rank is in active state.

URL: https://tracker.ceph.com/issues/61524

---
 fs/ceph/metric.c | 8 ++++++++
 1 file changed, 8 insertions(+)
fs/ceph/metric.c +8 -0
index c47347d2e84e..cce78d769f55 100644
@@ -36,6 +36,14 @@ static bool ceph_mdsc_send_metrics(struct ceph_mds_client *mdsc,
 	s32 items = 0;
 	s32 len;
 
+	/* Do not send the metrics until the MDS rank is ready */
+	mutex_lock(&mdsc->mutex);
+	if (ceph_mdsmap_get_state(mdsc->mdsmap, s->s_mds) != CEPH_MDS_STATE_ACTIVE) {
+		mutex_unlock(&mdsc->mutex);
+		return false;
+	}
+	mutex_unlock(&mdsc->mutex);
+
 	len = sizeof(*head) + sizeof(*cap) + sizeof(*read) + sizeof(*write)
 	      + sizeof(*meta) + sizeof(*dlease) + sizeof(*files)
 	      + sizeof(*icaps) + sizeof(*inodes) + sizeof(*rsize)
Signature · 1 line
2.40.1