From: Sage Weil Date: Mon, 14 Sep 2015 14:24:22 +0000 (-0400) Subject: mon: do not return ref to MonOpRequest::get_session() caller X-Git-Tag: v9.1.0~135^2~1^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c2a9764fddb9f5adb970150b4ce723e3580c8e4f;p=ceph.git mon: do not return ref to MonOpRequest::get_session() caller Most callers don't put the ref, and since we hold the op ref it's not necessary. This will also make a somewhat cleaner transition to MonSessionRef later. Signed-off-by: Sage Weil --- diff --git a/src/mon/AuthMonitor.cc b/src/mon/AuthMonitor.cc index 24cacb31a4da..c948680840bb 100644 --- a/src/mon/AuthMonitor.cc +++ b/src/mon/AuthMonitor.cc @@ -452,8 +452,6 @@ bool AuthMonitor::prep_auth(MonOpRequestRef op, bool paxos_writable) goto done; } - s->put(); - if (!mon->is_leader()) { dout(10) << "not the leader, requesting more ids from leader" << dendl; int leader = mon->get_leader(); @@ -511,7 +509,6 @@ reply: reply = new MAuthReply(proto, &response_bl, ret, s->global_id); mon->send_reply(op, reply); done: - s->put(); return true; } diff --git a/src/mon/MonOpRequest.h b/src/mon/MonOpRequest.h index db08ba26eb8b..e8339f6c646c 100644 --- a/src/mon/MonOpRequest.h +++ b/src/mon/MonOpRequest.h @@ -140,7 +140,7 @@ public: MonSession *get_session() const { if (!session) return NULL; - return (MonSession*)session->get(); + return session; } template diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 61fed6faec39..d886272534a6 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -3083,8 +3083,6 @@ void Monitor::forward_request_leader(MonOpRequestRef op) } else { dout(10) << "forward_request no session for request " << *req << dendl; } - if (session) - session->put(); } // fake connection attached to forwarded messages @@ -3166,7 +3164,6 @@ void Monitor::handle_forward(MonOpRequestRef op) _ms_dispatch(req); s->put(); } - session->put(); } void Monitor::try_send_message(Message *m, const entity_inst_t& to) @@ -3228,7 +3225,6 @@ void Monitor::send_reply(MonOpRequestRef op, Message *reply) session->con->send_message(reply); op->mark_event("reply: send"); } - session->put(); } void Monitor::no_reply(MonOpRequestRef op) @@ -3261,7 +3257,6 @@ void Monitor::no_reply(MonOpRequestRef op) << " " << *req << dendl; op->mark_event("no_reply"); } - session->put(); } void Monitor::handle_route(MonOpRequestRef op) @@ -3272,7 +3267,6 @@ void Monitor::handle_route(MonOpRequestRef op) if (session && !session->is_capable("mon", MON_CAP_X)) { dout(0) << "MRoute received from entity without appropriate perms! " << dendl; - session->put(); return; } if (m->msg) @@ -3304,8 +3298,6 @@ void Monitor::handle_route(MonOpRequestRef op) m->msg = NULL; } } - if (session) - session->put(); } void Monitor::resend_routed_requests() @@ -3444,7 +3436,6 @@ void Monitor::dispatch(MonOpRequestRef op) if (s && s->closed) { caps = s->caps; reuse_caps = true; - s->put(); s = NULL; } Message *m = op->get_req(); @@ -3510,7 +3501,6 @@ void Monitor::dispatch(MonOpRequestRef op) } else { dispatch_op(op); } - s->put(); return; } @@ -4207,7 +4197,6 @@ void Monitor::handle_subscribe(MonOpRequestRef op) if (reply) m->get_connection()->send_message(new MMonSubscribeAck(monmap->get_fsid(), (int)g_conf->mon_subscribe_interval)); - s->put(); } void Monitor::handle_get_version(MonOpRequestRef op) @@ -4252,10 +4241,8 @@ void Monitor::handle_get_version(MonOpRequestRef op) m->get_connection()->send_message(reply); } - - out: - s->put(); + return; } bool Monitor::ms_handle_reset(Connection *con)