From 8d71b6c18330f1a645a002b365584ccd69781470 Mon Sep 17 00:00:00 2001 From: Adam Crume Date: Wed, 13 Aug 2014 11:42:00 -0700 Subject: [PATCH] lttng: Remove tracing from libcommon This is a short-term fix for issues caused by tracepoints in libcommon. Code crashes at runtime if the same tracepoints are linked into the program multiple times. This happens with libcommon because it is statically linked into dynamic libraries such as librados, then statically linked into executables because symbols from libcommon are not exposed in librados. Therefore, any programs that use librados and libcommon would crash because of duplicate tracepoints. Signed-off-by: Adam Crume --- src/Makefile-env.am | 1 - src/common/Makefile.am | 4 ---- src/common/Mutex.cc | 9 +-------- src/tracing/Makefile.am | 11 ----------- src/tracing/mutex.tp | 29 ----------------------------- 5 files changed, 1 insertion(+), 53 deletions(-) delete mode 100644 src/tracing/mutex.tp diff --git a/src/Makefile-env.am b/src/Makefile-env.am index a2a9fc338403..f2ab6558bc84 100644 --- a/src/Makefile-env.am +++ b/src/Makefile-env.am @@ -156,7 +156,6 @@ LIBRBD = librbd.la LIBKRBD = libkrbd.la LIBCEPHFS = libcephfs.la LIBERASURE_CODE = liberasure_code.la -LIBCOMMON_TP = tracing/libcommon_tp.la LIBOSD_TP = tracing/libosd_tp.la LIBRADOS_TP = tracing/librados_tp.la LIBRBD_TP = tracing/librbd_tp.la diff --git a/src/common/Makefile.am b/src/common/Makefile.am index 52d6db8d8410..0b99c6e3f158 100644 --- a/src/common/Makefile.am +++ b/src/common/Makefile.am @@ -114,10 +114,6 @@ LIBCOMMON_DEPS += \ $(LIBMSG) $(LIBAUTH) \ $(LIBCRUSH) $(LIBJSON_SPIRIT) $(LIBLOG) $(LIBARCH) -if WITH_LTTNG -LIBCOMMON_DEPS += $(LIBCOMMON_TP) -endif - if LINUX LIBCOMMON_DEPS += -lrt endif # LINUX diff --git a/src/common/Mutex.cc b/src/common/Mutex.cc index 4b87819667c1..a0c1202183dc 100644 --- a/src/common/Mutex.cc +++ b/src/common/Mutex.cc @@ -20,10 +20,6 @@ #include "include/utime.h" #include "common/Clock.h" -#ifdef WITH_LTTNG -#include "tracing/mutex.h" -#endif - Mutex::Mutex(const char *n, bool r, bool ld, bool bt, CephContext *cct) : @@ -84,8 +80,6 @@ void Mutex::Lock(bool no_lockdep) { utime_t start; int r; - tracepoint(mutex, lock_enter, this, name); - if (lockdep && g_lockdep && !no_lockdep) _will_lock(); if (TryLock()) { @@ -103,7 +97,7 @@ void Mutex::Lock(bool no_lockdep) { _post_lock(); out: - tracepoint(mutex, lock_exit, this, name); + ; } void Mutex::Unlock() { @@ -111,5 +105,4 @@ void Mutex::Unlock() { if (lockdep && g_lockdep) _will_unlock(); int r = pthread_mutex_unlock(&_m); assert(r == 0); - tracepoint(mutex, unlock, this, name); } diff --git a/src/tracing/Makefile.am b/src/tracing/Makefile.am index d9eceaf8b7c8..5da5e45d7d85 100644 --- a/src/tracing/Makefile.am +++ b/src/tracing/Makefile.am @@ -6,19 +6,11 @@ if WITH_LTTNG dist_noinst_DATA = \ librados.tp \ librbd.tp \ - mutex.tp \ oprequest.tp \ osd.tp \ pg.tp \ objectstore.tp -libcommon_tp_la_SOURCES = \ - mutex.c \ - mutex.h -libcommon_tp_la_LIBADD = -llttng-ust -ldl -libcommon_tp_la_CPPFLAGS = -DTRACEPOINT_PROBE_DYNAMIC_LINKAGE -libcommon_tp_la_LDFLAGS = - libosd_tp_la_SOURCES = \ oprequest.c \ oprequest.h \ @@ -52,7 +44,6 @@ libos_tp_la_CPPFLAGS = -DTRACEPOINT_PROBE_DYNAMIC_LINKAGE libos_tp_la_LDFLAGS = noinst_LTLIBRARIES = \ - libcommon_tp.la \ libosd_tp.la \ librados_tp.la \ librbd_tp.la \ @@ -61,14 +52,12 @@ noinst_LTLIBRARIES = \ BUILT_SOURCES = \ librados.h \ librbd.h \ - mutex.h \ oprequest.h \ osd.h \ pg.h \ objectstore.h CLEANFILES = \ - $(libcommon_tp_la_SOURCES) \ $(libosd_tp_la_SOURCES) \ $(librados_tp_la_SOURCES) \ $(librbd_tp_la_SOURCES) \ diff --git a/src/tracing/mutex.tp b/src/tracing/mutex.tp deleted file mode 100644 index 7cdfdb35064c..000000000000 --- a/src/tracing/mutex.tp +++ /dev/null @@ -1,29 +0,0 @@ -TRACEPOINT_EVENT(mutex, lock_enter, - TP_ARGS( - const void *, addr, - const char *, name), - TP_FIELDS( - ctf_integer_hex(unsigned long, addr, addr) - ctf_string(name, name) - ) -) - -TRACEPOINT_EVENT(mutex, lock_exit, - TP_ARGS( - const void *, addr, - const char *, name), - TP_FIELDS( - ctf_integer_hex(unsigned long, addr, addr) - ctf_string(name, name) - ) -) - -TRACEPOINT_EVENT(mutex, unlock, - TP_ARGS( - const void *, addr, - const char *, name), - TP_FIELDS( - ctf_integer_hex(unsigned long, addr, addr) - ctf_string(name, name) - ) -) -- 2.47.3