Skip to content

Commit f7c2f4f

Browse files
lxbszidryomov
authored andcommitted
ceph: only send metrics when the MDS rank is ready
When the MDS rank is in clientreplay state, the metrics requests will be discarded directly. Also, when there are a lot of known client requests to recover from, the metrics requests will slow down the MDS rank from getting to the active state sooner. With this patch, we will send the metrics requests only when the MDS rank is in active state. Link: https://tracker.ceph.com/issues/61524 Signed-off-by: Xiubo Li <xiubli@redhat.com> Reviewed-by: Milind Changire <mchangir@redhat.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
1 parent 6995e2d commit f7c2f4f

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

fs/ceph/metric.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ static bool ceph_mdsc_send_metrics(struct ceph_mds_client *mdsc,
3636
s32 items = 0;
3737
s32 len;
3838

39+
/* Do not send the metrics until the MDS rank is ready */
40+
mutex_lock(&mdsc->mutex);
41+
if (ceph_mdsmap_get_state(mdsc->mdsmap, s->s_mds) != CEPH_MDS_STATE_ACTIVE) {
42+
mutex_unlock(&mdsc->mutex);
43+
return false;
44+
}
45+
mutex_unlock(&mdsc->mutex);
46+
3947
len = sizeof(*head) + sizeof(*cap) + sizeof(*read) + sizeof(*write)
4048
+ sizeof(*meta) + sizeof(*dlease) + sizeof(*files)
4149
+ sizeof(*icaps) + sizeof(*inodes) + sizeof(*rsize)

0 commit comments

Comments
 (0)