]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: break con <-> session ref cycle in mon even if shutting down
authorSage Weil <sage@inktank.com>
Thu, 18 Jul 2013 21:44:17 +0000 (14:44 -0700)
committerGreg Farnum <greg@inktank.com>
Fri, 19 Jul 2013 20:21:48 +0000 (13:21 -0700)
If we get a reset during shutdown, we should still break the cycle to avoid
tripping the valgrind leak detection.  Note that we are touching no
internal Monitor state here and the locking has not changed.

Signed-off-by: Sage Weil <sage@inktank.com>
src/mon/Monitor.cc

index 9ae3e93a111b3075d59c9666c838b4441a78f4a8..3ff0a6418b23fab5629dcd16d47373c0832c2c12 100644 (file)
@@ -3242,9 +3242,6 @@ bool Monitor::ms_handle_reset(Connection *con)
 {
   dout(10) << "ms_handle_reset " << con << " " << con->get_peer_addr() << dendl;
 
-  if (is_shutdown())
-    return false;
-
   // ignore lossless monitor sessions
   if (con->get_peer_type() == CEPH_ENTITY_TYPE_MON)
     return false;
@@ -3253,6 +3250,12 @@ bool Monitor::ms_handle_reset(Connection *con)
   if (!s)
     return false;
 
+  // break any con <-> session ref cycle
+  s->con->set_priv(NULL);
+
+  if (is_shutdown())
+    return false;
+
   Mutex::Locker l(lock);
 
   dout(10) << "reset/close on session " << s->inst << dendl;