]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: don't purge strays when mds is in clientreplay state 14668/head
authorYan, Zheng <zyan@redhat.com>
Wed, 25 Jan 2017 07:28:23 +0000 (15:28 +0800)
committerNathan Cutler <ncutler@suse.com>
Thu, 20 Apr 2017 10:46:57 +0000 (12:46 +0200)
MDS does not trim log when it's in clientreplay state. If mds hang
at clientreplay state (due to bug), purging strays can submit lots
of log events and create very large mds log.

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
(cherry picked from commit 86bbc7fff02668077f27d0924ba3efe6544b77f6)

src/mds/MDCache.h
src/mds/MDSRank.cc
src/mds/StrayManager.cc
src/mds/StrayManager.h

index 62a60e61f7964d1c6cae4237f0f2aa858c91b5c9..a7dc424d6214a759cad49a104d9e67bb9626b632 100644 (file)
@@ -147,6 +147,10 @@ public:
     stray_index = (stray_index+1)%NUM_STRAY;
   }
 
+  void activate_stray_manager() {
+    stray_manager.activate();
+  }
+
   /**
    * Call this when you know that a CDentry is ready to be passed
    * on to StrayManager (i.e. this is a stray you've just created)
index 728af772bae6a6cd5710b25aa6d4cc7f1bfe5dfb..318d5f6611e651b6c3e720e338c9f91ec649071e 100644 (file)
@@ -1268,6 +1268,7 @@ void MDSRank::active_start()
   mdcache->start_files_to_recover();
 
   mdcache->reissue_all_caps();
+  mdcache->activate_stray_manager();
 
   finish_contexts(g_ceph_context, waiting_for_active);  // kick waiters
 }
index 38e7f11b1e248db5e66642f4ea689b19fcb38a73..c897fc582ec0ccebce6d5f0ca51da895d21355d4 100644 (file)
@@ -384,6 +384,11 @@ bool StrayManager::_consume(CDentry *dn, bool trunc, uint32_t ops_required)
 {
   const int files_avail = g_conf->mds_max_purge_files - files_purging;
 
+  if (!started) {
+    dout(20) << __func__ << ": haven't started purging yet" << dendl;
+    return false;
+  }
+
   if (files_avail <= 0) {
     dout(20) << __func__ << ": throttling on max files" << dendl;
     return false;
@@ -651,6 +656,13 @@ bool StrayManager::__eval_stray(CDentry *dn, bool delay)
   }
 }
 
+void StrayManager::activate()
+{
+  dout(10) << __func__ << dendl;
+  started = true;
+  _advance();
+}
+
 bool StrayManager::eval_stray(CDentry *dn, bool delay)
 {
   // avoid nested eval_stray
@@ -756,7 +768,7 @@ void StrayManager::migrate_stray(CDentry *dn, mds_rank_t to)
 
 StrayManager::StrayManager(MDSRank *mds)
   : delayed_eval_stray(member_offset(CDentry, item_stray)),
-    mds(mds), logger(NULL),
+    mds(mds), logger(NULL), started(false),
     ops_in_flight(0), files_purging(0),
     max_purge_ops(0), 
     num_strays(0), num_strays_purging(0), num_strays_delayed(0),
index 3576889ef892fb67e111fa0570a65c8ae4f30643..f0e9d13ce2f8ee38ceb782ea537387a3502e01de 100644 (file)
@@ -45,6 +45,8 @@ class StrayManager
   MDSRank *mds;
   PerfCounters *logger;
 
+  bool started;
+
   // Throttled allowances
   uint64_t ops_in_flight;
   uint64_t files_purging;
@@ -152,6 +154,7 @@ class StrayManager
   public:
   explicit StrayManager(MDSRank *mds);
   void set_logger(PerfCounters *l) {logger = l;}
+  void activate();
 
   bool eval_stray(CDentry *dn, bool delay=false);