]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mds: adjust subtree popularity when import fails
authorYan, Zheng <zyan@redhat.com>
Fri, 17 Nov 2017 01:22:04 +0000 (09:22 +0800)
committerYan, Zheng <zyan@redhat.com>
Tue, 10 Apr 2018 01:19:46 +0000 (09:19 +0800)
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
src/common/DecayCounter.h
src/mds/CDir.cc
src/mds/CDir.h
src/mds/Migrator.cc

index e45aed8d2f2a5f590859898a2928e7e188fdba7f..620db834f1fe97be65ee8a298d5a1c3f7e051aeb 100644 (file)
@@ -115,10 +115,12 @@ public:
 
   void adjust(double a) {
     val += a;
+    if (val < 0)
+      val = 0;
   }
   void adjust(utime_t now, const DecayRate& rate, double a) {
     decay(now, rate);
-    val += a;
+    adjust(a);
   }
   void scale(double f) {
     val *= f;
index 4e9ba084c96ba05936631adcf724ce4150ed1c85..48b10c8c4bbe9046810df145d8fdee6accb44ea2 100644 (file)
@@ -2562,7 +2562,20 @@ void CDir::decode_import(bufferlist::iterator& blp, utime_t now, LogSegment *ls)
   }
 }
 
+void CDir::abort_import(utime_t now)
+{
+  assert(is_auth());
+  state_clear(CDir::STATE_AUTH);
+  remove_bloom();
+  clear_replica_map();
+  set_replica_nonce(CDir::EXPORT_NONCE);
+  if (is_dirty())
+    mark_clean();
 
+  pop_auth_subtree_nested.sub(now, cache->decayrate, pop_auth_subtree);
+  pop_me.zero(now);
+  pop_auth_subtree.zero(now);
+}
 
 
 /********************************
index fab780d2fd4f02c0b5ecc7a89b247fb99a50f353..472845042fcb28c4b7a2e8830f5607dd07c6802a 100644 (file)
@@ -703,6 +703,7 @@ public:
     put(PIN_TEMPEXPORTING);
   }
   void decode_import(bufferlist::iterator& blp, utime_t now, LogSegment *ls);
+  void abort_import(utime_t now);
 
   // -- auth pins --
   bool can_auth_pin() const override { return is_auth() && !(is_frozen() || is_freezing()); }
index 1bd52948ae511133f7f6f150cc06939211942388..2ed79d2124f4dda73602fdddaf6baef46dd2eb1d 100644 (file)
@@ -2600,6 +2600,8 @@ void Migrator::import_reverse(CDir *dir)
   import_state_t& stat = import_state[dir->dirfrag()];
   stat.state = IMPORT_ABORTING;
 
+  utime_t now = ceph_clock_now();
+
   set<CDir*> bounds;
   cache->get_subtree_bounds(dir, bounds);
 
@@ -2630,13 +2632,7 @@ void Migrator::import_reverse(CDir *dir)
     q.pop_front();
     
     // dir
-    assert(cur->is_auth());
-    cur->state_clear(CDir::STATE_AUTH);
-    cur->remove_bloom();
-    cur->clear_replica_map();
-    cur->set_replica_nonce(CDir::EXPORT_NONCE);
-    if (cur->is_dirty())
-      cur->mark_clean();
+    cur->abort_import(now);
 
     for (auto &p : *cur) {
       CDentry *dn = p.second;