summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Just <sam.just@inktank.com>2012-12-20 16:23:23 -0800
committerSamuel Just <sam.just@inktank.com>2012-12-20 16:24:05 -0800
commitaccce830514c6b099eb0e00a8ae34396d14565a3 (patch)
tree046966965efe8d312e46fb3c2b09b31d14b691cd
parent129a49ada12e8d4818dba43d68211773e627acf8 (diff)
parentc0e2371284a51b7d7023c25837bc684dcbacf1d4 (diff)
downloadceph-accce830514c6b099eb0e00a8ae34396d14565a3.tar.gz
Merge remote-tracking branch 'upstream/wip_notify' into next
Reviewed-by: Sage Weil <sage@inktank.com>
-rw-r--r--src/osd/OSD.h9
-rw-r--r--src/osd/ReplicatedPG.cc21
2 files changed, 9 insertions, 21 deletions
diff --git a/src/osd/OSD.h b/src/osd/OSD.h
index ce387391180..211a4c1fe7c 100644
--- a/src/osd/OSD.h
+++ b/src/osd/OSD.h
@@ -501,17 +501,8 @@ public:
epoch_t last_sent_epoch;
Connection *con;
std::map<void *, pg_t> watches;
- std::map<void *, entity_name_t> notifs;
Session() : auid(-1), last_sent_epoch(0), con(0) {}
- void add_notif(void *n, entity_name_t& name) {
- notifs[n] = name;
- }
- void del_notif(void *n) {
- std::map<void *, entity_name_t>::iterator iter = notifs.find(n);
- if (iter != notifs.end())
- notifs.erase(iter);
- }
};
private:
diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc
index 4c6c481cc65..612dc4a8677 100644
--- a/src/osd/ReplicatedPG.cc
+++ b/src/osd/ReplicatedPG.cc
@@ -1608,6 +1608,7 @@ void ReplicatedPG::remove_notify(ObjectContext *obc, Watch::Notification *notif)
obc->notifs.erase(niter);
put_object_context(obc);
+ delete notif;
}
void ReplicatedPG::remove_watchers_and_notifies()
@@ -3396,17 +3397,15 @@ void ReplicatedPG::do_osd_op_effects(OpContext *ctx)
}
// ack any pending notifies
- map<void*, entity_name_t>::iterator p = session->notifs.begin();
- while (p != session->notifs.end()) {
- Watch::Notification *notif = (Watch::Notification *)p->first;
- entity_name_t by = p->second;
+ map<Watch::Notification *, bool>::iterator p = obc->notifs.begin();
+ while (p != obc->notifs.end()) {
+ Watch::Notification *notif = p->first;
+ entity_name_t by = entity;
p++;
- if (notif->obc == obc) {
- dout(10) << " acking pending notif " << notif->id << " by " << by << dendl;
- session->del_notif(notif);
- // TODOSAM: osd->osd-> not good
- osd->osd->ack_notification(entity, notif, obc, this);
- }
+ assert(notif->obc == obc);
+ dout(10) << " acking pending notif " << notif->id << " by " << by << dendl;
+ // TODOSAM: osd->osd-> not good
+ osd->osd->ack_notification(entity, notif, obc, this);
}
}
@@ -3435,7 +3434,6 @@ void ReplicatedPG::do_osd_op_effects(OpContext *ctx)
watch_info_t& w = obc->obs.oi.watchers[q->first];
notif->add_watcher(name, Watch::WATCHER_NOTIFIED); // adding before send_message to avoid race
- s->add_notif(notif, name);
MWatchNotify *notify_msg = new MWatchNotify(w.cookie, oi.user_version.version, notif->id, WATCH_NOTIFY, notif->bl);
osd->send_message_osd_client(notify_msg, s->con);
@@ -3470,7 +3468,6 @@ void ReplicatedPG::do_osd_op_effects(OpContext *ctx)
Watch::Notification *notif = osd->watch->get_notif(cookie);
assert(notif);
- session->del_notif(notif);
// TODOSAM: osd->osd-> not good
osd->osd->ack_notification(entity, notif, obc, this);
}