From: Sage Weil Date: Thu, 13 Sep 2018 19:00:44 +0000 (-0500) Subject: mon: fix ref cycle breakage in handle_forward X-Git-Tag: v14.0.1~26^2~17 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9ddb9bfd8b541b2c154064277b725b0289aafb93;p=ceph.git mon: fix ref cycle breakage in handle_forward We now rely on the session -> connection ref for printing remote addr, peer_global_id, and so on. Change this code to break the ref cycle instead by removing the con->session link, which is only needed by the MonOpRequest ctor called at the top of _ms_dispatch. Signed-off-by: Sage Weil --- diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index b6fe93de226fd..76ee7b1911a40 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -3740,18 +3740,13 @@ void Monitor::handle_forward(MonOpRequestRef op) */ req->rx_election_epoch = get_epoch(); - /* Because this is a special fake connection, we need to break - the ref loop between Connection and MonSession differently - than we normally do. Here, the Message refers to the Connection - which refers to the Session, and nobody else refers to the Connection - or the Session. And due to the special nature of this message, - nobody refers to the Connection via the Session. So, clear out that - half of the ref loop.*/ - s->con.reset(NULL); - dout(10) << " mesg " << req << " from " << m->get_source_addr() << dendl; - _ms_dispatch(req); + + // break the session <-> con ref loop by removing the con->session + // reference, which is no longer needed once the MonOpRequest is + // set up. + c->set_priv(NULL); } }