set<CDir*> bounds;
cache->get_subtree_bounds(dir, bounds);
- // list us second, them first.
- // this keeps authority().first in sync with subtree auth state in the journal.
- cache->adjust_subtree_auth(dir, it->second.peer, mds->get_nodeid());
-
// log completion.
// include export bounds, to ensure they're in the journal.
EExport *le = new EExport(mds->mdlog, dir, it->second.peer);;
mds->mdlog->start_entry(le);
le->metablob.add_dir_context(dir, EMetaBlob::TO_ROOT);
- le->metablob.add_dir( dir, false );
+ le->metablob.add_dir(dir, false);
for (set<CDir*>::iterator p = bounds.begin();
p != bounds.end();
++p) {
le->metablob.add_dir(bound, false);
}
+ // list us second, them first.
+ // this keeps authority().first in sync with subtree auth state in the journal.
+ cache->adjust_subtree_auth(dir, it->second.peer, mds->get_nodeid());
+
// log export completion, then finish (unfreeze, trigger finish context, etc.)
mds->mdlog->submit_entry(le, new C_MDS_ExportFinishLogged(this, dir));
mds->mdlog->flush();
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;