// 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);
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);
protected:
dirfrag_t base;
set<dirfrag_t> bounds;
+ mds_rank_t target;
public:
- EExport() : LogEvent(EVENT_EXPORT) { }
- EExport(MDLog *mdlog, CDir *dir) :
+ EExport() :
+ LogEvent(EVENT_EXPORT), target(MDS_RANK_NONE) { }
+ EExport(MDLog *mdlog, CDir *dir, mds_rank_t t) :
LogEvent(EVENT_EXPORT), metablob(mdlog),
- base(dir->dirfrag()) { }
+ base(dir->dirfrag()), target(t) { }
set<dirfrag_t> &get_bounds() { return bounds; }
void print(ostream& out) const override {
- out << "EExport " << base << " " << metablob;
+ out << "EExport " << base << " to mds." << target << " " << metablob;
}
EMetaBlob *get_metablob() override { return &metablob; }
protected:
dirfrag_t base;
vector<dirfrag_t> bounds;
+ mds_rank_t from;
- public:
+public:
EMetaBlob metablob;
bufferlist client_map; // encoded map<__u32,entity_inst_t>
version_t cmapv;
- EImportStart(MDLog *log,
- dirfrag_t di,
- vector<dirfrag_t>& b) : LogEvent(EVENT_IMPORTSTART),
- base(di), bounds(b),
- metablob(log) { }
- EImportStart() : LogEvent(EVENT_IMPORTSTART) { }
+ EImportStart(MDLog *log, dirfrag_t di, vector<dirfrag_t>& b, mds_rank_t f) :
+ LogEvent(EVENT_IMPORTSTART),
+ base(di), bounds(b), from(f), metablob(log) { }
+ EImportStart() :
+ LogEvent(EVENT_IMPORTSTART), from(MDS_RANK_NONE) { }
void print(ostream& out) const override {
- out << "EImportStart " << base << " " << metablob;
+ out << "EImportStart " << base << " from mds." << from << " " << metablob;
}
EMetaBlob *get_metablob() override { return &metablob; }
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);
}