X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Fconsumer-timer.c;h=a32dbf64d2d229e730f6e87a4add490c75567a39;hb=4fa3dc0ebca381a211ace01c3320591529b5b833;hp=f9c41c0eb0f8f9f32def26028f743ce7df45d322;hpb=2b8f875486548c9d54d62ae465e2fb23c7023d2c;p=lttng-tools.git diff --git a/src/common/consumer-timer.c b/src/common/consumer-timer.c index f9c41c0eb..a32dbf64d 100644 --- a/src/common/consumer-timer.c +++ b/src/common/consumer-timer.c @@ -56,6 +56,10 @@ static void setmask(sigset_t *mask) /* * Execute action on a timer switch. + * + * Beware: metadata_switch_timer() should *never* take a mutex also held + * while consumer_timer_switch_stop() is called. It would result in + * deadlocks. */ static void metadata_switch_timer(struct lttng_consumer_local_data *ctx, int sig, siginfo_t *si, void *uc) @@ -74,6 +78,22 @@ static void metadata_switch_timer(struct lttng_consumer_local_data *ctx, switch (ctx->type) { case LTTNG_CONSUMER32_UST: case LTTNG_CONSUMER64_UST: + /* + * Locks taken by lttng_ustconsumer_request_metadata(): + * - metadata_socket_lock + * - Calling lttng_ustconsumer_recv_metadata(): + * - consumer_data.lock + * - channel->lock + * - channel->metadata_cache->lock + * - Calling consumer_metadata_cache_flushed(): + * - consumer_data.lock + * - channel->lock + * - channel->metadata_cache->lock + * + * Both consumer_data.lock and channel->lock currently + * cause a deadlock, since they are held while + * consumer_timer_switch_stop() is called. + */ ret = lttng_ustconsumer_request_metadata(ctx, channel); if (ret < 0) { channel->switch_timer_error = 1;