Fix: perf counter context deadlock
[lttng-ust.git] / liblttng-ust / lttng-ust-statedump.c
index c2926aecdb78eeaffc097cf6fe27d04f9e89330c..4242579fa13616341c7607667d31e523d88be486 100644 (file)
@@ -334,12 +334,22 @@ int do_baddr_statedump(void *owner)
  * session, statedumps from different processes may be
  * interleaved. The vpid context should be used to identify which
  * events belong to which process.
+ *
+ * Grab the ust_lock outside of the RCU read-side lock because we
+ * perform synchronize_rcu with the ust_lock held, which can trigger
+ * deadlocks otherwise.
  */
 int do_lttng_ust_statedump(void *owner)
 {
+       ust_lock_nocheck();
        trace_statedump_start(owner);
+       ust_unlock();
+
        do_baddr_statedump(owner);
+
+       ust_lock_nocheck();
        trace_statedump_end(owner);
+       ust_unlock();
 
        return 0;
 }
This page took 0.023609 seconds and 4 git commands to generate.