Fix: Lock FD tracker across fork
[lttng-ust.git] / liblttng-ust / lttng-ust-comm.c
index f47ae7849dfcf7bf77050c420a70fa683f36551e..fe33c5d7cfe7a1fc4f32607f3904c02c2f671d05 100644 (file)
@@ -82,6 +82,8 @@ static int initialized;
  *
  * ust_lock nests within the dynamic loader lock (within glibc) because
  * it is taken within the library constructor.
+ *
+ * The ust fd tracker lock nests within the ust_mutex.
  */
 static pthread_mutex_t ust_mutex = PTHREAD_MUTEX_INITIALIZER;
 
@@ -2040,6 +2042,7 @@ void ust_before_fork(sigset_t *save_sigset)
 
        ust_lock_nocheck();
        rcu_bp_before_fork();
+       lttng_ust_lock_fd_tracker();
 }
 
 static void ust_after_fork_common(sigset_t *restore_sigset)
@@ -2047,6 +2050,7 @@ static void ust_after_fork_common(sigset_t *restore_sigset)
        int ret;
 
        DBG("process %d", getpid());
+       lttng_ust_unlock_fd_tracker();
        ust_unlock();
 
        pthread_mutex_unlock(&ust_fork_mutex);
This page took 0.023536 seconds and 4 git commands to generate.