From d72c8834befc320e91576140ed0abace2eabbf7a Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Tue, 23 May 2017 10:15:59 -0400 Subject: [PATCH 1/1] Fix: semaphore semantics are expected from notification command eventfd MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The notification command queue currently expects eventfd() to behave according to EFD_SEMAPHORE semantics. Right now, multiple commands could be enqueued and reading the eventfd resets its internal counter to 0. This will cause the notification thread to never process the next command. EFD_SEMAPHORE will ensure that poll/epoll signals that there is info available for reading until the eventfd's internal counter returns to 0. Signed-off-by: Jérémie Galarneau --- src/bin/lttng-sessiond/notification-thread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/lttng-sessiond/notification-thread.c b/src/bin/lttng-sessiond/notification-thread.c index e0937d8e5..70ab7bb5f 100644 --- a/src/bin/lttng-sessiond/notification-thread.c +++ b/src/bin/lttng-sessiond/notification-thread.c @@ -209,7 +209,7 @@ struct notification_thread_handle *notification_thread_handle_create( } /* FIXME Replace eventfd by a pipe to support older kernels. */ - handle->cmd_queue.event_fd = eventfd(0, EFD_CLOEXEC); + handle->cmd_queue.event_fd = eventfd(0, EFD_CLOEXEC | EFD_SEMAPHORE); if (handle->cmd_queue.event_fd < 0) { PERROR("eventfd notification command queue"); goto error; -- 2.34.1