]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: reset heartbeat map at potential time-consuming places
authorYan, Zheng <zyan@redhat.com>
Wed, 11 Jul 2018 09:30:39 +0000 (17:30 +0800)
committerYan, Zheng <zyan@redhat.com>
Thu, 6 Sep 2018 06:38:04 +0000 (14:38 +0800)
Signed-off-by: Yan, Zheng <zyan@redhat.com>
Fixes: http://tracker.ceph.com/issues/26858
(cherry picked from commit 5a6a9a3fdafa4d68d337e031dd2358215771be8f)

 Conflicts:
src/mds/Migrator.cc
src/mds/MDSRank.h

src/mds/MDSRank.cc
src/mds/MDSRank.h
src/mds/Migrator.cc
src/mds/OpenFileTable.cc

index 93a0f4839f29af3e398682bfdc7330eb6fdfa28c..521d4f54042155e9fa4e487d62e3ac25f4bf7eed 100644 (file)
@@ -1908,7 +1908,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);
     }
   }
 
index 60a624bebf86e9867b7f3df60d636a9e3ac7272d..2199908cbc3cf777f8a2315f5409b6aea91ad7bf 100644 (file)
@@ -305,6 +305,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_,
index 6877c79a2dbdaf13d20222ebcd83b97c0f027615..a6977f66ff949463ed248a07e7971ff63c39206e 100644 (file)
@@ -2596,6 +2596,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
@@ -2625,7 +2634,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();
index 2e3e2faa590c58e8344611827c43e8f7c4dc57d8..9d33fc965e7ade3cc9b2f44b8c6d072a525c9b66 100644 (file)
@@ -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);