diff --git a/src/include/ceph_fs.h b/src/include/ceph_fs.h index 28440c820dcfb8..65c2065652ce5a 100644 --- a/src/include/ceph_fs.h +++ b/src/include/ceph_fs.h @@ -550,6 +550,7 @@ union ceph_mds_request_args_legacy { #define CEPH_MDS_FLAG_REPLAY 1 /* this is a replayed op */ #define CEPH_MDS_FLAG_WANT_DENTRY 2 /* want dentry in reply */ #define CEPH_MDS_FLAG_ASYNC 4 /* request is async */ +#define CEPH_MDS_FLAG_REINTEGRATE 8 /* request is reintegration */ struct ceph_mds_request_head_legacy { __le64 oldest_client_tid; diff --git a/src/mds/CDentry.cc b/src/mds/CDentry.cc index 0b83d34afcd102..683857eecdec42 100644 --- a/src/mds/CDentry.cc +++ b/src/mds/CDentry.cc @@ -267,7 +267,7 @@ void CDentry::make_path(filepath& fp, bool projected) const * active (no longer projected). if the passed dnl is projected, * don't link in, and do that work later in pop_projected_linkage(). */ -void CDentry::link_remote(CDentry::linkage_t *dnl, CInode *in) +void CDentry::link_remote(CDentry::linkage_t *dnl, CInode *in, bool reintegrating) { ceph_assert(dnl->is_remote()); ceph_assert(in->ino() == dnl->get_remote_ino()); @@ -277,7 +277,9 @@ void CDentry::link_remote(CDentry::linkage_t *dnl, CInode *in) in->add_remote_parent(this); // check for reintegration - dir->mdcache->eval_remote(this); + if (!reintegrating) { + dir->mdcache->eval_remote(this); + } } void CDentry::unlink_remote(CDentry::linkage_t *dnl) diff --git a/src/mds/CDentry.h b/src/mds/CDentry.h index 7a499399673fc5..c428f83e1d6a04 100644 --- a/src/mds/CDentry.h +++ b/src/mds/CDentry.h @@ -240,7 +240,7 @@ class CDentry : public MDSCacheObject, public LRUObject, public Counter int get_num_dir_auth_pins() const; // remote links - void link_remote(linkage_t *dnl, CInode *in); + void link_remote(linkage_t *dnl, CInode *in, bool reintegrating=false); void unlink_remote(linkage_t *dnl); // copy cons diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index eb91692425e5ef..5e552c404d8b9c 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -8495,7 +8495,7 @@ int MDCache::path_traverse(MDRequestRef& mdr, MDSContextFactory& cf, in = get_inode(dnl->get_remote_ino()); if (in) { dout(7) << "linking in remote in " << *in << dendl; - dn->link_remote(dnl, in); + dn->link_remote(dnl, in, mdr->client_request->is_reintegration()); } else { dout(7) << "remote link to " << dnl->get_remote_ino() << ", which i don't have" << dendl; ceph_assert(mdr); // we shouldn't hit non-primary dentries doing a non-mdr traversal! @@ -8775,7 +8775,7 @@ CInode *MDCache::get_dentry_inode(CDentry *dn, MDRequestRef& mdr, bool projected CInode *in = get_inode(dnl->get_remote_ino()); if (in) { dout(7) << "get_dentry_inode linking in remote in " << *in << dendl; - dn->link_remote(dnl, in); + dn->link_remote(dnl, in, mdr->client_request->is_reintegration()); return in; } else { dout(10) << "get_dentry_inode on remote dn, opening inode for " << *dn << dendl; diff --git a/src/mds/StrayManager.cc b/src/mds/StrayManager.cc index ec63b1d48b810b..831cb2d81f9dce 100644 --- a/src/mds/StrayManager.cc +++ b/src/mds/StrayManager.cc @@ -693,6 +693,7 @@ void StrayManager::reintegrate_stray(CDentry *straydn, CDentry *rdn) ceph_tid_t tid = mds->issue_tid(); auto req = make_message(CEPH_MDS_OP_RENAME); + req->set_reintegrated_op(); req->set_filepath(dst); req->set_filepath2(src); req->set_tid(tid); @@ -722,6 +723,7 @@ void StrayManager::migrate_stray(CDentry *dn, mds_rank_t to) ceph_tid_t tid = mds->issue_tid(); auto req = make_message(CEPH_MDS_OP_RENAME); + req->set_reintegrated_op(); req->set_filepath(dst); req->set_filepath2(src); req->set_tid(tid); diff --git a/src/messages/MClientRequest.h b/src/messages/MClientRequest.h index c62e183a756336..f8a71980c212dc 100644 --- a/src/messages/MClientRequest.h +++ b/src/messages/MClientRequest.h @@ -166,6 +166,10 @@ class MClientRequest final : public MMDSOp { return get_flags() & CEPH_MDS_FLAG_ASYNC; } + bool is_reintegration() const { + return get_flags() & CEPH_MDS_FLAG_REINTEGRATE; + } + // normal fields void set_stamp(utime_t t) { stamp = t; } void set_oldest_client_tid(ceph_tid_t t) { head.oldest_client_tid = t; } @@ -192,6 +196,10 @@ class MClientRequest final : public MMDSOp { head.flags = head.flags | CEPH_MDS_FLAG_ASYNC; } + void set_reintegrate_op() { + head.flags = head.flags | CEPH_MDS_FLAG_REINTEGRATE; + } + void set_alternate_name(std::string _alternate_name) { alternate_name = std::move(_alternate_name); }