/* we will consider the default type as being 'monitor' until proven wrong */
op->set_type_monitor();
/* deal with all messages that do not necessarily need caps */
- bool dealt_with = true;
switch (op->get_req()->get_type()) {
// auth
case MSG_MON_GLOBAL_ID:
op->set_type_service();
/* no need to check caps here */
paxos_service[PAXOS_AUTH]->dispatch(op);
- break;
+ return;
case CEPH_MSG_PING:
handle_ping(op);
- break;
+ return;
/* MMonGetMap may be used by clients to obtain a monmap *before*
* authenticating with the monitor. We need to handle these without
*/
case CEPH_MSG_MON_GET_MAP:
handle_mon_get_map(op);
- break;
+ return;
}
- if (dealt_with)
- return;
if (!op->get_session()->authenticated) {
dout(5) << __func__ << " " << op->get_req()->get_source_inst()
<< " is not authenticated, dropping " << *(op->get_req())
<< dendl;
- goto drop;
+ return;
}
switch (op->get_req()->get_type()) {
case CEPH_MSG_MON_METADATA:
return handle_mon_metadata(op);
-
}
/* well, maybe the op belongs to a service... */
op->set_type_service();
/* deal with all messages which caps should be checked somewhere else */
- dealt_with = true;
switch (op->get_req()->get_type()) {
// OSDs
case MSG_OSD_PG_CREATED:
case MSG_REMOVE_SNAPS:
paxos_service[PAXOS_OSDMAP]->dispatch(op);
- break;
+ return;
// MDSs
case MSG_MDS_BEACON:
case MSG_MDS_OFFLOAD_TARGETS:
paxos_service[PAXOS_MDSMAP]->dispatch(op);
- break;
+ return;
// Mgrs
case MSG_MGR_BEACON:
paxos_service[PAXOS_MGR]->dispatch(op);
- break;
+ return;
// MgrStat
case MSG_MON_MGR_REPORT:
case CEPH_MSG_STATFS:
case MSG_GETPOOLSTATS:
paxos_service[PAXOS_MGRSTAT]->dispatch(op);
- break;
+ return;
- // log
+ // log
case MSG_LOG:
paxos_service[PAXOS_LOG]->dispatch(op);
- break;
+ return;
// handle_command() does its own caps checking
case MSG_MON_COMMAND:
op->set_type_command();
handle_command(op);
- break;
-
- default:
- dealt_with = false;
- break;
+ return;
}
- if (dealt_with)
- return;
/* nop, looks like it's not a service message; revert back to monitor */
op->set_type_monitor();
dout(5) << __func__ << " " << op->get_req()->get_source_inst()
<< " not enough caps for " << *(op->get_req()) << " -- dropping"
<< dendl;
- goto drop;
+ return;
}
- dealt_with = true;
switch (op->get_req()->get_type()) {
-
// misc
case CEPH_MSG_MON_GET_VERSION:
handle_get_version(op);
- break;
+ return;
case CEPH_MSG_MON_SUBSCRIBE:
/* FIXME: check what's being subscribed, filter accordingly */
handle_subscribe(op);
- break;
-
- default:
- dealt_with = false;
- break;
+ return;
}
- if (dealt_with)
- return;
if (!op->is_src_mon()) {
dout(1) << __func__ << " unexpected monitor message from"
<< " non-monitor entity " << op->get_req()->get_source_inst()
<< " " << *(op->get_req()) << " -- dropping" << dendl;
- goto drop;
+ return;
}
/* messages that should only be sent by another monitor */
- dealt_with = true;
switch (op->get_req()->get_type()) {
case MSG_ROUTE:
handle_route(op);
- break;
+ return;
case MSG_MON_PROBE:
handle_probe(op);
- break;
+ return;
// Sync (i.e., the new slurp, but on steroids)
case MSG_MON_SYNC:
handle_sync(op);
- break;
+ return;
case MSG_MON_SCRUB:
handle_scrub(op);
- break;
+ return;
/* log acks are sent from a monitor we sent the MLog to, and are
never sent by clients to us. */
case MSG_LOGACK:
log_client.handle_log_ack((MLogAck*)op->get_req());
- break;
+ return;
// monmap
case MSG_MON_JOIN:
op->set_type_service();
paxos_service[PAXOS_MONMAP]->dispatch(op);
- break;
+ return;
// paxos
case MSG_MON_PAXOS:
MMonPaxos *pm = static_cast<MMonPaxos*>(op->get_req());
if (!op->get_session()->is_capable("mon", MON_CAP_X)) {
//can't send these!
- break;
+ return;
}
if (state == STATE_SYNCHRONIZING) {
// good, thus just drop them and ignore them.
dout(10) << __func__ << " ignore paxos msg from "
<< pm->get_source_inst() << dendl;
- break;
+ return;
}
// sanitize
if (pm->epoch > get_epoch()) {
bootstrap();
- break;
+ return;
}
if (pm->epoch != get_epoch()) {
- break;
+ return;
}
paxos->dispatch(op);
}
- break;
+ return;
// elector messages
case MSG_MON_ELECTION:
if (!op->get_session()->is_capable("mon", MON_CAP_X)) {
dout(0) << "MMonElection received from entity without enough caps!"
<< op->get_session()->caps << dendl;
- break;
+ return;;
}
if (!is_probing() && !is_synchronizing()) {
elector.dispatch(op);
}
- break;
+ return;
case MSG_FORWARD:
handle_forward(op);
- break;
+ return;
case MSG_TIMECHECK:
handle_timecheck(op);
- break;
+ return;
case MSG_MON_HEALTH:
dout(5) << __func__ << " dropping deprecated message: "
case MSG_MON_HEALTH_CHECKS:
op->set_type_service();
paxos_service[PAXOS_HEALTH]->dispatch(op);
- break;
-
- default:
- dealt_with = false;
- break;
- }
- if (!dealt_with) {
- dout(1) << "dropping unexpected " << *(op->get_req()) << dendl;
- goto drop;
+ return;
}
- return;
-
-drop:
+ dout(1) << "dropping unexpected " << *(op->get_req()) << dendl;
return;
}