ceph: update the oldest_client_tid via the renew caps
v2 cover ceph: update the oldest_client_tid via the renew caps
From: Xiubo Li <[email protected]>
V2:
- a minor fix about incorrect switching oldest_tid to le64 reported by kernel test robot <[email protected]>
Xiubo Li (2):
ceph: rename create_session_open_msg() to create_session_full_msg()
ceph: update the oldest_client_tid via the renew caps
fs/ceph/mds_client.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-)
Signature · 1 line
2.41.0
PATCH v2 1/2 ceph: rename create_session_open_msg() to create_session_full_msg()
From: Xiubo Li <[email protected]>
Makes the create session msg helper to be more general and could be used by other OPs.
URL: https://tracker.ceph.com/issues/63364
--- fs/ceph/mds_client.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
fs/ceph/mds_client.c +5 -3
@@ -1534,7 +1534,8 @@ static int encode_metric_spec(void **p, void *end)* session message, specialization for CEPH_SESSION_REQUEST_OPEN * to include additional client metadata fields. */ -static struct ceph_msg *create_session_open_msg (struct ceph_mds_client *mdsc,u64 seq) +static struct ceph_msg * +create_session_full_msg (struct ceph_mds_client *mdsc,int op,u64 seq) {struct ceph_msg *msg;struct ceph_mds_session_head *h;
@@ -1589,7 +1590,7 @@ static struct ceph_msg *create_session_open_msg(struct ceph_mds_client *mdsc, u6 end = p + msg->front.iov_len; h = p; - h->op =cpu_to_le32 (CEPH_SESSION_REQUEST_OPEN ); + h->op =cpu_to_le32 (op); h->seq =cpu_to_le64 (seq);/*
@@ -1663,7 +1664,8 @@ static int __open_session(struct ceph_mds_client *mdsc, session->s_renew_requested = jiffies;/* send connect message */ - msg =create_session_open_msg (mdsc, session->s_seq); + msg =create_session_full_msg (mdsc,CEPH_SESSION_REQUEST_OPEN , + session->s_seq);if (IS_ERR (msg))return PTR_ERR (msg);ceph_con_send (&session->s_con, msg);
Signature · 1 line
2.41.0
PATCH v2 2/2 ceph: update the oldest_client_tid via the renew caps
In reply to [email protected]From: Xiubo Li <[email protected]>
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.
URL: https://tracker.ceph.com/issues/63364
--- fs/ceph/mds_client.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-)
fs/ceph/mds_client.c +19 -5
@@ -1579,6 +1579,9 @@ create_session_full_msg(struct ceph_mds_client *mdsc, int op, u64 seq) size =METRIC_BYTES (count); extra_bytes +=2 +4 +4 + size; +/* flags, mds auth caps and oldest_client_tid */ + extra_bytes +=4 +4 +8 ; +/* Allocate the message */ msg =ceph_msg_new (CEPH_MSG_CLIENT_SESSION ,sizeof (*h) + extra_bytes,GFP_NOFS , false);
@@ -1597,9 +1600,9 @@ create_session_full_msg(struct ceph_mds_client *mdsc, int op, u64 seq)* Serialize client metadata into waiting buffer space, using * the format that userspace expects for map<string, string> * -* ClientSession messages with metadata are v4 +* ClientSession messages with metadata are v7 */ - msg->hdr.version =cpu_to_le16 (4 ); + msg->hdr.version =cpu_to_le16 (7 ); msg->hdr.compat_version =cpu_to_le16 (1 );/* 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)return ERR_PTR (ret); } +/* version == 5, flags */ +ceph_encode_32 (&p,0 ); + +/* version == 6, mds auth caps */ +ceph_encode_32 (&p,0 ); + +/* version == 7, oldest_client_tid */ +ceph_encode_64 (&p, mdsc->oldest_tid); + msg->front.iov_len = p - msg->front.iov_base; msg->hdr.front_len =cpu_to_le32 (msg->front.iov_len);
@@ -2030,10 +2042,12 @@ static int send_renew_caps(struct ceph_mds_client *mdsc,doutc (cl,"to mds%d (%s)\n" , session->s_mds,ceph_mds_state_name (state)); - msg =ceph_create_session_msg (CEPH_SESSION_REQUEST_RENEWCAPS , + +/* send connect message */ + msg =create_session_full_msg (mdsc,CEPH_SESSION_REQUEST_RENEWCAPS , ++session->s_renew_seq); -if (!msg) -return -ENOMEM ; +if (IS_ERR (msg)) +return PTR_ERR (msg);ceph_con_send (&session->s_con, msg);return 0 ; }
Signature · 1 line
2.41.0
Quoted 72 lines · On Fri, Nov 17, 2023 at 1:47 PM <[email protected]> wrote:
From: Xiubo Li <[email protected]>
Update the
oldest_client_tidvia the session renew caps msg to make sure that the MDSs won't pile up the completed request list in a very large size.URL: https://tracker.ceph.com/issues/63364
Signed-off-by Xiubo Li <[email protected]>--- fs/ceph/mds_client.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-)fs/ceph/mds_client.c +19
-6@@ -1579,6 +1579,9 @@ create_session_full_msg(struct ceph_mds_client *mdsc, int op, u64 seq) size =METRIC_BYTES (count); extra_bytes +=2 +4 +4 + size; +/* flags, mds auth caps and oldest_client_tid */ + extra_bytes +=4 +4 +8 ; +/* Allocate the message */ msg =ceph_msg_new (CEPH_MSG_CLIENT_SESSION ,sizeof (*h) + extra_bytes,GFP_NOFS , false);@@ -1597,9 +1600,9 @@ create_session_full_msg(struct ceph_mds_client *mdsc, int op, u64 seq)* Serialize client metadata into waiting buffer space, using * the format that userspace expects for map<string, string> * -* ClientSession messages with metadata are v4 +* ClientSession messages with metadata are v7 */ - msg->hdr.version =cpu_to_le16 (4 ); + msg->hdr.version =cpu_to_le16 (7 ); msg->hdr.compat_version =cpu_to_le16 (1 );/* 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)return ERR_PTR (ret); } +/* version == 5, flags */ +ceph_encode_32 (&p,0 ); + +/* version == 6, mds auth caps */ +ceph_encode_32 (&p,0 ); + +/* version == 7, oldest_client_tid */ +ceph_encode_64 (&p, mdsc->oldest_tid); + msg->front.iov_len = p - msg->front.iov_base; msg->hdr.front_len =cpu_to_le32 (msg->front.iov_len);@@ -2030,10 +2042,12 @@ static int send_renew_caps(struct ceph_mds_client *mdsc,doutc (cl,"to mds%d (%s)\n" , session->s_mds,ceph_mds_state_name (state)); - msg =ceph_create_session_msg (CEPH_SESSION_REQUEST_RENEWCAPS , + +/* send connect message */ + msg =create_session_full_msg (mdsc,CEPH_SESSION_REQUEST_RENEWCAPS , ++session->s_renew_seq); -if (!msg) -return -ENOMEM ; +if (IS_ERR (msg)) +return PTR_ERR (msg);ceph_con_send (&session->s_con, msg);return 0 ; } --
Quoted 2 lines
2.41.0
Signature · 2 lines
Cheers, Venky