summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/glusterfs
diff options
context:
space:
mode:
authorDmitry Antipov <dmantipov@yandex.ru>2020-07-28 16:38:29 +0300
committerAmar Tumballi <amar@kadalu.io>2020-08-11 04:39:46 +0000
commit634ce64d0f03ddf3c2a3c05ce21cf9cdcbb763c5 (patch)
tree2b88b83b0dca81dcd6aa5bf27451fa65b8ea820a /libglusterfs/src/glusterfs
parent163aa7d2bcbba71107602ab6672da1af53b31726 (diff)
libglusterfs: annotate synctasks with ThreadSanitizer API
If --enable-tsan is specified and API headers are detected, annotate synctask context initialization and context switch with ThreadSanitizer API. Change-Id: I7ac4085d7ed055448f1fc80df7d59905d129f186 Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru> Fixes: #1400
Diffstat (limited to 'libglusterfs/src/glusterfs')
-rw-r--r--libglusterfs/src/glusterfs/syncop.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/libglusterfs/src/glusterfs/syncop.h b/libglusterfs/src/glusterfs/syncop.h
index 1a801a91444..4e9241a32fc 100644
--- a/libglusterfs/src/glusterfs/syncop.h
+++ b/libglusterfs/src/glusterfs/syncop.h
@@ -31,6 +31,11 @@
#define SYNCOPCTX_PID 0x00000008
#define SYNCOPCTX_LKOWNER 0x00000010
+#ifdef HAVE_TSAN_API
+/* Currently hardcoded within thread context maintained by the sanitizer. */
+#define TSAN_THREAD_NAMELEN 64
+#endif
+
struct synctask;
struct syncproc;
struct syncenv;
@@ -71,6 +76,13 @@ struct synctask {
uid_t uid;
gid_t gid;
+#ifdef HAVE_TSAN_API
+ struct {
+ void *fiber;
+ char name[TSAN_THREAD_NAMELEN];
+ } tsan;
+#endif
+
ucontext_t ctx;
struct syncproc *proc;
@@ -83,6 +95,14 @@ struct synctask {
struct syncproc {
pthread_t processor;
+
+#ifdef HAVE_TSAN_API
+ struct {
+ void *fiber;
+ char name[TSAN_THREAD_NAMELEN];
+ } tsan;
+#endif
+
ucontext_t sched;
struct syncenv *env;
struct synctask *current;