]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
OSD,ReplicatedPG: do not track notifies on the session
authorSamuel Just <sam.just@inktank.com>
Thu, 20 Dec 2012 21:23:27 +0000 (13:23 -0800)
committerSamuel Just <sam.just@inktank.com>
Thu, 20 Dec 2012 21:27:24 +0000 (13:27 -0800)
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>
src/osd/OSD.h
src/osd/ReplicatedPG.cc

index ce38739118066bb21d27886b0714525f29898d49..211a4c1fe7cb58681cf78de6a45b1201bd1a2fc8 100644 (file)
@@ -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:
index 4c6c481cc65c76dc0bc2615a1640886d21784f29..0d07f7279c9c67a78ed9d35e88f9e3cd335fc966 100644 (file)
@@ -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);
     }