Mutex while updating statedump_pending is not needed
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 16 Jul 2014 21:40:53 +0000 (17:40 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 16 Jul 2014 21:40:53 +0000 (17:40 -0400)
Take care of coverity warning ** CID 1226392:  Data race condition  (MISSING_LOCK)
/liblttng-ust/lttng-ust-comm.c: 1704 in lttng_ust_sockinfo_session_enabled()

It's not that the lock is missing, it's that we don't need to hold the
lock when doing the other modification.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
liblttng-ust/lttng-ust-comm.c

index 3a3e1d2827c82ea48ef6a79c1b89293ffbfce5b9..3df2adc6f96e0b0b16189efe6497509ea845e3da 100644 (file)
@@ -518,8 +518,8 @@ void handle_pending_statedump(struct sock_info *sock_info)
        int ctor_passed = sock_info->constructor_sem_posted;
 
        if (ctor_passed && sock_info->statedump_pending) {
-               pthread_mutex_lock(&ust_fork_mutex);
                sock_info->statedump_pending = 0;
+               pthread_mutex_lock(&ust_fork_mutex);
                lttng_handle_pending_statedump(sock_info);
                pthread_mutex_unlock(&ust_fork_mutex);
        }
This page took 0.02719 seconds and 4 git commands to generate.