From: Yan, Zheng Date: Mon, 30 Mar 2015 09:35:59 +0000 (+0800) Subject: mds: fix out-of-order messages X-Git-Tag: v0.94.10~54^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=2332cf22d23fd40ae238b98798e3290094548914;p=ceph.git mds: fix out-of-order messages When MDS is no longer laggy, it should process deferred messages first, then process newly received messages. Fix: #11258 Signed-off-by: Yan, Zheng (cherry picked from commit ccdeaf87df8b66e09f6b20950b57ac61bf213086) --- diff --git a/src/mds/MDS.cc b/src/mds/MDS.cc index 69d6be05a4953..7716e2b4936c8 100644 --- a/src/mds/MDS.cc +++ b/src/mds/MDS.cc @@ -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; diff --git a/src/mds/MDS.h b/src/mds/MDS.h index 5da3a8b4697f5..460792c74710a 100644 --- a/src/mds/MDS.h +++ b/src/mds/MDS.h @@ -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(); } };