tag MMDSMap with fsid

This commit is contained in:
Sage Weil 2008-04-09 17:53:22 -07:00
parent ebae73f593
commit 07421c6b36
4 changed files with 18 additions and 7 deletions

View File

@ -1627,8 +1627,15 @@ void ceph_mdsc_handle_map(struct ceph_mds_client *mdsc, struct ceph_msg *msg)
struct ceph_mdsmap *newmap, *oldmap;
int from = le32_to_cpu(msg->hdr.src.name.num);
int newstate;
struct ceph_fsid fsid;
ceph_decode_need(&p, end, 2*sizeof(__u32), bad);
ceph_decode_need(&p, end, sizeof(fsid)+2*sizeof(__u32), bad);
ceph_decode_64(&p, fsid.major);
ceph_decode_64(&p, fsid.minor);
if (!ceph_fsid_equal(&fsid, &mdsc->client->monc.monmap->fsid)) {
derr(0, "got mdsmap with wrong fsid\n");
return;
}
ceph_decode_32(&p, epoch);
ceph_decode_32(&p, maplen);
dout(2, "handle_map epoch %u len %d\n", epoch, (int)maplen);

View File

@ -237,7 +237,7 @@ void MDS::send_message_mds(Message *m, int mds)
{
// send mdsmap first?
if (peer_mdsmap_epoch[mds] < mdsmap->get_epoch()) {
messenger->send_message(new MMDSMap(mdsmap),
messenger->send_message(new MMDSMap(monmap->fsid, mdsmap),
mdsmap->get_inst(mds));
peer_mdsmap_epoch[mds] = mdsmap->get_epoch();
}
@ -659,7 +659,7 @@ void MDS::bcast_mds_map()
for (set<Session*>::const_iterator p = clients.begin();
p != clients.end();
++p)
messenger->send_message(new MMDSMap(mdsmap), (*p)->inst);
messenger->send_message(new MMDSMap(monmap->fsid, mdsmap), (*p)->inst);
last_client_mdsmap_bcast = mdsmap->get_epoch();
}

View File

@ -44,7 +44,8 @@ class MMDSMap : public Message {
return e;
}
*/
ceph_fsid fsid;
epoch_t epoch;
bufferlist encoded;
@ -53,8 +54,9 @@ class MMDSMap : public Message {
MMDSMap() :
Message(CEPH_MSG_MDS_MAP) {}
MMDSMap(MDSMap *mm) :
Message(CEPH_MSG_MDS_MAP) {
MMDSMap(ceph_fsid &f, MDSMap *mm) :
Message(CEPH_MSG_MDS_MAP),
fsid(f) {
epoch = mm->get_epoch();
mm->encode(encoded);
}
@ -67,10 +69,12 @@ class MMDSMap : public Message {
// marshalling
void decode_payload() {
int off = 0;
::_decode(fsid, payload, off);
::_decode(epoch, payload, off);
::_decode(encoded, payload, off);
}
void encode_payload() {
::_encode(fsid, payload);
::_encode(epoch, payload);
::_encode(encoded, payload);
}

View File

@ -604,7 +604,7 @@ void MDSMonitor::bcast_latest_mds()
void MDSMonitor::send_full(entity_inst_t dest)
{
dout(11) << "send_full to " << dest << dendl;
mon->messenger->send_message(new MMDSMap(&mdsmap), dest);
mon->messenger->send_message(new MMDSMap(mon->monmap->fsid, &mdsmap), dest);
}
void MDSMonitor::send_to_waiting()