__le16 data_off; /* sender: include full offset;
receiver: mask against ~PAGE_MASK */
- __u8 mon_protocol, monc_protocol; /* protocol versions, */
- __u8 osd_protocol, osdc_protocol; /* internal and public */
- __u8 mds_protocol, mdsc_protocol;
-
struct ceph_entity_inst src, orig_src;
__le32 dst_erank;
__le32 crc; /* header crc32c */
m->hdr.data_len = cpu_to_le32(page_len);
m->hdr.data_off = cpu_to_le16(page_off);
m->hdr.priority = cpu_to_le16(CEPH_MSG_PRIO_DEFAULT);
- m->hdr.mon_protocol = CEPH_MON_PROTOCOL;
- m->hdr.monc_protocol = CEPH_MONC_PROTOCOL;
- m->hdr.osd_protocol = CEPH_OSD_PROTOCOL;
- m->hdr.osdc_protocol = CEPH_OSDC_PROTOCOL;
- m->hdr.mds_protocol = CEPH_MDS_PROTOCOL;
- m->hdr.mdsc_protocol = CEPH_MDSC_PROTOCOL;
m->footer.front_crc = 0;
m->footer.middle_crc = 0;
m->footer.data_crc = 0;
bool RadosClient::ms_dispatch(Message *m)
{
- bool ret;
-
- if (m->get_orig_source().is_mon() &&
- m->get_header().monc_protocol != CEPH_MONC_PROTOCOL) {
- dout(0) << "monc protocol v " << (int)m->get_header().monc_protocol << " != my " << CEPH_MONC_PROTOCOL
- << " from " << m->get_orig_source_inst() << " " << *m << dendl;
- delete m;
- return true;
- }
- if (m->get_orig_source().is_osd() &&
- m->get_header().osdc_protocol != CEPH_OSDC_PROTOCOL) {
- dout(0) << "osdc protocol v " << (int)m->get_header().osdc_protocol << " != my " << CEPH_OSDC_PROTOCOL
- << " from " << m->get_orig_source_inst() << " " << *m << dendl;
- delete m;
- return true;
- }
-
lock.Lock();
- ret = _dispatch(m);
+ bool ret = _dispatch(m);
lock.Unlock();
return ret;
}
bool MDS::ms_dispatch(Message *m)
{
- bool ret;
-
- // verify protocol version
- if (m->get_orig_source().is_mds() &&
- m->get_header().mds_protocol != CEPH_MDS_PROTOCOL) {
- dout(0) << "mds protocol v " << (int)m->get_header().mds_protocol << " != my " << CEPH_MDS_PROTOCOL
- << " from " << m->get_orig_source_inst() << " " << *m << dendl;
- delete m;
- return true;
- }
-
- if (m->get_header().mdsc_protocol != CEPH_MDSC_PROTOCOL) {
- dout(0) << "mdsc protocol v " << (int)m->get_header().mdsc_protocol << " != my " << CEPH_MDSC_PROTOCOL
- << " from " << m->get_orig_source_inst() << " " << *m << dendl;
- delete m;
- return true;
- }
- if (m->get_orig_source().is_mon() &&
- m->get_header().monc_protocol != CEPH_MONC_PROTOCOL) {
- dout(0) << "monc protocol v " << (int)m->get_header().monc_protocol << " != my " << CEPH_MONC_PROTOCOL
- << " from " << m->get_orig_source_inst() << " " << *m << dendl;
- delete m;
- return true;
- }
- if (m->get_orig_source().is_osd() &&
- m->get_header().osdc_protocol != CEPH_OSDC_PROTOCOL) {
- dout(0) << "osdc protocol v " << (int)m->get_header().osdc_protocol << " != my " << CEPH_OSDC_PROTOCOL
- << " from " << m->get_orig_source_inst() << " " << *m << dendl;
- delete m;
- return true;
- }
-
- if (m->get_type() == CEPH_MSG_PING) {
- delete m;
- return true;
- }
-
mds_lock.Lock();
- ret = _dispatch(m);
+ bool ret = _dispatch(m);
mds_lock.Unlock();
-
return ret;
}
bool Monitor::ms_dispatch(Message *m)
{
- // verify protocol version
- if (m->get_orig_source().is_mon() &&
- m->get_header().mon_protocol != CEPH_MON_PROTOCOL) {
- dout(0) << "mon protocol v " << (int)m->get_header().mon_protocol << " != my " << CEPH_MON_PROTOCOL
- << " from " << m->get_orig_source_inst() << " " << *m << dendl;
- delete m;
- return true;
- }
- if (m->get_header().monc_protocol != CEPH_MONC_PROTOCOL) {
- dout(0) << "monc protocol v " << (int)m->get_header().monc_protocol << " != my " << CEPH_MONC_PROTOCOL
- << " from " << m->get_orig_source_inst() << " " << *m << dendl;
-
- if (m->get_type() == CEPH_MSG_CLIENT_MOUNT) {
- stringstream ss;
- ss << "client protocol v " << (int)m->get_header().monc_protocol << " != server v " << CEPH_MONC_PROTOCOL;
- string s;
- getline(ss, s);
- messenger->send_message(new MClientMountAck(-1, -EINVAL, s.c_str()),
- m->get_orig_source_inst());
- }
-
- delete m;
- return true;
- }
-
lock.Lock();
{
switch (m->get_type()) {
assert(m->nref.test() == 0);
- m->get_header().mon_protocol = CEPH_MON_PROTOCOL;
- m->get_header().monc_protocol = CEPH_MONC_PROTOCOL;
- m->get_header().mds_protocol = CEPH_MDS_PROTOCOL;
- m->get_header().mdsc_protocol = CEPH_MDSC_PROTOCOL;
- m->get_header().osd_protocol = CEPH_OSD_PROTOCOL;
- m->get_header().osdc_protocol = CEPH_OSDC_PROTOCOL;
-
// lookup
entity_addr_t dest_proc_addr = dest_addr;
dest_proc_addr.erank = 0;
bool OSD::ms_dispatch(Message *m)
{
- // verify protocol version
- if (m->get_orig_source().is_osd() &&
- m->get_header().osd_protocol != CEPH_OSD_PROTOCOL) {
- dout(0) << "osd protocol v " << (int)m->get_header().osd_protocol << " != my " << CEPH_OSD_PROTOCOL
- << " from " << m->get_orig_source_inst() << " " << *m << dendl;
- delete m;
- return true;
- }
-
- if (m->get_header().osdc_protocol != CEPH_OSDC_PROTOCOL) {
- dout(0) << "osdc protocol v " << (int)m->get_header().osdc_protocol << " != my " << CEPH_OSDC_PROTOCOL
- << " from " << m->get_orig_source_inst() << " " << *m << dendl;
- delete m;
- return true;
- }
- if (m->get_orig_source().is_mon() &&
- m->get_header().monc_protocol != CEPH_MONC_PROTOCOL) {
- dout(0) << "monc protocol v " << (int)m->get_header().monc_protocol << " != my " << CEPH_MONC_PROTOCOL
- << " from " << m->get_orig_source_inst() << " " << *m << dendl;
- delete m;
- return true;
- }
-
// lock!
osd_lock.Lock();
_dispatch(m);