// open inode?
if (dnl->is_primary()) {
+ dout(7) << __func__ << " primary dentry " << *dn << dendl;
CInode *in = dnl->get_inode();
dn->dir->unlink_inode(dn);
ceph_assert(straydn);
migrator->export_caps(in);
straydn = NULL;
+ } else if (dnl->is_referent_remote()) {
+ dout(7) << __func__ << " remote referent dentry " << *dn << dendl;
+ CInode *ref_in = dnl->get_referent_inode();
+ dn->dir->unlink_inode(dn);
+ ceph_assert(straydn);
+ straydn->dir->link_primary_inode(straydn, ref_in);
+
+ // ref_in->first is lazily updated on replica; drag it forward so
+ // that we always keep it in sync with the dnq
+ ceph_assert(straydn->first >= ref_in->first);
+ ref_in->first = straydn->first;
+
+ //No snapshots on referent - ignore snaprealm invalidate
+
+ // send caps to auth (if we're not already)
+ if (ref_in->is_any_caps() &&
+ !ref_in->state_test(CInode::STATE_EXPORTINGCAPS))
+ migrator->export_caps(ref_in);
+
+ straydn = nullptr;
} else {
ceph_assert(!straydn);
ceph_assert(dnl->is_remote());
if (inc)
mdcache->send_dentry_link(dn, null_ref);
else
- mdcache->send_dentry_unlink(dn, NULL, null_ref);
+ mdcache->send_dentry_unlink(dn, straydn ? straydn : nullptr, null_ref);
// bump target popularity
mds->balancer->hit_inode(targeti, META_POP_IWR);