From: Mathieu Desnoyers Date: Mon, 3 Feb 2020 20:52:02 +0000 (-0500) Subject: Fix: event-notifier: do not flush packet if it only contains subbuf header X-Git-Tag: v2.13.0-rc1~138 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=18f12d55db4f9c78bde2738931a45557050858eb;p=lttng-modules.git Fix: event-notifier: do not flush packet if it only contains subbuf header This poll behavior returns POLLIN in situations where there is actually no event to read, which causes read to block when it should not. Signed-off-by: Mathieu Desnoyers Change-Id: I59e56cd4da9907b6f9ccdc14c6037f0f72e4505e --- diff --git a/src/lttng-abi.c b/src/lttng-abi.c index 1b08b3b7..09e43788 100644 --- a/src/lttng-abi.c +++ b/src/lttng-abi.c @@ -933,6 +933,7 @@ unsigned int lttng_event_notifier_group_notif_poll(struct file *filp, const struct lib_ring_buffer_config *config = &chan->backend.config; int finalized, disabled; unsigned long consumed, offset; + size_t subbuffer_header_size = config->cb.subbuffer_header_size(); if (filp->f_mode & FMODE_READ) { poll_wait_set_exclusive(wait); @@ -960,7 +961,7 @@ retry: /* * If there is a non-empty subbuffer, flush and try again. */ - if (subbuf_offset(offset, chan) != 0) { + if (subbuf_offset(offset, chan) > subbuffer_header_size) { lib_ring_buffer_switch_remote(buf); goto retry; }