Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client: always refresh mds feature bits on session open #54030

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/client/Client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2384,6 +2384,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<MClientSession>& 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<MClientSession>& m)
{
mds_rank_t from = mds_rank_t(m->get_source().num());
Expand All @@ -2402,6 +2408,13 @@ void Client::handle_client_session(const MConstRef<MClientSession>& 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);
vshankar marked this conversation as resolved.
Show resolved Hide resolved
vshankar marked this conversation as resolved.
Show resolved Hide resolved
return;
}
/*
Expand All @@ -2411,8 +2424,7 @@ void Client::handle_client_session(const MConstRef<MClientSession>& 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);
cap_auths = std::move(m->cap_auths);

renew_caps(session.get());
Expand Down