]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix out-of-order messages 11939/head
authorYan, Zheng <zyan@redhat.com>
Mon, 30 Mar 2015 09:35:59 +0000 (17:35 +0800)
committerNathan Cutler <ncutler@suse.com>
Sat, 12 Nov 2016 12:21:47 +0000 (13:21 +0100)
When MDS is no longer laggy, it should process deferred messages
first, then process newly received messages.

Fix: #11258
Signed-off-by: Yan, Zheng <zyan@redhat.com>
(cherry picked from commit ccdeaf87df8b66e09f6b20950b57ac61bf213086)

src/mds/MDS.cc
src/mds/MDS.h

index 69d6be05a4953e64e2e4a0a55a25b5fcb6a54d6c..7716e2b4936c8b2b8e5730c980c32a8762fa70a3 100644 (file)
@@ -2445,7 +2445,7 @@ bool MDS::ms_dispatch(Message *m)
     ret = true;
   } else {
     inc_dispatch_depth();
-    ret = _dispatch(m);
+    ret = _dispatch(m, true);
     dec_dispatch_depth();
   }
   mds_lock.Unlock();
@@ -2674,7 +2674,7 @@ void MDS::_advance_queues()
 
 /* If this function returns true, it has put the message. If it returns false,
  * it has not put the message. */
-bool MDS::_dispatch(Message *m)
+bool MDS::_dispatch(Message *m, bool new_msg)
 {
   if (is_stale_message(m)) {
     m->put();
@@ -2686,6 +2686,9 @@ bool MDS::_dispatch(Message *m)
     if (beacon.is_laggy()) {
       dout(10) << " laggy, deferring " << *m << dendl;
       waiting_for_nolaggy.push_back(m);
+    } else if (new_msg && !waiting_for_nolaggy.empty()) {
+      dout(10) << " there are deferred messages, deferring " << *m << dendl;
+      waiting_for_nolaggy.push_back(m);
     } else {
       if (!handle_deferrable_message(m)) {
        dout(0) << "unrecognized message " << *m << dendl;
index 5da3a8b4697f5e430fb3befb2bf5d5dae3072914..460792c74710ae81363f0f45e1c1d96ff8c69284 100644 (file)
@@ -454,7 +454,7 @@ private:
   void dec_dispatch_depth() { --dispatch_depth; }
 
   // messages
-  bool _dispatch(Message *m);
+  bool _dispatch(Message *m, bool new_msg);
 
   protected:
   bool is_stale_message(Message *m);
@@ -488,7 +488,7 @@ public:
   }
   virtual void finish(int r) {
     mds->inc_dispatch_depth();
-    mds->_dispatch(m);
+    mds->_dispatch(m, false);
     mds->dec_dispatch_depth();
   }
 };