From: Yan, Zheng Date: Wed, 11 Jul 2018 09:30:39 +0000 (+0800) Subject: mds: reset heartbeat map at potential time-consuming places X-Git-Tag: v12.2.9~99^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=98cce9d8360b43d23be921f4dd34cd8b06240fd5;p=ceph.git mds: reset heartbeat map at potential time-consuming places Signed-off-by: Yan, Zheng Fixes: http://tracker.ceph.com/issues/26858 (cherry picked from commit 5a6a9a3fdafa4d68d337e031dd2358215771be8f) Conflicts: src/mds/Migrator.cc src/mds/MDSRank.h --- diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index bdebfed5bf99..7f6f15b9a02b 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -1827,7 +1827,7 @@ void MDSRankDispatcher::handle_mds_map( list ls; ls.swap(p->second); waiting_for_mdsmap.erase(p++); - finish_contexts(g_ceph_context, ls); + queue_waiters(ls); } } diff --git a/src/mds/MDSRank.h b/src/mds/MDSRank.h index d26627e8e0c2..e524f99174a7 100644 --- a/src/mds/MDSRank.h +++ b/src/mds/MDSRank.h @@ -301,6 +301,10 @@ class MDSRank { finished_queue.splice( finished_queue.end(), ls ); progress_thread.signal(); } + void queue_waiters_front(std::list& ls) { + finished_queue.splice(finished_queue.begin(), ls); + progress_thread.signal(); + } MDSRank( mds_rank_t whoami_, diff --git a/src/mds/Migrator.cc b/src/mds/Migrator.cc index f58ec7fd7ef5..b66d12d1a74b 100644 --- a/src/mds/Migrator.cc +++ b/src/mds/Migrator.cc @@ -2606,6 +2606,15 @@ void Migrator::import_remove_pins(CDir *dir, set& bounds) } } +class C_MDC_QueueContexts : public MigratorContext { +public: + list 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 @@ -2633,7 +2642,7 @@ void Migrator::import_reverse(CDir *dir) cache->adjust_subtree_auth(dir, stat.peer); - C_ContextsBase *fin = new C_ContextsBase(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();