]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/mds/StrayManager.cc
update ceph source to reef 18.2.1
[ceph.git] / ceph / src / mds / StrayManager.cc
index aa4c95e79e1c30d969646b9b3965b76ddf461b54..d288ce6617e7bb11a5d382012a318da2f4995e47 100644 (file)
@@ -20,6 +20,7 @@
 #include "mds/MDLog.h"
 #include "mds/CDir.h"
 #include "mds/CDentry.h"
+#include "mds/ScrubStack.h"
 #include "events/EUpdate.h"
 #include "messages/MClientRequest.h"
 
@@ -281,17 +282,6 @@ void StrayManager::_purge_stray_logged(CDentry *dn, version_t pdv, MutationRef&
     dir->remove_dentry(dn);
   }
 
-  // Once we are here normally the waiter list are mostly empty
-  // but in corner case that the clients pass a invalidate ino,
-  // which maybe under unlinking, the link caller will add the
-  // request to the waiter list. We need try to wake them up
-  // anyway.
-  MDSContext::vec finished;
-  in->take_waiting(CInode::WAIT_UNLINK, finished);
-  if (!finished.empty()) {
-    mds->queue_waiters(finished);
-  }
-
   // drop inode
   inodeno_t ino = in->ino();
   if (in->is_dirty())
@@ -311,6 +301,11 @@ void StrayManager::enqueue(CDentry *dn, bool trunc)
   CInode *in = dnl->get_inode();
   ceph_assert(in);
 
+  //remove inode from scrub stack if it is being purged
+  if(mds->scrubstack->remove_inode_if_stacked(in)) {
+    dout(20) << "removed " << *in << " from the scrub stack" << dendl;
+  }
+
   /* We consider a stray to be purging as soon as it is enqueued, to avoid
    * enqueing it twice */
   dn->state_set(CDentry::STATE_PURGING);
@@ -681,27 +676,19 @@ void StrayManager::reintegrate_stray(CDentry *straydn, CDentry *rdn)
   dout(10) << __func__ << " " << *straydn << " to " << *rdn << dendl;
 
   logger->inc(l_mdc_strays_reintegrated);
-
+  
   // rename it to remote linkage .
   filepath src(straydn->get_name(), straydn->get_dir()->ino());
   filepath dst(rdn->get_name(), rdn->get_dir()->ino());
 
-  ceph_tid_t tid = mds->issue_tid();
-
   auto req = make_message<MClientRequest>(CEPH_MDS_OP_RENAME);
   req->set_filepath(dst);
   req->set_filepath2(src);
-  req->set_tid(tid);
-
-  rdn->state_set(CDentry::STATE_REINTEGRATING);
-  mds->internal_client_requests.emplace(std::piecewise_construct,
-                                        std::make_tuple(tid),
-                                        std::make_tuple(CEPH_MDS_OP_RENAME,
-                                                        rdn, tid));
+  req->set_tid(mds->issue_tid());
 
   mds->send_message_mds(req, rdn->authority().first);
 }
-
 void StrayManager::migrate_stray(CDentry *dn, mds_rank_t to)
 {
   dout(10) << __func__ << " " << *dn << " to mds." << to << dendl;
@@ -715,17 +702,10 @@ void StrayManager::migrate_stray(CDentry *dn, mds_rank_t to)
   filepath src(dn->get_name(), dirino);
   filepath dst(dn->get_name(), MDS_INO_STRAY(to, MDS_INO_STRAY_INDEX(dirino)));
 
-  ceph_tid_t tid = mds->issue_tid();
-
   auto req = make_message<MClientRequest>(CEPH_MDS_OP_RENAME);
   req->set_filepath(dst);
   req->set_filepath2(src);
-  req->set_tid(tid);
-
-  mds->internal_client_requests.emplace(std::piecewise_construct,
-                                        std::make_tuple(tid),
-                                        std::make_tuple(CEPH_MDS_OP_RENAME,
-                                                        nullptr, tid));
+  req->set_tid(mds->issue_tid());
 
   mds->send_message_mds(req, to);
 }