From 997b917c84ec0b3068fd408b160e7a68c3bee838 Mon Sep 17 00:00:00 2001 From: Venky Shankar Date: Mon, 16 Oct 2023 00:11:19 -0400 Subject: [PATCH] client: always refresh mds feature bits on session open Fixes: http://tracker.ceph.com/issues/63188 Signed-off-by: Venky Shankar (cherry picked from commit 167fdd22e38d9febef8d7e0969403261314e3c98) Conflicts: src/client/Client.cc Minor conflict due to presence of cap_auths = std::move(m->cap_auths); --- src/client/Client.cc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/client/Client.cc b/src/client/Client.cc index 823e97f159433..ad1ebeba91d30 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -2379,6 +2379,12 @@ void Client::_closed_mds_session(MetaSession *s, int err, bool rejected) mds_sessions.erase(s->mds_num); } +static void reinit_mds_features(MetaSession *session, + const MConstRef& m) { + session->mds_features = std::move(m->supported_features); + session->mds_metric_flags = std::move(m->metric_spec.metric_flags); +} + void Client::handle_client_session(const MConstRef& m) { mds_rank_t from = mds_rank_t(m->get_source().num()); @@ -2397,6 +2403,13 @@ void Client::handle_client_session(const MConstRef& m) if (session->state == MetaSession::STATE_OPEN) { ldout(cct, 10) << "mds." << from << " already opened, ignore it" << dendl; + // The MDS could send a client_session(open) message even when + // the session state is STATE_OPEN. Normally, its fine to + // ignore this message, but, if the MDS sent this message just + // after it got upgraded, the MDS feature bits could differ + // than the one before the upgrade - so, refresh the feature + // bits the client holds. + reinit_mds_features(session.get(), m); return; } /* @@ -2406,8 +2419,7 @@ void Client::handle_client_session(const MConstRef& m) if (!session->seq && m->get_seq()) session->seq = m->get_seq(); - session->mds_features = std::move(m->supported_features); - session->mds_metric_flags = std::move(m->metric_spec.metric_flags); + reinit_mds_features(session.get(), m); renew_caps(session.get()); session->state = MetaSession::STATE_OPEN; -- 2.39.5