ret = true;
} else {
inc_dispatch_depth();
- ret = _dispatch(m);
+ ret = _dispatch(m, true);
dec_dispatch_depth();
}
mds_lock.Unlock();
/* 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();
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;
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);
}
virtual void finish(int r) {
mds->inc_dispatch_depth();
- mds->_dispatch(m);
+ mds->_dispatch(m, false);
mds->dec_dispatch_depth();
}
};