]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: fix ref cycle breakage in handle_forward
authorSage Weil <sage@redhat.com>
Thu, 13 Sep 2018 19:00:44 +0000 (14:00 -0500)
committerSage Weil <sage@redhat.com>
Sun, 14 Oct 2018 17:01:09 +0000 (12:01 -0500)
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 <sage@redhat.com>
src/mon/Monitor.cc

index b6fe93de226fd8160ce193e295e5b5cde56837ee..76ee7b1911a40d7675f365d2f91ec096520d8c37 100644 (file)
@@ -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);
   }
 }