Fix: close indexes when rotating the trace files in splice mode
authorJulien Desfossez <jdesfossez@efficios.com>
Fri, 27 Nov 2015 17:12:44 +0000 (12:12 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 27 Nov 2015 20:48:31 +0000 (15:48 -0500)
The consumer needs to close the old index file when doing a file
rotation before opening a new one.
The relay does not have this problem (handled with refcounts).

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/consumer.c

index b593a2ae425d4b7cbb023cca272f2c268e30eeba..b6d564659c8a69cb2709e94d5026f15e7b08146c 100644 (file)
@@ -1758,6 +1758,12 @@ ssize_t lttng_consumer_on_read_subbuffer_splice(
                        outfd = stream->out_fd;
 
                        if (stream->index_fd >= 0) {
+                               ret = close(stream->index_fd);
+                               if (ret < 0) {
+                                       PERROR("Closing index");
+                                       goto end;
+                               }
+                               stream->index_fd = -1;
                                ret = index_create_file(stream->chan->pathname,
                                                stream->name, stream->uid, stream->gid,
                                                stream->chan->tracefile_size,
This page took 0.02636 seconds and 4 git commands to generate.