From: Jérémie Galarneau Date: Wed, 6 Nov 2019 19:43:18 +0000 (-0500) Subject: relayd: close viewer stream trace chunk earlier on release X-Git-Tag: v2.12.0-rc1~254 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=4c2717fcf7b66d23540fd0b52d3efa885680619e;p=lttng-tools.git relayd: close viewer stream trace chunk earlier on release A viewer stream puts its references to its stream and index files within its "release" method (called when its reference count reaches 0). However, the reference to its trace chunk is only released during the RCU reclamation of the viewer stream. This unnecessarily delays the clean-up of the viewer trace chunk. For cleanliness' sake, move the release of the viewer stream's trace chunk to the release method, just after the release of the various file handles of that stream. Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-relayd/viewer-stream.c b/src/bin/lttng-relayd/viewer-stream.c index f3baf105b..8e3a19492 100644 --- a/src/bin/lttng-relayd/viewer-stream.c +++ b/src/bin/lttng-relayd/viewer-stream.c @@ -27,7 +27,6 @@ static void viewer_stream_destroy(struct relay_viewer_stream *vstream) { - lttng_trace_chunk_put(vstream->stream_file.trace_chunk); free(vstream->path_name); free(vstream->channel_name); free(vstream); @@ -212,7 +211,8 @@ static void viewer_stream_release(struct urcu_ref *ref) stream_put(vstream->stream); vstream->stream = NULL; } - + lttng_trace_chunk_put(vstream->stream_file.trace_chunk); + vstream->stream_file.trace_chunk = NULL; call_rcu(&vstream->rcu_node, viewer_stream_destroy_rcu); }