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: v13.2.3~114^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=63929455948b7d560fa738d8b3f4e8525243687e;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 93a0f4839f2..521d4f54042 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -1908,7 +1908,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 60a624bebf8..2199908cbc3 100644 --- a/src/mds/MDSRank.h +++ b/src/mds/MDSRank.h @@ -305,6 +305,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 6877c79a2db..a6977f66ff9 100644 --- a/src/mds/Migrator.cc +++ b/src/mds/Migrator.cc @@ -2596,6 +2596,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 @@ -2625,7 +2634,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(); diff --git a/src/mds/OpenFileTable.cc b/src/mds/OpenFileTable.cc index 2e3e2faa590..9d33fc965e7 100644 --- a/src/mds/OpenFileTable.cc +++ b/src/mds/OpenFileTable.cc @@ -1045,10 +1045,14 @@ void OpenFileTable::_prefetch_dirfrags() } MDSGatherBuilder gather(g_ceph_context); + int num_opening_dirfrags = 0; for (auto dir : fetch_queue) { if (dir->state_test(CDir::STATE_REJOINUNDEF)) assert(dir->get_inode()->dirfragtree.is_leaf(dir->get_frag())); dir->fetch(gather.new_sub()); + + if (!(++num_opening_dirfrags % 1000)) + mds->heartbeat_reset(); } auto finish_func = [this](int r) { @@ -1111,6 +1115,9 @@ void OpenFileTable::_prefetch_inodes() num_opening_inodes++; mdcache->open_ino(it.first, pool, new C_OFT_OpenInoFinish(this, it.first), false); + + if (!(num_opening_inodes % 1000)) + mds->heartbeat_reset(); } _open_ino_finish(inodeno_t(0), 0);