]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/mds/StrayManager.cc
update sources to v12.1.2
[ceph.git] / ceph / src / mds / StrayManager.cc
index b2102ddc2d09b6cbb717e4e09a8a347e1edfa52c..caa717024d165318e92268009040fec537804498 100644 (file)
@@ -314,6 +314,8 @@ class C_OpenSnapParents : public StrayManagerContext {
 
 void StrayManager::_enqueue(CDentry *dn, bool trunc)
 {
+  assert(started);
+
   CInode *in = dn->get_linkage()->get_inode();
   if (in->snaprealm &&
       !in->snaprealm->have_past_parents_open() &&
@@ -322,22 +324,6 @@ void StrayManager::_enqueue(CDentry *dn, bool trunc)
     return;
   }
 
-  if (!started) {
-    // If the MDS is not yet active, defer executing this purge
-    // in order to avoid the mdlog writes we do on purge completion.
-    mds->wait_for_active(
-        new MDSInternalContextWrapper(mds,
-          new FunctionContext([this, dn, trunc](int r){
-            // It is safe to hold on to this CDentry* pointer
-            // because the dentry is pinned with PIN_PURGING
-           _enqueue(dn, trunc); 
-            })
-        )
-      );
-
-    return;
-  }
-
   if (trunc) {
     truncate(dn);
   } else {
@@ -348,6 +334,9 @@ void StrayManager::_enqueue(CDentry *dn, bool trunc)
 
 void StrayManager::advance_delayed()
 {
+  if (!started)
+    return;
+
   for (elist<CDentry*>::iterator p = delayed_eval_stray.begin(); !p.end(); ) {
     CDentry *dn = *p;
     ++p;
@@ -435,6 +424,9 @@ bool StrayManager::_eval_stray(CDentry *dn, bool delay)
     return false;
   }
 
+  if (!started)
+    delay = true;
+
   if (dn->item_stray.is_on_list()) {
     if (delay)
       return false;
@@ -545,6 +537,7 @@ void StrayManager::activate()
 {
   dout(10) << __func__ << dendl;
   started = true;
+  purge_queue.activate();
 }
 
 bool StrayManager::eval_stray(CDentry *dn, bool delay)