Skip to contentSkip to conversation

Fix: close indexes when rotating the trace files

PATCH Jérémie Galarneau 1 participant 1 message Nov 27, 2015 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 14 lines · Julien Desfossez

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).

---
 src/common/consumer/consumer.c | 5 +++++
 1 file changed, 5 insertions(+)
src/common/consumer/consumer.c +0 -0
index 2897fb8..5a90c29 100644

src/common/consumer/consumer.c ssize_t lttng_consumer_on_read_subbuffer_splice( · line 1786

Quoted 8 lines
src/common/consumer/consumer.c +5 -0
@@ -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;
+                               }

Good catch! I'm adding "stream->index_fd = -1;" here to make sure the index_fd is not closed a second time (on teardown) should the index file creation fail below.

Thanks!
Jérémie

Quoted 6 lines
src/common/consumer/consumer.c +0 -1
                                ret = index_create_file(stream->chan->pathname,
                                                stream->name, stream->uid, stream->gid,
                                                stream->chan->tracefile_size,
--

1.9.1

Signature · 8 lines
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev