Skip to content

Commit

Permalink
Merge pull request #23507 from ukernel/luminous-26858
Browse files Browse the repository at this point in the history
luminous: mds: reset heartbeat map at potential time-consuming places

Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
  • Loading branch information
yuriw committed Sep 17, 2018
2 parents 7180037 + 5bf6312 commit 786e77e
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/mds/MDSRank.cc
Expand Up @@ -1020,6 +1020,11 @@ utime_t MDSRank::get_laggy_until() const
return beacon.get_laggy_until();
}

double MDSRank::get_dispatch_queue_max_age(utime_t now) const
{
return messenger->get_dispatch_queue_max_age(now);
}

bool MDSRank::is_daemon_stopping() const
{
return stopping;
Expand Down Expand Up @@ -1827,7 +1832,7 @@ void MDSRankDispatcher::handle_mds_map(
list<MDSInternalContextBase*> ls;
ls.swap(p->second);
waiting_for_mdsmap.erase(p++);
finish_contexts(g_ceph_context, ls);
queue_waiters(ls);
}
}

Expand Down
5 changes: 5 additions & 0 deletions src/mds/MDSRank.h
Expand Up @@ -301,6 +301,10 @@ class MDSRank {
finished_queue.splice( finished_queue.end(), ls );
progress_thread.signal();
}
void queue_waiters_front(std::list<MDSInternalContextBase*>& ls) {
finished_queue.splice(finished_queue.begin(), ls);
progress_thread.signal();
}

MDSRank(
mds_rank_t whoami_,
Expand Down Expand Up @@ -355,6 +359,7 @@ class MDSRank {
void damaged_unlocked();

utime_t get_laggy_until() const;
double get_dispatch_queue_max_age(utime_t now) const;

void send_message_mds(Message *m, mds_rank_t mds);
void forward_message_mds(Message *req, mds_rank_t mds);
Expand Down
11 changes: 10 additions & 1 deletion src/mds/Migrator.cc
Expand Up @@ -2606,6 +2606,15 @@ void Migrator::import_remove_pins(CDir *dir, set<CDir*>& bounds)
}
}

class C_MDC_QueueContexts : public MigratorContext {
public:
list<MDSInternalContextBase*> contexts;
C_MDC_QueueContexts(Migrator *m) : MigratorContext(m) {}
void finish(int r) override {
// execute contexts immediately after 'this' context
get_mds()->queue_waiters_front(contexts);
}
};

/*
* note: this does teh full work of reversing and import and cleaning up
Expand Down Expand Up @@ -2633,7 +2642,7 @@ void Migrator::import_reverse(CDir *dir)

cache->adjust_subtree_auth(dir, stat.peer);

C_ContextsBase<MDSInternalContextBase, MDSInternalContextGather> *fin = new C_ContextsBase<MDSInternalContextBase, MDSInternalContextGather>(g_ceph_context);
auto fin = new C_MDC_QueueContexts(this);
if (!dir->get_inode()->is_auth() &&
!dir->get_inode()->has_subtree_root_dirfrag(mds->get_nodeid())) {
dir->get_inode()->clear_scatter_dirty();
Expand Down
4 changes: 4 additions & 0 deletions src/mds/Server.cc
Expand Up @@ -707,7 +707,10 @@ void Server::find_idle_sessions()
// timeout/stale
// (caps go stale, lease die)
utime_t now = ceph_clock_now();
double queue_max_age = mds->get_dispatch_queue_max_age(now);

utime_t cutoff = now;
cutoff -= queue_max_age;
cutoff -= g_conf->mds_session_timeout;
while (1) {
Session *session = mds->sessionmap.get_oldest_session(Session::STATE_OPEN);
Expand All @@ -729,6 +732,7 @@ void Server::find_idle_sessions()

// autoclose
cutoff = now;
cutoff -= queue_max_age;
cutoff -= g_conf->mds_session_autoclose;

// don't kick clients if we've been laggy
Expand Down

0 comments on commit 786e77e

Please sign in to comment.