summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Just <sam.just@inktank.com>2012-12-12 14:06:51 -0800
committerSamuel Just <sam.just@inktank.com>2012-12-12 14:50:15 -0800
commitfdf66b6a8d24b36ab86e7b0a4c1360643e673895 (patch)
tree5d53c70865d641e7e529b22db797bbd4c97a546d
parent64cefe2c60b2d54e06d6b3e78db8e2890e612b98 (diff)
downloadceph-fdf66b6a8d24b36ab86e7b0a4c1360643e673895.tar.gz
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 <sam.just@inktank.com>
-rw-r--r--src/osd/ReplicatedPG.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc
index 47abfdb2bd7..e6152678ed1 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<entity_name_t,Watch::C_WatchTimeout*>::iterator un_iter =