mds: set laggy flag if dispatch takes too long

This prevents, e.g., tick() from coming in immediately after and
closing out client sessions after we chew through something particularly
slow.
This commit is contained in:
Sage Weil 2010-04-01 16:13:41 -07:00
parent ea035fea80
commit fdd5709afc

View File

@ -1271,6 +1271,8 @@ bool MDS::_dispatch(Message *m)
{
bool check_from = false;
utime_t req_start = g_clock.now();
#define ALLOW_MESSAGES_FROM(peers) \
do { \
if (m->get_connection() && (m->get_connection()->get_peer_type() & (peers)) == 0) { \
@ -1442,6 +1444,16 @@ do { \
}
}
utime_t duration = g_clock.now();
duration -= req_start;
if (duration > g_conf.mds_session_timeout / 2) {
dout(0) << " dispatch took " << duration << " > " << g_conf.mds_tick_interval
<< " seconds, setting laggy flag" << dendl;
laggy = true;
return true;
}
// hack: thrash exports
static utime_t start;
utime_t now = g_clock.now();