[dm-devel] [PATCH] multipathd: Suppress uninteresting data race reports

Bart Van Assche bart.vanassche at sandisk.com
Tue Aug 16 20:00:47 UTC 2016


The global variable multipath_conf is modified through RCU. Hence
avoid that the data race detection tools Helgrind and DRD report
data races for this variable.

The global variable running_state is read without holding the mutex
that protects changes of this variable. Suppress complaints about
these reads.

The global variable uxsock_timeout is not protected by any mutex.
Suppress complaints about using this variable.

This patch introduces a new build-time requirement, namely that
the valgrind-devel package has been installed.

Signed-off-by: Bart Van Assche <bart.vanassche at sandisk.com>
---
 multipathd/main.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/multipathd/main.c b/multipathd/main.c
index 1d73b4c..54abfef 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -23,6 +23,7 @@
 #endif
 #include <semaphore.h>
 #include <time.h>
+#include <valgrind/helgrind.h>
 
 /*
  * libcheckers
@@ -2520,6 +2521,13 @@ main (int argc, char *argv[])
 	int foreground = 0;
 	struct config *conf;
 
+	ANNOTATE_BENIGN_RACE_SIZED(&multipath_conf, sizeof(multipath_conf),
+				   "Manipulated through RCU");
+	ANNOTATE_BENIGN_RACE_SIZED(&running_state, sizeof(running_state),
+		"Suppress complaints about unprotected running_state reads");
+	ANNOTATE_BENIGN_RACE_SIZED(&uxsock_timeout, sizeof(uxsock_timeout),
+		"Suppress complaints about this scalar variable");
+
 	logsink = 1;
 
 	if (getuid() != 0) {
-- 
2.9.2




More information about the dm-devel mailing list