From cba35e6fbd03f82f03e0a9ec18569141f4e1d98e Mon Sep 17 00:00:00 2001 From: Xiubo Li Date: Tue, 31 Oct 2023 10:23:09 +0800 Subject: [PATCH] mds,client: update the oldest_client_tid via the renew 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. Fixes: https://tracker.ceph.com/issues/63364 Signed-off-by: Xiubo Li (cherry picked from commit 0cff6d5d487972a850e7c64b1e3b8ca283bf3c03) --- src/client/Client.cc | 4 +++- src/mds/Server.cc | 1 + src/messages/MClientSession.h | 7 ++++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/client/Client.cc b/src/client/Client.cc index db343c44cd648..0fc532f79c108 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -7223,7 +7223,9 @@ void Client::renew_caps(MetaSession *session) ldout(cct, 10) << "renew_caps mds." << session->mds_num << dendl; session->last_cap_renew_request = ceph_clock_now(); uint64_t seq = ++session->cap_renew_seq; - session->con->send_message2(make_message(CEPH_SESSION_REQUEST_RENEWCAPS, seq)); + auto m = make_message(CEPH_SESSION_REQUEST_RENEWCAPS, seq); + m->oldest_client_tid = oldest_tid; + session->con->send_message2(std::move(m)); } diff --git a/src/mds/Server.cc b/src/mds/Server.cc index 27891d0c09373..fcd351bebfd66 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -789,6 +789,7 @@ void Server::handle_client_session(const cref_t &m) mds->locker->resume_stale_caps(session); mds->sessionmap.touch_session(session); } + trim_completed_request_list(m->oldest_client_tid, session); auto reply = make_message(CEPH_SESSION_RENEWCAPS, m->get_seq()); mds->send_message_client(reply, session); } else { diff --git a/src/messages/MClientSession.h b/src/messages/MClientSession.h index 8f6e47acf1dfc..37b3fc1d0629e 100644 --- a/src/messages/MClientSession.h +++ b/src/messages/MClientSession.h @@ -21,7 +21,7 @@ class MClientSession final : public SafeMessage { private: - static constexpr int HEAD_VERSION = 6; + static constexpr int HEAD_VERSION = 7; static constexpr int COMPAT_VERSION = 1; public: @@ -33,6 +33,7 @@ public: feature_bitset_t supported_features; metric_spec_t metric_spec; std::vector cap_auths; + ceph_tid_t oldest_client_tid = UINT64_MAX; int get_op() const { return head.op; } version_t get_seq() const { return head.seq; } @@ -88,6 +89,9 @@ public: if (header.version >= 6) { decode(cap_auths, p); } + if (header.version >= 7) { + decode(oldest_client_tid, p); + } } void encode_payload(uint64_t features) override { using ceph::encode; @@ -104,6 +108,7 @@ public: encode(metric_spec, payload); encode(flags, payload); encode(cap_auths, payload); + encode(oldest_client_tid, payload); } } private: -- 2.39.5