d5106d
From 6257d829c9d7e71ac51bcdc6b5b981c7a19200e2 Mon Sep 17 00:00:00 2001
d5106d
From: Mark Andrews <marka@isc.org>
d5106d
Date: Mon, 25 Nov 2019 05:46:55 +0000
d5106d
Subject: [PATCH] Merge branch
d5106d
 '1373-threadsanitizer-data-race-rbtdb-c-5193-in-detachnode' into 'master'
d5106d
d5106d
Resolve "ThreadSanitizer: data race rbtdb.c:5193 in detachnode"
d5106d
d5106d
Closes #1373
d5106d
d5106d
See merge request isc-projects/bind9!2598
d5106d
---
d5106d
 lib/dns/include/dns/rbt.h | 22 +++++++++-------------
d5106d
 1 file changed, 9 insertions(+), 13 deletions(-)
d5106d
d5106d
diff --git a/lib/dns/include/dns/rbt.h b/lib/dns/include/dns/rbt.h
d5106d
index 67ac3e4d8a..a084bd6193 100644
d5106d
--- a/lib/dns/include/dns/rbt.h
d5106d
+++ b/lib/dns/include/dns/rbt.h
d5106d
@@ -49,10 +49,7 @@ ISC_LANG_BEGINDECLS
d5106d
 
d5106d
 #define DNS_RBT_USEMAGIC 1
d5106d
 
d5106d
-/*
d5106d
- * These should add up to 30.
d5106d
- */
d5106d
-#define DNS_RBT_LOCKLENGTH                      10
d5106d
+#define DNS_RBT_LOCKLENGTH		(sizeof(((dns_rbtnode_t *)0)->locknum)*8)
d5106d
 #define DNS_RBT_REFLENGTH                       20
d5106d
 
d5106d
 #define DNS_RBTNODE_MAGIC               ISC_MAGIC('R','B','N','O')
d5106d
@@ -159,16 +156,15 @@ struct dns_rbtnode {
d5106d
 	 * separate region of memory.
d5106d
 	 */
d5106d
 	void *data;
d5106d
-	unsigned int :0;                /* start of bitfields c/o node lock */
d5106d
-	unsigned int dirty:1;
d5106d
-	unsigned int wild:1;
d5106d
-	unsigned int locknum:DNS_RBT_LOCKLENGTH;
d5106d
-#ifndef DNS_RBT_USEISCREFCOUNT
d5106d
-	unsigned int references:DNS_RBT_REFLENGTH;
d5106d
-#endif
d5106d
-	unsigned int :0;                /* end of bitfields c/o node lock */
d5106d
+	uint8_t :0;                /* start of bitfields c/o node lock */
d5106d
+	uint8_t dirty:1;
d5106d
+	uint8_t wild:1;
d5106d
+	uint8_t :0;                /* end of bitfields c/o node lock */
d5106d
+	uint16_t locknum;	   /* note that this is not in the bitfield */
d5106d
 #ifdef DNS_RBT_USEISCREFCOUNT
d5106d
-	isc_refcount_t references; /* note that this is not in the bitfield */
d5106d
+	isc_refcount_t references;
d5106d
+#else
d5106d
+	unsigned int references:DNS_RBT_REFLENGTH;
d5106d
 #endif
d5106d
 	/*@}*/
d5106d
 };
d5106d
-- 
d5106d
2.21.0
d5106d