]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: don't purge strays when mds is in clientreplay state 13095/head
authorYan, Zheng <zyan@redhat.com>
Wed, 25 Jan 2017 07:28:23 +0000 (15:28 +0800)
committerYan, Zheng <zyan@redhat.com>
Wed, 25 Jan 2017 07:48:16 +0000 (15:48 +0800)
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>
src/mds/MDCache.h
src/mds/MDSRank.cc
src/mds/StrayManager.cc
src/mds/StrayManager.h

index a9c41193478a79f48c2aeb528d9f8788445333cf..2b96af9a2f470e11d28948cde303f9cde30bd361 100644 (file)
@@ -146,6 +146,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 d1127fdeafd7aa97ccde3a75bc0cca97dbb68aea..36c0947d98b95b29a8ad253ba38d344f9ea76583 100644 (file)
@@ -1285,6 +1285,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 34d733691d5acf091ff84bcbe37ea4e90df0b73b..f62c73dab49176f80d176551dd9588d3d2ad2c2e 100644 (file)
@@ -433,6 +433,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;
@@ -732,6 +737,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
@@ -838,7 +850,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 7c9f04e7b1eb7fa9eeec72adf4bf0fa2dd26038c..892890b1644708984269ffc7bc28bbd1391d7977 100644 (file)
@@ -55,6 +55,8 @@ class StrayManager
   MDSRank *mds;
   PerfCounters *logger;
 
+  bool started;
+
   // Throttled allowances
   uint64_t ops_in_flight;
   uint64_t files_purging;
@@ -168,6 +170,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);