@@ -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+
23872393void 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