Fix: channel lock must be taken to check for pending notifications
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 9 Jan 2018 22:00:41 +0000 (17:00 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 3 Apr 2018 16:12:29 +0000 (12:12 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/lib/lttng-ctl/channel.c

index 3d48babb728351b3c05489b370419afbab415e6d..f2daf0d50e360f050e3146431b1fede07833ddf3 100644 (file)
@@ -215,6 +215,8 @@ lttng_notification_channel_get_next_notification(
                goto end;
        }
 
+       pthread_mutex_lock(&channel->lock);
+
        if (channel->pending_notifications.count) {
                struct pending_notification *pending_notification;
 
@@ -232,11 +234,9 @@ lttng_notification_channel_get_next_notification(
                cds_list_del(&pending_notification->node);
                channel->pending_notifications.count--;
                free(pending_notification);
-               goto end;
+               goto end_unlock;
        }
 
-       pthread_mutex_lock(&channel->lock);
-
        ret = receive_message(channel);
        if (ret) {
                status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
This page took 0.026277 seconds and 5 git commands to generate.