X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-relayd%2Fctf-trace.c;h=02a8b2bf16e6b553ccd6d4059c88634aa42bd49d;hb=0c0e3b4112d52fb54a844300b36f1373e3055c8f;hp=6fe77a5b4438f5833e9eaa9bfeb3c092aaacf964;hpb=2a174661a1e0ab551b41ff1cae7191688525fc1f;p=lttng-tools.git diff --git a/src/bin/lttng-relayd/ctf-trace.c b/src/bin/lttng-relayd/ctf-trace.c index 6fe77a5b4..02a8b2bf1 100644 --- a/src/bin/lttng-relayd/ctf-trace.c +++ b/src/bin/lttng-relayd/ctf-trace.c @@ -17,6 +17,7 @@ */ #define _GNU_SOURCE +#define _LGPL_SOURCE #include #include @@ -38,6 +39,14 @@ static void rcu_destroy_ctf_trace(struct rcu_head *head) free(trace); } +static void rcu_destroy_stream(struct rcu_head *head) +{ + struct relay_stream *stream = + caa_container_of(head, struct relay_stream, rcu_node); + + stream_destroy(stream); +} + /* * Destroy a ctf trace and all stream contained in it. * @@ -57,7 +66,7 @@ void ctf_trace_destroy(struct ctf_trace *obj) cds_list_for_each_entry_safe(stream, tmp_stream, &obj->stream_list, trace_list) { stream_delete(relay_streams_ht, stream); - stream_destroy(stream); + call_rcu(&stream->rcu_node, rcu_destroy_stream); } call_rcu(&obj->node.head, rcu_destroy_ctf_trace); @@ -75,6 +84,7 @@ void ctf_trace_try_destroy(struct relay_session *session, */ if (uatomic_read(&session->viewer_refcount) == 0 && uatomic_read(&ctf_trace->refcount) == 0) { + ctf_trace_delete(session->ctf_traces_ht, ctf_trace); ctf_trace_destroy(ctf_trace); } } @@ -107,6 +117,8 @@ error: /* * Return a ctf_trace object if found by id in the given hash table else NULL. + * + * Must be called with rcu_read_lock() taken. */ struct ctf_trace *ctf_trace_find_by_path(struct lttng_ht *ht, char *path_name)