}
-class C_M_ExportTargetWait : public MigratorContext {
+class C_M_ExportDirWait : public MigratorContext {
MDRequestRef mdr;
int count;
public:
- C_M_ExportTargetWait(Migrator *m, MDRequestRef mdr, int count)
+ C_M_ExportDirWait(Migrator *m, MDRequestRef mdr, int count)
: MigratorContext(m), mdr(mdr), count(count) {}
void finish(int r) override {
mig->dispatch_export_dir(mdr, count);
dout(7) << "read-only FS, no exports for now" << dendl;
return;
}
+ if (!mds->mdsmap->is_active(dest)) {
+ dout(7) << "dest not active, no exports for now" << dendl;
+ return;
+ }
if (mds->is_cluster_degraded()) {
dout(7) << "cluster degraded, no exports for now" << dendl;
return;
export_try_cancel(dir);
return;
}
- mds->wait_for_mdsmap(mds->mdsmap->get_epoch(), new C_M_ExportTargetWait(this, mdr, count+1));
+ mds->wait_for_mdsmap(mds->mdsmap->get_epoch(), new C_M_ExportDirWait(this, mdr, count+1));
return;
}
if (!dir->inode->get_parent_dn()) {
dout(7) << "waiting for dir to become stable before export: " << *dir << dendl;
- dir->add_waiter(CDir::WAIT_CREATED, new C_M_ExportTargetWait(this, mdr, 1));
+ dir->add_waiter(CDir::WAIT_CREATED, new C_M_ExportDirWait(this, mdr, 1));
return;
}
in->finish_export(now);
finish_export_inode_caps(in, peer, peer_imported);
-
- // *** other state too?
-
- // move to end of LRU so we drop out of cache quickly!
- if (in->get_parent_dn())
- cache->lru.lru_bottouch(in->get_parent_dn());
-
}
uint64_t Migrator::encode_export_dir(bufferlist& exportbl,
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);
+ 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 (!m->did_assim()) {
assert(it != import_state.end());
assert(it->second.state == IMPORT_DISCOVERED);
+ assert(it->second.peer == oldauth);
diri = cache->get_inode(m->get_dirfrag().ino);
assert(diri);
bufferlist::iterator p = m->basedir.begin();
return;
}
assert(it->second.state == IMPORT_PREPPING);
+ assert(it->second.peer == oldauth);
dir = cache->get_dirfrag(m->get_dirfrag());
assert(dir);
assert (g_conf->mds_kill_import_at != 5);
CDir *dir = cache->get_dirfrag(m->dirfrag);
assert(dir);
+
+ mds_rank_t oldauth = mds_rank_t(m->get_source().num());
+ dout(7) << "handle_export_dir importing " << *dir << " from " << oldauth << dendl;
+
+ assert(!dir->is_auth());
map<dirfrag_t,import_state_t>::iterator it = import_state.find(m->dirfrag);
assert(it != import_state.end());
assert(it->second.state == IMPORT_PREPPED);
assert(it->second.tid == m->get_tid());
+ assert(it->second.peer == oldauth);
utime_t now = ceph_clock_now();
- mds_rank_t oldauth = mds_rank_t(m->get_source().num());
- dout(7) << "handle_export_dir importing " << *dir << " from " << oldauth << dendl;
- assert(dir->is_auth() == false);
if (!dir->get_inode()->dirfragtree.is_leaf(dir->get_frag()))
dir->get_inode()->dirfragtree.force_to_leaf(g_ceph_context, dir->get_frag());
cache->show_subtrees();
- C_MDS_ImportDirLoggedStart *onlogged = new C_MDS_ImportDirLoggedStart(
- this, dir, mds_rank_t(m->get_source().num()));
+ C_MDS_ImportDirLoggedStart *onlogged = new C_MDS_ImportDirLoggedStart(this, dir, oldauth);
// start the journal entry
- EImportStart *le = new EImportStart(mds->mdlog, dir->dirfrag(), m->bounds);
+ EImportStart *le = new EImportStart(mds->mdlog, dir->dirfrag(), m->bounds, oldauth);
mds->mdlog->start_entry(le);
le->metablob.add_dir_context(dir);