Fix: relayd: don't call lttng_ht_destroy in RCU read-side C.S.
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 17 Sep 2015 16:48:40 +0000 (12:48 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 18 Sep 2015 16:38:16 +0000 (12:38 -0400)
It is forbidden to call lttng_ht_destroy() within a RCU read-side
critical section.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-relayd/session.c
src/bin/lttng-relayd/stream.c

index 14ae874ea782ef45624447659d988c1bd3a05258..2300e5f1adab5c6c2190af4829cb9c2767f3e2f3 100644 (file)
@@ -131,7 +131,14 @@ static void rcu_destroy_session(struct rcu_head *rcu_head)
        struct relay_session *session =
                        caa_container_of(rcu_head, struct relay_session,
                                rcu_node);
-
+       /*
+        * Since each trace has a reference on the session, it means
+        * that if we are at the point where we teardown the session, no
+        * trace belonging to that session exist at this point.
+        * Calling lttng_ht_destroy in call_rcu worker thread so we
+        * don't hold the RCU read-side lock while calling it.
+        */
+       lttng_ht_destroy(session->ctf_traces_ht);
        free(session);
 }
 
@@ -155,12 +162,6 @@ static void destroy_session(struct relay_session *session)
 
        ret = session_delete(session);
        assert(!ret);
-       /*
-        * Since each trace has a reference on the session, it means
-        * that if we are at the point where we teardown the session, no
-        * trace belonging to that session exist at this point.
-        */
-       lttng_ht_destroy(session->ctf_traces_ht);
        call_rcu(&session->rcu_node, rcu_destroy_session);
 }
 
index b604919a78b376062cc52ed8a0a5b189d0be3143..8825d094ce57b389662667bfd5d567ca0ed77cfd 100644 (file)
@@ -253,6 +253,11 @@ static void stream_unpublish(struct relay_stream *stream)
 static void stream_destroy(struct relay_stream *stream)
 {
        if (stream->indexes_ht) {
+               /*
+                * Calling lttng_ht_destroy in call_rcu worker thread so
+                * we don't hold the RCU read-side lock while calling
+                * it.
+                */
                lttng_ht_destroy(stream->indexes_ht);
        }
        if (stream->tfa) {
This page took 0.026095 seconds and 4 git commands to generate.