]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: remove stray dentry from delayed list when it's queued for purging
authorYan, Zheng <zyan@redhat.com>
Thu, 9 Apr 2015 12:12:08 +0000 (20:12 +0800)
committerYan, Zheng <zyan@redhat.com>
Tue, 21 Apr 2015 05:56:16 +0000 (13:56 +0800)
this avoids assert(!dn->state_test(CDentry::STATE_PURGING)) in
eval_stray() being triggered when processing the delayed list.

Signed-off-by: Yan, Zheng <zyan@redhat.com>
src/mds/StrayManager.cc

index e0e3a7ab89f80d9380e8d489af396a08b58a465d..3af6078a86193c5f32aa27e5458cfe695b69dd39 100644 (file)
@@ -85,11 +85,6 @@ void StrayManager::purge(CDentry *dn, uint32_t op_allowance)
   num_strays_purging++;
   logger->set(l_mdc_num_strays_purging, num_strays_purging);
 
-  if (dn->item_stray.is_on_list()) {
-    dn->item_stray.remove_myself();
-    num_strays_delayed--;
-    logger->set(l_mdc_num_strays_delayed, num_strays_delayed);
-  }
 
   // CHEAT.  there's no real need to journal our intent to purge, since
   // that is implicit in the dentry's presence and non-use in the stray
@@ -322,6 +317,12 @@ void StrayManager::enqueue(CDentry *dn, bool trunc)
   dn->get(CDentry::PIN_PURGING);
   in->state_set(CInode::STATE_PURGING);
 
+  if (dn->item_stray.is_on_list()) {
+    dn->item_stray.remove_myself();
+    num_strays_delayed--;
+    logger->set(l_mdc_num_strays_delayed, num_strays_delayed);
+  }
+
   /* We must clear this as soon as enqueuing it, to prevent the journal
    * expiry code from seeing a dirty parent and trying to write a backtrace */
   if (!trunc) {
@@ -581,10 +582,6 @@ bool StrayManager::eval_stray(CDentry *dn, bool delay)
       dout(20) << " caps | leases" << dendl;
       return false;  // wait
     }
-    if (dn->state_test(CDentry::STATE_PURGING)) {
-      dout(20) << " already purging" << dendl;
-      return false;  // already purging
-    }
     if (in->state_test(CInode::STATE_NEEDSRECOVER) ||
        in->state_test(CInode::STATE_RECOVERING)) {
       dout(20) << " pending recovery" << dendl;
@@ -761,12 +758,6 @@ void StrayManager::truncate(CDentry *dn, uint32_t op_allowance)
   dout(10) << __func__ << ": " << *dn << " " << *in << dendl;
   assert(!dn->is_replicated());
 
-  if (dn->item_stray.is_on_list()) {
-    dn->item_stray.remove_myself();
-    num_strays_delayed--;
-    logger->set(l_mdc_num_strays_delayed, num_strays_delayed);
-  }
-
   num_strays_purging++;
   logger->set(l_mdc_num_strays_purging, num_strays_purging);