if (mode == TO_AUTH_SUBTREE_ROOT) {
// subtree root?
- if (dir->is_subtree_root() &&
- !dir->state_test(CDir::STATE_EXPORTBOUND)) {
- if (dir->is_auth() && !dir->is_ambiguous_auth() ) {
- if (dir->state_test(CDir::STATE_AUXSUBTREE) &&
- dir->get_dir_auth().first == diri->authority().first) {
- // auxiliary subtree. treat it as normal dirfrag
- dout(20) << "EMetaBlob::add_dir_context(" << dir << ") auxiliary subtree " << dendl;
+ if (dir->is_subtree_root()) {
+ // match logic in MDCache::create_subtree_map()
+ if (dir->get_dir_auth().first == mds->get_nodeid()) {
+ mds_authority_t parent_auth = parent ? parent->authority() : CDIR_AUTH_UNDEF;
+ if (parent_auth.first == dir->get_dir_auth().first) {
+ if (parent_auth.second == CDIR_AUTH_UNKNOWN &&
+ !dir->is_ambiguous_dir_auth() &&
+ !dir->state_test(CDir::STATE_EXPORTBOUND) &&
+ !dir->state_test(CDir::STATE_AUXSUBTREE) &&
+ !diri->state_test(CInode::STATE_AMBIGUOUSAUTH)) {
+ dout(0) << "EMetaBlob::add_dir_context unexpected subtree " << *dir << dendl;
+ assert(0);
+ }
+ dout(20) << "EMetaBlob::add_dir_context(" << dir << ") ambiguous or transient subtree " << dendl;
} else {
// it's an auth subtree, we don't need maybe (if any), and we're done.
dout(20) << "EMetaBlob::add_dir_context(" << dir << ") reached unambig auth subtree, don't need " << maybe
maybenot = false;
}
}
-
+
// was the inode journaled in this blob?
if (event_seq && diri->last_journaled == event_seq) {
dout(20) << "EMetaBlob::add_dir_context(" << dir << ") already have diri this blob " << *diri << dendl;
{
in->inode = inode;
in->xattrs = xattrs;
+ in->maybe_export_pin();
if (in->inode.is_dir()) {
if (!(in->dirfragtree == dirfragtree)) {
dout(10) << "EMetaBlob::fullbit::update_inode dft " << in->dirfragtree << " -> "
dout(0) << ss.str() << dendl;
mds->clog->warn(ss);
}
- dir->unlink_inode(dn);
- mds->mdcache->touch_dentry_bottom(dn);
+ dir->unlink_inode(dn, false);
}
if (unlinked.count(in))
linked.insert(in);
if (dn->get_linkage()->get_inode() != in && in->get_parent_dn()) {
dout(10) << "EMetaBlob.replay unlinking " << *in << dendl;
unlinked[in] = in->get_parent_dir();
- CDentry *unlinked_dn = in->get_parent_dn();
in->get_parent_dir()->unlink_inode(in->get_parent_dn());
- mds->mdcache->touch_dentry_bottom(unlinked_dn);
}
if (dn->get_linkage()->get_inode() != in) {
if (!dn->get_linkage()->is_null()) { // note: might be remote. as with stray reintegration.
dout(0) << ss.str() << dendl;
mds->clog->warn(ss);
}
- dir->unlink_inode(dn);
- mds->mdcache->touch_dentry_bottom(dn);
+ dir->unlink_inode(dn, false);
}
if (unlinked.count(in))
linked.insert(in);
<< " " << *dn->get_linkage()->get_inode() << " should be remote " << p->ino;
dout(0) << ss.str() << dendl;
}
- dir->unlink_inode(dn);
- mds->mdcache->touch_dentry_bottom(dn);
+ dir->unlink_inode(dn, false);
}
dir->link_remote_inode(dn, p->ino, p->d_type);
dn->set_version(p->dnv);
if (dn->get_linkage()->is_primary())
unlinked[in] = dir;
dir->unlink_inode(dn);
- mds->mdcache->touch_dentry_bottom(dn);
}
}
dn->set_version(p->dnv);
// Make null dentries the first things we trim
dout(10) << "EMetaBlob.replay pushing to bottom of lru " << *dn << dendl;
- mds->mdcache->touch_dentry_bottom(dn);
}
}
if (parent) {
dout(10) << "EMetaBlob.replay unlinked from dentry " << *parent << dendl;
assert(parent->get_linkage()->is_null());
- mds->mdcache->touch_dentry_bottom(parent);
}
} else {
dout(10) << "EMetaBlob.replay destroyed " << *p << ", not in cache" << dendl;
void EExport::encode(bufferlist& bl, uint64_t features) const
{
- ENCODE_START(3, 3, bl);
+ ENCODE_START(4, 3, bl);
::encode(stamp, bl);
::encode(metablob, bl, features);
::encode(base, bl);
::encode(bounds, bl);
+ ::encode(target, bl);
ENCODE_FINISH(bl);
}
::decode(metablob, bl);
::decode(base, bl);
::decode(bounds, bl);
+ if (struct_v >= 4)
+ ::decode(target, bl);
DECODE_FINISH(bl);
}
}
void EImportStart::encode(bufferlist &bl, uint64_t features) const {
- ENCODE_START(3, 3, bl);
+ ENCODE_START(4, 3, bl);
::encode(stamp, bl);
::encode(base, bl);
::encode(metablob, bl, features);
::encode(bounds, bl);
::encode(cmapv, bl);
::encode(client_map, bl);
+ ::encode(from, bl);
ENCODE_FINISH(bl);
}
::decode(bounds, bl);
::decode(cmapv, bl);
::decode(client_map, bl);
+ if (struct_v >= 4)
+ ::decode(from, bl);
DECODE_FINISH(bl);
}