]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mds: update osdmap epoch barrier on eviction
authorJohn Spray <john.spray@redhat.com>
Thu, 23 Feb 2017 16:04:20 +0000 (16:04 +0000)
committerJohn Spray <john.spray@redhat.com>
Tue, 23 May 2017 09:22:16 +0000 (05:22 -0400)
Signed-off-by: John Spray <john.spray@redhat.com>
src/mds/MDSRank.cc

index f828f863520a92243ec1621748c0074c3ed98277..2364715a3063b6589797e75e4d8bd8193414bc28 100644 (file)
@@ -2653,14 +2653,23 @@ bool MDSRankDispatcher::kill_session(int64_t session_id, bool wait, std::strings
     on_blacklist_done = &on_blacklist_inline;
   } else {
     on_blacklist_done = new FunctionContext([this, session_id](int r) {
-      Session *session = sessionmap.get_session(
-          entity_name_t(CEPH_ENTITY_TYPE_CLIENT, session_id));
-      if (session) {
-        server->kill_session(session, NULL);
-      } else {
-        dout(1) << "session " << session_id << " was removed while we waited "
-                   "for blacklist" << dendl;
-      }
+      objecter->wait_for_latest_osdmap(
+       new FunctionContext([this, session_id](int r) {
+            auto epoch = objecter->with_osdmap([](const OSDMap &o){
+                return o.get_epoch();
+                });
+
+            set_osd_epoch_barrier(epoch);
+
+            Session *session = sessionmap.get_session(
+                entity_name_t(CEPH_ENTITY_TYPE_CLIENT, session_id));
+            if (session) {
+              server->kill_session(session, NULL);
+            } else {
+              dout(1) << "session " << session_id << " was removed while we waited "
+                         "for blacklist" << dendl;
+            }
+          }));
     });
   }
 
@@ -2676,6 +2685,19 @@ bool MDSRankDispatcher::kill_session(int64_t session_id, bool wait, std::strings
       return false;
     }
 
+    // Wait for latest OSDMap so that we can learn the OSDMap epoch in
+    // which the blacklist happened
+    C_SaferCond on_latest_osdmap;
+    objecter->wait_for_latest_osdmap(&on_latest_osdmap);
+    mds_lock.Unlock();
+    on_latest_osdmap.wait();
+    mds_lock.Lock();
+    auto epoch = objecter->with_osdmap([](const OSDMap &o){
+        return o.get_epoch();
+        });
+
+    set_osd_epoch_barrier(epoch);
+
     // We dropped mds_lock, so check that session still exists
     session = sessionmap.get_session(entity_name_t(CEPH_ENTITY_TYPE_CLIENT,
           session_id));