@@ -5425,6 +5425,8 @@ void Server::handle_client_rename(MDRequest *mdr)
}
_rename_prepare(mdr, &le->metablob, &le->client_map, srcdn, destdn, straydn);
+ if (le->client_map.length())
+ le->cmapv = mds->sessionmap.projected;
// -- commit locally --
C_MDS_rename_finish *fin = new C_MDS_rename_finish(mds, mdr, srcdn, destdn, straydn);
@@ -23,13 +23,14 @@ public:
EMetaBlob metablob;
string type;
bufferlist client_map;
+ version_t cmapv;
metareqid_t reqid;
bool had_slaves;
EUpdate() : LogEvent(EVENT_UPDATE) { }
EUpdate(MDLog *mdlog, const char *s) :
LogEvent(EVENT_UPDATE), metablob(mdlog),
- type(s), had_slaves(false) { }
+ type(s), cmapv(0), had_slaves(false) { }
void print(ostream& out) {
if (type.length())
@@ -38,12 +39,13 @@ public:
}
void encode(bufferlist &bl) const {
- __u8 struct_v = 2;
+ __u8 struct_v = 3;
::encode(struct_v, bl);
::encode(stamp, bl);
::encode(type, bl);
::encode(metablob, bl);
::encode(client_map, bl);
+ ::encode(cmapv, bl);
::encode(reqid, bl);
::encode(had_slaves, bl);
}
@@ -55,6 +57,8 @@ public:
::decode(type, bl);
::decode(metablob, bl);
::decode(client_map, bl);
+ if (struct_v >= 3)
+ ::decode(cmapv, bl);
::decode(reqid, bl);
::decode(had_slaves, bl);
}
@@ -999,14 +999,24 @@ void EUpdate::replay(MDS *mds)
mds->mdcache->add_uncommitted_master(reqid, _segment, slaves);
}
- // open client sessions?
- map<client_t,entity_inst_t> cm;
- map<client_t, uint64_t> seqm;
if (client_map.length()) {
- bufferlist::iterator blp = client_map.begin();
- ::decode(cm, blp);
- mds->server->prepare_force_open_sessions(cm, seqm);
- mds->server->finish_force_open_sessions(cm, seqm);
+ if (mds->sessionmap.version >= cmapv) {
+ dout(10) << "EUpdate.replay sessionmap v " << cmapv
+ << " <= table " << mds->sessionmap.version << dendl;
+ } else {
+ dout(10) << "EUpdate.replay sessionmap " << mds->sessionmap.version
+ << " < " << cmapv << dendl;
+ // open client sessions?
+ map<client_t,entity_inst_t> cm;
+ map<client_t, uint64_t> seqm;
+ bufferlist::iterator blp = client_map.begin();
+ ::decode(cm, blp);
+ mds->server->prepare_force_open_sessions(cm, seqm);
+ mds->server->finish_force_open_sessions(cm, seqm);
+
+ assert(mds->sessionmap.version = cmapv);
+ mds->sessionmap.projected = mds->sessionmap.version;
+ }
}
}