]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: clean up waiting_for_map messages on shutdown
authorSage Weil <sage@inktank.com>
Tue, 16 Jul 2013 21:49:55 +0000 (14:49 -0700)
committerSage Weil <sage@inktank.com>
Tue, 16 Jul 2013 21:49:59 +0000 (14:49 -0700)
Do not leak these.

Fixes: #5643
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com>
src/mon/OSDMonitor.cc
src/mon/OSDMonitor.h
src/mon/PaxosService.cc
src/mon/PaxosService.h

index eaec014516bab2de33e91aebd5a5bc72565a924c..2b4de6d426d068438f0c428a8f5617bfccbc2820 100644 (file)
@@ -308,6 +308,21 @@ void OSDMonitor::on_active()
   }
 }
 
+void OSDMonitor::on_shutdown()
+{
+  dout(10) << __func__ << dendl;
+  map<epoch_t, list<PaxosServiceMessage*> >::iterator p = waiting_for_map.begin();
+  while (p != waiting_for_map.end()) {
+    while (!p->second.empty()) {
+      Message *m = p->second.front();
+      dout(20) << " discarding " << m << " " << *m << dendl;
+      m->put();
+      p->second.pop_front();
+    }
+    waiting_for_map.erase(p++);
+  }
+}
+
 void OSDMonitor::update_logger()
 {
   dout(10) << "update_logger" << dendl;
index 3d901a8f1396356857ec588985f1cc769070e054..d65532283210ca62361d6fb44519b8c096b08af5 100644 (file)
@@ -154,6 +154,7 @@ private:
   void encode_pending(MonitorDBStore::Transaction *t);
   virtual void encode_full(MonitorDBStore::Transaction *t);
   void on_active();
+  void on_shutdown();
 
   /**
    * do not let paxosservice periodically stash full osdmaps, or we will break our
index f5416a8fa87d7582a25744eeddffcd6f0b3c5399..d6e67a1c4b4c0eba1741678cdadde6ff5b7cedf3 100644 (file)
@@ -313,6 +313,8 @@ void PaxosService::shutdown()
   }
 
   finish_contexts(g_ceph_context, waiting_for_finished_proposal, -EAGAIN);
+
+  on_shutdown();
 }
 
 void PaxosService::maybe_trim()
index 6c8d9c0bcc48cfaac34897cb79cdfa36cd7058a2..a5761d19ad8371d6628219a09a0aef02c1290ac6 100644 (file)
@@ -445,6 +445,11 @@ public:
    */
   virtual void on_active() { }
 
+  /**
+   * This is called when we are shutting down
+   */
+  virtual void on_shutdown() {}
+
   /**
    * this is called when activating on the leader
    *