X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-relayd%2Fsession.c;h=d1c2098f8591a3a8c9c5e87b022f43e8fff627ee;hp=33d7d43c0f67b5814c02c5fabe1db15c69e4c059;hb=ce3f3ba3aee62c0a317b448c2f19578ab7f057e4;hpb=7591bab11eceedc6a0d1e02fd6f85592267a63b5 diff --git a/src/bin/lttng-relayd/session.c b/src/bin/lttng-relayd/session.c index 33d7d43c0..d1c2098f8 100644 --- a/src/bin/lttng-relayd/session.c +++ b/src/bin/lttng-relayd/session.c @@ -17,7 +17,6 @@ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#define _GNU_SOURCE #define _LGPL_SOURCE #include #include @@ -131,7 +130,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 +161,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); } @@ -212,7 +212,8 @@ unlock: } cds_list_for_each_entry_rcu(stream, &session->recv_list, recv_node) { - stream_close(stream); + /* Close streams which have not been published yet. */ + try_stream_close(stream); } rcu_unlock: rcu_read_unlock(); @@ -229,6 +230,10 @@ void print_sessions(void) struct lttng_ht_iter iter; struct relay_session *session; + if (!sessions_ht) { + return; + } + rcu_read_lock(); cds_lfht_for_each_entry(sessions_ht->ht, &iter.iter, session, session_n.node) {