From 4c2717fcf7b66d23540fd0b52d3efa885680619e Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Wed, 6 Nov 2019 14:43:18 -0500 Subject: [PATCH 1/1] relayd: close viewer stream trace chunk earlier on release MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- src/bin/lttng-relayd/viewer-stream.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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); } -- 2.34.1