]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix out-of-order messages 4215/head
authorYan, Zheng <zyan@redhat.com>
Mon, 30 Mar 2015 09:35:59 +0000 (17:35 +0800)
committerYan, Zheng <zyan@redhat.com>
Mon, 30 Mar 2015 09:49:06 +0000 (17:49 +0800)
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>
src/mds/MDS.cc
src/mds/MDS.h

index 10308e668a97a37eb22aa1d66a739290f603f509..05a1af545f6e5c9f887965edd44d3b16ae04afe8 100644 (file)
@@ -2502,7 +2502,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();
@@ -2731,7 +2731,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();
@@ -2743,6 +2743,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 62adf193a292a25aad4c25f05acc0306ba293541..4820299d7bf0439259046616cddee187946f3914 100644 (file)
@@ -462,7 +462,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);
@@ -496,7 +496,7 @@ public:
   }
   virtual void finish(int r) {
     mds->inc_dispatch_depth();
-    mds->_dispatch(m);
+    mds->_dispatch(m, false);
     mds->dec_dispatch_depth();
   }
 };