]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc/Objecter: hold session ref longer in resend
authorJohn Spray <john.spray@redhat.com>
Sun, 24 Aug 2014 22:48:57 +0000 (23:48 +0100)
committerJohn Spray <john.spray@redhat.com>
Mon, 25 Aug 2014 00:34:20 +0000 (01:34 +0100)
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 <john.spray@redhat.com>
src/osdc/Objecter.cc

index 0f6a61321435a8ef583eba9caab80777286c5aa0..80bbf8377de42d07976a10dad92e09a4ee952e3e 100644 (file)
@@ -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<LingerOp*>::iterator p = need_resend_linger.begin();
        p != need_resend_linger.end(); ++p) {