Skip to content

Commit c672d7a

Browse files
committed
Merge PR ceph#54030 into main
* refs/pull/54030/head: client: always refresh mds feature bits on session open Reviewed-by: Dhairya Parmar <[email protected]> Reviewed-by: Kotresh Hiremath Ravishankar <[email protected]> Reviewed-by: Milind Changire <[email protected]> Reviewed-by: Patrick Donnelly <[email protected]>
2 parents 75bd7e3 + 167fdd2 commit c672d7a

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/client/Client.cc

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2384,6 +2384,12 @@ void Client::_closed_mds_session(MetaSession *s, int err, bool rejected)
23842384
mds_sessions.erase(s->mds_num);
23852385
}
23862386

2387+
static void reinit_mds_features(MetaSession *session,
2388+
const MConstRef<MClientSession>& m) {
2389+
session->mds_features = std::move(m->supported_features);
2390+
session->mds_metric_flags = std::move(m->metric_spec.metric_flags);
2391+
}
2392+
23872393
void Client::handle_client_session(const MConstRef<MClientSession>& m)
23882394
{
23892395
mds_rank_t from = mds_rank_t(m->get_source().num());
@@ -2402,6 +2408,13 @@ void Client::handle_client_session(const MConstRef<MClientSession>& m)
24022408
if (session->state == MetaSession::STATE_OPEN) {
24032409
ldout(cct, 10) << "mds." << from << " already opened, ignore it"
24042410
<< dendl;
2411+
// The MDS could send a client_session(open) message even when
2412+
// the session state is STATE_OPEN. Normally, its fine to
2413+
// ignore this message, but, if the MDS sent this message just
2414+
// after it got upgraded, the MDS feature bits could differ
2415+
// than the one before the upgrade - so, refresh the feature
2416+
// bits the client holds.
2417+
reinit_mds_features(session.get(), m);
24052418
return;
24062419
}
24072420
/*
@@ -2411,8 +2424,7 @@ void Client::handle_client_session(const MConstRef<MClientSession>& m)
24112424
if (!session->seq && m->get_seq())
24122425
session->seq = m->get_seq();
24132426

2414-
session->mds_features = std::move(m->supported_features);
2415-
session->mds_metric_flags = std::move(m->metric_spec.metric_flags);
2427+
reinit_mds_features(session.get(), m);
24162428
cap_auths = std::move(m->cap_auths);
24172429

24182430
renew_caps(session.get());

0 commit comments

Comments
 (0)