From: Sage Weil Date: Sun, 18 May 2014 01:33:36 +0000 (-0700) Subject: osd: fix narrow session refcount race X-Git-Tag: v0.82~76^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F1820%2Fhead;p=ceph.git osd: fix narrow session refcount race 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 --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 55c2be0b470f..25366cc7157c 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -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; }