]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: fix narrow session refcount race 1820/head
authorSage Weil <sage@inktank.com>
Sun, 18 May 2014 01:33:36 +0000 (18:33 -0700)
committerSage Weil <sage@inktank.com>
Sun, 18 May 2014 01:33:36 +0000 (18:33 -0700)
The set_priv() call consumes a ref.  Technically the local 's' is not
actually owned by use by the time we get to the con_front set_priv().

Signed-off-by: Sage Weil <sage@inktank.com>
src/osd/OSD.cc

index 55c2be0b470f7c887a99ada84dae80f45fac9cac..25366cc7157cb3a35537f75443a5d79e8732f880 100644 (file)
@@ -2803,7 +2803,7 @@ void OSD::_add_heartbeat_peer(int p)
     hi->peer = p;
     HeartbeatSession *s = new HeartbeatSession(p);
     hi->con_back = cons.first.get();
-    hi->con_back->set_priv(s);
+    hi->con_back->set_priv(s->get());
     if (cons.second) {
       hi->con_front = cons.second.get();
       hi->con_front->set_priv(s->get());
@@ -2817,6 +2817,7 @@ void OSD::_add_heartbeat_peer(int p)
               << " " << hi->con_back->get_peer_addr()
               << dendl;
     }
+    s->put();
   } else {
     hi = &i->second;
   }