relayd: close viewer stream trace chunk earlier on release
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 6 Nov 2019 19:43:18 +0000 (14:43 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 6 Nov 2019 19:47:22 +0000 (14:47 -0500)
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 <jeremie.galarneau@efficios.com>
src/bin/lttng-relayd/viewer-stream.c

index f3baf105bb466dd36f2edd23f69a3a535f21f556..8e3a1949288dfddf250b0f5cd6edfb3690318218 100644 (file)
@@ -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);
 }
 
This page took 0.034617 seconds and 4 git commands to generate.