From: Joao Eduardo Luis Date: Fri, 26 Jun 2015 09:28:36 +0000 (+0100) Subject: mon: Monitor: set op request type during dispatch X-Git-Tag: v9.1.0~535^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9cee74bcdbbf1c1fd0bf048636bdd0c02073ed5d;p=ceph.git mon: Monitor: set op request type during dispatch Signed-off-by: Joao Eduardo Luis --- diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 118ecede00d..0d68a2cd529 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -3507,12 +3507,15 @@ void Monitor::dispatch(MonOpRequestRef op) void Monitor::dispatch_op(MonOpRequestRef op) { op->mark_event("mon:dispatch_op"); + /* 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: case CEPH_MSG_AUTH: + op->set_type_service(); /* no need to check caps here */ paxos_service[PAXOS_AUTH]->dispatch(op); break; @@ -3542,6 +3545,8 @@ void Monitor::dispatch_op(MonOpRequestRef op) if (dealt_with) return; + /* 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()) { @@ -3582,6 +3587,7 @@ void Monitor::dispatch_op(MonOpRequestRef op) // handle_command() does its own caps checking case MSG_MON_COMMAND: + op->set_type_command(); handle_command(op); break; @@ -3592,6 +3598,9 @@ void Monitor::dispatch_op(MonOpRequestRef op) if (dealt_with) return; + /* nop, looks like it's not a service message; revert back to monitor */ + op->set_type_monitor(); + /* messages we, the Monitor class, need to deal with * but may be sent by clients. */ @@ -3663,6 +3672,7 @@ void Monitor::dispatch_op(MonOpRequestRef op) // paxos case MSG_MON_PAXOS: { + op->set_type_paxos(); MMonPaxos *pm = static_cast(op->get_req()); if (!op->is_src_mon() || !op->get_session()->is_capable("mon", MON_CAP_X)) { @@ -3693,6 +3703,7 @@ void Monitor::dispatch_op(MonOpRequestRef op) // elector messages case MSG_MON_ELECTION: + op->set_type_election(); //check privileges here for simplicity if (op->get_session() && !op->get_session()->is_capable("mon", MON_CAP_X)) {