diff options
author | Samuel Just <sam.just@inktank.com> | 2012-12-20 13:23:27 -0800 |
---|---|---|
committer | Samuel Just <sam.just@inktank.com> | 2012-12-20 13:27:24 -0800 |
commit | b5031a223352901ad8f32e38f3b0a6f3cc03ec5a (patch) | |
tree | cd66acfd2f1e11fd444e80c9dec7554f8cf618f5 | |
parent | 17c627b5e4b763f08af05f28597acc4a7b28ae78 (diff) | |
download | ceph-b5031a223352901ad8f32e38f3b0a6f3cc03ec5a.tar.gz |
OSD,ReplicatedPG: do not track notifies on the session
handle_notify_timeout and remove_notify currently do not clean up this
state leaving dangling Notification*. Further, we only use this mapping
in unwatch in order to determine which notifies to update. We can
accomplish the same thing by iterating through the obc->notifs mapping
since all notifications relevant for a given watch would have been for
the same obc as the watch.
Signed-off-by: Samuel Just <sam.just@inktank.com>
-rw-r--r-- | src/osd/OSD.h | 9 | ||||
-rw-r--r-- | src/osd/ReplicatedPG.cc | 20 |
2 files changed, 8 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..0d07f7279c9 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -3396,17 +3396,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 +3433,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 +3467,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); } |