From: Samuel Just Date: Wed, 12 Dec 2012 22:06:51 +0000 (-0800) Subject: ReplicatedPG: watchers must grab Connection ref as well X-Git-Tag: v0.56~51^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fdf66b6a8d24b36ab86e7b0a4c1360643e673895;p=ceph.git ReplicatedPG: watchers must grab Connection ref as well Session refs are not really valid on their own, the corresponding Connection must remain live for at least as long as the Session. Signed-off-by: Samuel Just --- diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 47abfdb2bd7f..e6152678ed11 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -1586,6 +1586,7 @@ void ReplicatedPG::remove_watcher(ObjectContext *obc, entity_name_t entity) session->watches.erase(obc); put_object_context(obc); + session->con->put(); session->put(); } @@ -3345,6 +3346,7 @@ void ReplicatedPG::do_osd_op_effects(OpContext *ctx) if (iter == obc->watchers.end()) { dout(10) << " connected to " << w << " by " << entity << " session " << session << dendl; obc->watchers[entity] = session; + session->con->get(); session->get(); session->watches[obc] = get_osdmap()->object_locator_to_pg(soid.oid, obc->obs.oi.oloc); obc->ref++; @@ -3356,10 +3358,14 @@ void ReplicatedPG::do_osd_op_effects(OpContext *ctx) // weird: same entity, different session. dout(10) << " reconnected (with different session!) watch " << w << " by " << entity << " session " << session << " (was " << iter->second << ")" << dendl; + session->con->get(); + session->get(); + iter->second->watches.erase(obc); + iter->second->con->put(); iter->second->put(); + iter->second = session; - session->get(); session->watches[obc] = get_osdmap()->object_locator_to_pg(soid.oid, obc->obs.oi.oloc); } map::iterator un_iter =