From 3f0c969023c8aa14ed2ad12a97a8a70e07254dc6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Thu, 2 Apr 2020 00:57:38 -0400 Subject: [PATCH 1/1] Fix: consumer: fallback to flush when flush empty is unsupported MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Session destruction fails on older (<= 2.8) lttng-modules as the flush_empty fails on the kernel streams during the quiet rotation. Fallback to the regular flush as the semantics of regular rotations are not expected here; we merely want to flush any pending data and destroy the session. Signed-off-by: Jérémie Galarneau Change-Id: Ifdf8a4e60b55dbf582747d71f5c2485d24c11964 --- src/common/consumer/consumer.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/common/consumer/consumer.c b/src/common/consumer/consumer.c index 4613284a8..c043353b9 100644 --- a/src/common/consumer/consumer.c +++ b/src/common/consumer/consumer.c @@ -3953,8 +3953,18 @@ int consumer_flush_buffer(struct lttng_consumer_stream *stream, int producer_act } else { ret = kernctl_buffer_flush_empty(stream->wait_fd); if (ret < 0) { - ERR("Failed to flush kernel stream"); - goto end; + /* + * Doing a buffer flush which does not take into + * account empty packets. This is not perfect, + * but required as a fall-back when + * "flush_empty" is not implemented by + * lttng-modules. + */ + ret = kernctl_buffer_flush(stream->wait_fd); + if (ret < 0) { + ERR("Failed to flush kernel stream"); + goto end; + } } } break; -- 2.34.1