]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: always refresh mds feature bits on session open 54245/head
authorVenky Shankar <vshankar@redhat.com>
Mon, 16 Oct 2023 04:11:19 +0000 (00:11 -0400)
committerVenky Shankar <vshankar@redhat.com>
Thu, 9 Nov 2023 05:06:34 +0000 (10:36 +0530)
Fixes: http://tracker.ceph.com/issues/63188
Signed-off-by: Venky Shankar <vshankar@redhat.com>
(cherry picked from commit 167fdd22e38d9febef8d7e0969403261314e3c98)

 Conflicts:
src/client/Client.cc

In pacific, the client would close the mds session if it has missing
features - adjust the code due to that. Also adjust for `session`
variable in Client::handle_client_session() as in pacific its of
type MetaSession* rather than MetaSesssionRef.

src/client/Client.cc

index 1944e6081a03e787e4708675f7abc4c9205c55f0..70d5aec73978fd4e214c1ec6d6682e2e6b2a21b0 100644 (file)
@@ -2322,6 +2322,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());
@@ -2340,6 +2346,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, m);
         return;
       }
       /*
@@ -2358,8 +2371,7 @@ void Client::handle_client_session(const MConstRef<MClientSession>& m)
        _closed_mds_session(session, -CEPHFS_EPERM, true);
        break;
       }
-      session->mds_features = std::move(m->supported_features);
-      session->mds_metric_flags = std::move(m->metric_spec.metric_flags);
+      reinit_mds_features(session, m);
 
       renew_caps(session);
       session->state = MetaSession::STATE_OPEN;