[lttng-dev] [LTTNG-TOOLS PATCH] Fix: close indexes when rotating the trace files

Julien Desfossez jdesfossez at efficios.com
Fri Nov 27 12:12:44 EST 2015


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 at efficios.com>
---
 src/common/consumer/consumer.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/common/consumer/consumer.c b/src/common/consumer/consumer.c
index 2897fb8..5a90c29 100644
--- a/src/common/consumer/consumer.c
+++ b/src/common/consumer/consumer.c
@@ -1779,6 +1779,11 @@ 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;
+				}
 				ret = index_create_file(stream->chan->pathname,
 						stream->name, stream->uid, stream->gid,
 						stream->chan->tracefile_size,
-- 
1.9.1




More information about the lttng-dev mailing list