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:32:39 +0000 (11:32 -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 d4053150c5432bcec4ca3a4f4bd9e7142e2185bb..97af2759578473a1d9c95075221b24c9c564718d 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 c973dc86dd06ec246f627a8bc7bbf17a80ef2cf2..a05a6c616a5fe4eee378c0c5b82a916e14288a66 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 9d6ded12965d5213b6995cbff5705258e6a534d9..c0aaa9d4a7d57ccdbe4c626d890f5b1c4a9c583f 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 fb2d89f94bfa3ceee709fce0179e0dfb7c64a22e..778ccb46b31c657c3ac83c0f096c2c2f833b704f 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.026944 seconds and 4 git commands to generate.