]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: evict clients that lack required features
authorYan, Zheng <zyan@redhat.com>
Wed, 27 Jun 2018 08:34:37 +0000 (16:34 +0800)
committerYan, Zheng <zyan@redhat.com>
Tue, 17 Jul 2018 01:24:32 +0000 (09:24 +0800)
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
(cherry picked from commit 4414f4e20df9567335b57a01f301470929628be7)

src/mds/Server.cc

index def2f084f1ceec609c2ab30bb8a5155e5f65f88a..5b77452f8bb88a3601e1cad1ed9079934d3e152a 100644 (file)
@@ -1136,6 +1136,30 @@ void Server::update_required_client_features()
 
   std::sort(bits.begin(), bits.end());
   required_client_features = feature_bitset_t(bits);
+  dout(7) << "required_client_features: " << required_client_features << dendl;
+
+  if (mds->get_state() >= MDSMap::STATE_RECONNECT) {
+    set<Session*> sessions;
+    mds->sessionmap.get_client_session_set(sessions);
+    for (auto session : sessions) {
+      feature_bitset_t missing_features = required_client_features;
+      missing_features -= session->info.client_metadata.features;
+      if (!missing_features.empty()) {
+       bool blacklisted = mds->objecter->with_osdmap(
+           [session](const OSDMap &osd_map) -> bool {
+             return osd_map.is_blacklisted(session->info.inst.addr);
+           });
+       if (blacklisted)
+         continue;
+
+       mds->clog->warn() << "evicting session " << *session << ", missing required features '"
+                         << missing_features << "'";
+       std::stringstream ss;
+       mds->evict_client(session->get_client().v, false,
+                         g_conf->mds_session_blacklist_on_evict, ss);
+      }
+    }
+  }
 }
 
 void Server::reconnect_gather_finish()