Skip to content

Commit 6df89bf

Browse files
lxbszidryomov
authored andcommitted
ceph: send oldest_client_tid when renewing caps
Update the oldest_client_tid via the session renew caps msg to make sure that the MDSs won't pile up the completed request list in a very large size. [ idryomov: drop inapplicable comment ] Link: https://tracker.ceph.com/issues/63364 Signed-off-by: Xiubo Li <xiubli@redhat.com> Reviewed-by: Ilya Dryomov <idryomov@gmail.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
1 parent 66207de commit 6df89bf

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

fs/ceph/mds_client.c

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1579,6 +1579,9 @@ create_session_full_msg(struct ceph_mds_client *mdsc, int op, u64 seq)
15791579
size = METRIC_BYTES(count);
15801580
extra_bytes += 2 + 4 + 4 + size;
15811581

1582+
/* flags, mds auth caps and oldest_client_tid */
1583+
extra_bytes += 4 + 4 + 8;
1584+
15821585
/* Allocate the message */
15831586
msg = ceph_msg_new(CEPH_MSG_CLIENT_SESSION, sizeof(*h) + extra_bytes,
15841587
GFP_NOFS, false);
@@ -1597,9 +1600,9 @@ create_session_full_msg(struct ceph_mds_client *mdsc, int op, u64 seq)
15971600
* Serialize client metadata into waiting buffer space, using
15981601
* the format that userspace expects for map<string, string>
15991602
*
1600-
* ClientSession messages with metadata are v4
1603+
* ClientSession messages with metadata are v7
16011604
*/
1602-
msg->hdr.version = cpu_to_le16(4);
1605+
msg->hdr.version = cpu_to_le16(7);
16031606
msg->hdr.compat_version = cpu_to_le16(1);
16041607

16051608
/* The write pointer, following the session_head structure */
@@ -1635,6 +1638,15 @@ create_session_full_msg(struct ceph_mds_client *mdsc, int op, u64 seq)
16351638
return ERR_PTR(ret);
16361639
}
16371640

1641+
/* version == 5, flags */
1642+
ceph_encode_32(&p, 0);
1643+
1644+
/* version == 6, mds auth caps */
1645+
ceph_encode_32(&p, 0);
1646+
1647+
/* version == 7, oldest_client_tid */
1648+
ceph_encode_64(&p, mdsc->oldest_tid);
1649+
16381650
msg->front.iov_len = p - msg->front.iov_base;
16391651
msg->hdr.front_len = cpu_to_le32(msg->front.iov_len);
16401652

@@ -2030,10 +2042,10 @@ static int send_renew_caps(struct ceph_mds_client *mdsc,
20302042

20312043
doutc(cl, "to mds%d (%s)\n", session->s_mds,
20322044
ceph_mds_state_name(state));
2033-
msg = ceph_create_session_msg(CEPH_SESSION_REQUEST_RENEWCAPS,
2045+
msg = create_session_full_msg(mdsc, CEPH_SESSION_REQUEST_RENEWCAPS,
20342046
++session->s_renew_seq);
2035-
if (!msg)
2036-
return -ENOMEM;
2047+
if (IS_ERR(msg))
2048+
return PTR_ERR(msg);
20372049
ceph_con_send(&session->s_con, msg);
20382050
return 0;
20392051
}

0 commit comments

Comments
 (0)