Fix: namespace contexts !CONFIG_RCU_TLS variable initialization
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 9 Apr 2020 15:29:18 +0000 (11:29 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 9 Apr 2020 15:29:18 +0000 (11:29 -0400)
The namespace contexts introduced in lttng-ust 2.12 require to
initialize TLS variable to nonzero values. However, in !CONFIG_RCU_TLS
(compatibility mode using pthread setspecific), this initialization
does not build.

Use the new DEFINE_URCU_TLS_INIT from liburcu when building
!CONFIG_RCU_TLS to fix this issue. Since this requires a dependency on
a new liburcu version, only !CONFIG_RCU_TLS adds this dependency in the
fix. A followup cleanup patch will use DEFINE_URCU_TLS_INIT as we add
a strict version dependency.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
liblttng-ust/lttng-context-cgroup-ns.c
liblttng-ust/lttng-context-ipc-ns.c
liblttng-ust/lttng-context-net-ns.c
liblttng-ust/lttng-context-uts-ns.c

index 3526798faf99fef593485efcf900d606b8cfca93..cd9e2bc1f1de694ae3e04c3dae470d44fa1b896f 100644 (file)
  * We cache the result to ensure we don't stat(2) the proc filesystem on
  * each event.
  */
+#ifdef CONFIG_RCU_TLS
 static DEFINE_URCU_TLS(ino_t, cached_cgroup_ns) = NS_INO_UNINITIALIZED;
+#else
+static DEFINE_URCU_TLS_INIT(ino_t, cached_cgroup_ns, NS_INO_UNINITIALIZED);
+#endif
 
 static
 ino_t get_cgroup_ns(void)
index 64b3cd8e770c51cbd2587e4ab44463a0c2a7bd5c..9890b03b5ed39340df16b5d162658b147529e2cd 100644 (file)
 #include "lttng-tracer-core.h"
 #include "ns.h"
 
-
 /*
  * We cache the result to ensure we don't stat(2) the proc filesystem on
  * each event.
  */
+#ifdef CONFIG_RCU_TLS
 static DEFINE_URCU_TLS(ino_t, cached_ipc_ns) = NS_INO_UNINITIALIZED;
+#else
+static DEFINE_URCU_TLS_INIT(ino_t, cached_ipc_ns, NS_INO_UNINITIALIZED);
+#endif
 
 static
 ino_t get_ipc_ns(void)
index 3da46d636f107334c0f0e44955d2ff8d5eb4ba9c..c1ae97967ab5679d3b68c1328b40f0dcb9b4d4fc 100644 (file)
 #include "lttng-tracer-core.h"
 #include "ns.h"
 
-
 /*
  * We cache the result to ensure we don't stat(2) the proc filesystem on
  * each event.
  */
+#ifdef CONFIG_RCU_TLS
 static DEFINE_URCU_TLS(ino_t, cached_net_ns) = NS_INO_UNINITIALIZED;
+#else
+static DEFINE_URCU_TLS_INIT(ino_t, cached_net_ns, NS_INO_UNINITIALIZED);
+#endif
 
 static
 ino_t get_net_ns(void)
index 43faad0dc32b6bbaae76789c4bc84f600aeba46a..77bb21bc51f16543490bf919a99c7e82d11005b4 100644 (file)
  * We cache the result to ensure we don't stat(2) the proc filesystem on
  * each event.
  */
+#ifdef CONFIG_RCU_TLS
 static DEFINE_URCU_TLS(ino_t, cached_uts_ns) = NS_INO_UNINITIALIZED;
+#else
+static DEFINE_URCU_TLS_INIT(ino_t, cached_uts_ns, NS_INO_UNINITIALIZED);
+#endif
 
 static
 ino_t get_uts_ns(void)
This page took 0.029015 seconds and 5 git commands to generate.