From 28110ff3dbc18afb6848b23a0b81641e91bf5ffa Mon Sep 17 00:00:00 2001 From: John Spray Date: Sun, 24 Aug 2014 23:48:57 +0100 Subject: [PATCH] osdc/Objecter: hold session ref longer in resend This is mostly cosmetic: in fact we are getting an extra ref in _map_session and holding the session lock, so it's safe, but it's awkward to be giving up the ref on a session and then continuing to refer to it. Signed-off-by: John Spray --- src/osdc/Objecter.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/osdc/Objecter.cc b/src/osdc/Objecter.cc index 0f6a61321435..80bbf8377de4 100644 --- a/src/osdc/Objecter.cc +++ b/src/osdc/Objecter.cc @@ -842,11 +842,12 @@ void Objecter::handle_osd_map(MOSDMap *m) int r = _map_session(&op->target, &s, lc); assert(r == 0); mapped_session = true; + } else { + get_session(s); } s->lock.get_write(); if (mapped_session) { _session_op_assign(s, op); - put_session(s); } if (op->should_resend) { if (!op->session->is_homeless() && !op->target.paused) { @@ -857,6 +858,7 @@ void Objecter::handle_osd_map(MOSDMap *m) _cancel_linger_op(op); } s->lock.unlock(); + put_session(s); } for (list::iterator p = need_resend_linger.begin(); p != need_resend_linger.end(); ++p) { -- 2.47.3