#include "mds/MDLog.h"
#include "mds/CDir.h"
#include "mds/CDentry.h"
+#include "mds/ScrubStack.h"
#include "events/EUpdate.h"
#include "messages/MClientRequest.h"
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())
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);
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;
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);
}