From 30de04066d874921b7d721bfcb0f363df8a735f1 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 18 Jul 2013 14:44:17 -0700 Subject: [PATCH] mon: break con <-> session ref cycle in mon even if shutting down 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 --- src/mon/Monitor.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 9ae3e93a111b3..3ff0a6418b23f 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -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; -- 2.39.5