Fix: kernel consumer: signal metadata ready condition variable
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 30 Apr 2021 14:44:44 +0000 (10:44 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 11 May 2021 15:22:06 +0000 (11:22 -0400)
The behaviour of the kernel consumer does not match that of the user
space consumer. When a live metadata stream goes back to "sleep", it
must broadcast on the metadata_rdv to wake-up any thread that is
performing a metadata sync.

This mismatch causes a hang in the kernel consumer during the kernel
clear tests.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I7c93007b6d08f340881c08f23931582443bfa397

src/common/kernel-consumer/kernel-consumer.c

index 32f55f0b736d1cc59ffd47ee7ff395e926a02bb5..c0d8e09720b1c3409fda2fb315f1b79d8ca98068 100644 (file)
@@ -1647,6 +1647,14 @@ bool is_get_next_check_metadata_available(int tracer_fd)
        return available;
 }
 
+static
+int signal_metadata(struct lttng_consumer_stream *stream,
+               struct lttng_consumer_local_data *ctx)
+{
+       ASSERT_LOCKED(stream->metadata_rdv_lock);
+       return pthread_cond_broadcast(&stream->metadata_rdv) ? -errno : 0;
+}
+
 static
 int lttng_kconsumer_set_stream_ops(
                struct lttng_consumer_stream *stream)
@@ -1677,6 +1685,8 @@ int lttng_kconsumer_set_stream_ops(
                        metadata_bucket_destroy(stream->metadata_bucket);
                        stream->metadata_bucket = NULL;
                }
+
+               stream->read_subbuffer_ops.on_sleep = signal_metadata;
        }
 
        if (!stream->read_subbuffer_ops.get_next_subbuffer) {
This page took 0.029776 seconds and 4 git commands to generate.