From a32bd7757cc9f642b3977897819982ed1eb3be80 Mon Sep 17 00:00:00 2001 From: David Goulet Date: Mon, 3 Jun 2013 13:05:22 -0400 Subject: [PATCH] Fix: skip metadata flushed check if write failed On a metadata cache write failure, we now skip the metadata flushed check or else an infinite loop could have been possible. Acked-by: Julien Desfossez Acked-by: Mathieu Desnoyers Signed-off-by: David Goulet --- src/common/ust-consumer/ust-consumer.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/common/ust-consumer/ust-consumer.c b/src/common/ust-consumer/ust-consumer.c index 6acaacd63..f7ffb0feb 100644 --- a/src/common/ust-consumer/ust-consumer.c +++ b/src/common/ust-consumer/ust-consumer.c @@ -751,6 +751,14 @@ int lttng_ustconsumer_recv_metadata(int sock, uint64_t key, uint64_t offset, if (ret < 0) { /* Unable to handle metadata. Notify session daemon. */ ret_code = LTTCOMM_CONSUMERD_ERROR_METADATA; + /* + * Skip metadata flush on write error since the offset and len might + * not have been updated which could create an infinite loop below when + * waiting for the metadata cache to be flushed. + */ + pthread_mutex_unlock(&channel->metadata_cache->lock); + pthread_mutex_unlock(&consumer_data.lock); + goto end_free; } pthread_mutex_unlock(&channel->metadata_cache->lock); pthread_mutex_unlock(&consumer_data.lock); -- 2.34.1