From: Mathieu Desnoyers Date: Fri, 30 Apr 2021 14:44:44 +0000 (-0400) Subject: Fix: kernel consumer: signal metadata ready condition variable X-Git-Tag: v2.13.0-rc2~42 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=ee0350f8480addf9d786664e748645ab73a84565;p=lttng-tools.git Fix: kernel consumer: signal metadata ready condition variable 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 Signed-off-by: Jérémie Galarneau Change-Id: Ief15fc2b7c92582ea36bf64d185720e48d2c94d5 --- diff --git a/src/common/kernel-consumer/kernel-consumer.c b/src/common/kernel-consumer/kernel-consumer.c index 4f734294c..46a9f52c0 100644 --- a/src/common/kernel-consumer/kernel-consumer.c +++ b/src/common/kernel-consumer/kernel-consumer.c @@ -1710,6 +1710,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) @@ -1740,6 +1748,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) {