summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2007-05-26 21:37:14 +0000
committerpjd <pjd@FreeBSD.org>2007-05-26 21:37:14 +0000
commit88c31e8d669cb606f4a24edafeda9b2a33ee3cc7 (patch)
treef3c1c336b2992ffb70a0a664fb9743635f0675c3 /sys
parentcbfe2577e0966370b51c1133326e1d415eb2bcc0 (diff)
downloadFreeBSD-src-88c31e8d669cb606f4a24edafeda9b2a33ee3cc7.zip
FreeBSD-src-88c31e8d669cb606f4a24edafeda9b2a33ee3cc7.tar.gz
There are too many false positive LORs reported by WITNESS, so when ZFS
debug is turned off, initialize locks with NOWITNESS flag. At some point I'll get back to them, we would probably need BLESSING functionality, which is currently turned off by default.
Diffstat (limited to 'sys')
-rw-r--r--sys/cddl/compat/opensolaris/sys/mutex.h8
-rw-r--r--sys/cddl/compat/opensolaris/sys/rwlock.h8
-rw-r--r--sys/compat/opensolaris/sys/mutex.h8
-rw-r--r--sys/compat/opensolaris/sys/rwlock.h8
4 files changed, 28 insertions, 4 deletions
diff --git a/sys/cddl/compat/opensolaris/sys/mutex.h b/sys/cddl/compat/opensolaris/sys/mutex.h
index dac7249..d7543af 100644
--- a/sys/cddl/compat/opensolaris/sys/mutex.h
+++ b/sys/cddl/compat/opensolaris/sys/mutex.h
@@ -46,12 +46,18 @@ typedef enum {
typedef struct sx kmutex_t;
+#ifndef DEBUG
+#define MUTEX_FLAGS (SX_DUPOK | SX_NOWITNESS)
+#else
+#define MUTEX_FLAGS (SX_DUPOK)
+#endif
+
#define mutex_init(lock, desc, type, arg) do { \
ASSERT((type) == MUTEX_DEFAULT); \
KASSERT(((lock)->lock_object.lo_flags & LO_ALLMASK) != \
LO_EXPECTED, ("lock %s already initialized", #lock)); \
bzero((lock), sizeof(struct sx)); \
- sx_init_flags((lock), "zfs:" #lock, SX_DUPOK); \
+ sx_init_flags((lock), "zfs:" #lock, MUTEX_FLAGS); \
} while (0)
#define mutex_destroy(lock) sx_destroy(lock)
#define mutex_enter(lock) sx_xlock(lock)
diff --git a/sys/cddl/compat/opensolaris/sys/rwlock.h b/sys/cddl/compat/opensolaris/sys/rwlock.h
index 6facd7a..e877175 100644
--- a/sys/cddl/compat/opensolaris/sys/rwlock.h
+++ b/sys/cddl/compat/opensolaris/sys/rwlock.h
@@ -48,6 +48,12 @@ typedef enum {
typedef struct sx krwlock_t;
+#ifndef DEBUG
+#define RW_FLAGS (SX_DUPOK | SX_NOWITNESS)
+#else
+#define RW_FLAGS (SX_DUPOK)
+#endif
+
#define RW_READ_HELD(x) (rw_read_held((x)))
#define RW_WRITE_HELD(x) (rw_write_held((x)))
#define RW_LOCK_HELD(x) (rw_lock_held((x)))
@@ -57,7 +63,7 @@ typedef struct sx krwlock_t;
KASSERT(((lock)->lock_object.lo_flags & LO_ALLMASK) != \
LO_EXPECTED, ("lock %s already initialized", #lock)); \
bzero((lock), sizeof(struct sx)); \
- sx_init_flags((lock), "zfs:" #lock, SX_DUPOK); \
+ sx_init_flags((lock), "zfs:" #lock, RW_FLAGS); \
} while (0)
#define rw_destroy(lock) sx_destroy(lock)
#define rw_enter(lock, how) do { \
diff --git a/sys/compat/opensolaris/sys/mutex.h b/sys/compat/opensolaris/sys/mutex.h
index dac7249..d7543af 100644
--- a/sys/compat/opensolaris/sys/mutex.h
+++ b/sys/compat/opensolaris/sys/mutex.h
@@ -46,12 +46,18 @@ typedef enum {
typedef struct sx kmutex_t;
+#ifndef DEBUG
+#define MUTEX_FLAGS (SX_DUPOK | SX_NOWITNESS)
+#else
+#define MUTEX_FLAGS (SX_DUPOK)
+#endif
+
#define mutex_init(lock, desc, type, arg) do { \
ASSERT((type) == MUTEX_DEFAULT); \
KASSERT(((lock)->lock_object.lo_flags & LO_ALLMASK) != \
LO_EXPECTED, ("lock %s already initialized", #lock)); \
bzero((lock), sizeof(struct sx)); \
- sx_init_flags((lock), "zfs:" #lock, SX_DUPOK); \
+ sx_init_flags((lock), "zfs:" #lock, MUTEX_FLAGS); \
} while (0)
#define mutex_destroy(lock) sx_destroy(lock)
#define mutex_enter(lock) sx_xlock(lock)
diff --git a/sys/compat/opensolaris/sys/rwlock.h b/sys/compat/opensolaris/sys/rwlock.h
index 6facd7a..e877175 100644
--- a/sys/compat/opensolaris/sys/rwlock.h
+++ b/sys/compat/opensolaris/sys/rwlock.h
@@ -48,6 +48,12 @@ typedef enum {
typedef struct sx krwlock_t;
+#ifndef DEBUG
+#define RW_FLAGS (SX_DUPOK | SX_NOWITNESS)
+#else
+#define RW_FLAGS (SX_DUPOK)
+#endif
+
#define RW_READ_HELD(x) (rw_read_held((x)))
#define RW_WRITE_HELD(x) (rw_write_held((x)))
#define RW_LOCK_HELD(x) (rw_lock_held((x)))
@@ -57,7 +63,7 @@ typedef struct sx krwlock_t;
KASSERT(((lock)->lock_object.lo_flags & LO_ALLMASK) != \
LO_EXPECTED, ("lock %s already initialized", #lock)); \
bzero((lock), sizeof(struct sx)); \
- sx_init_flags((lock), "zfs:" #lock, SX_DUPOK); \
+ sx_init_flags((lock), "zfs:" #lock, RW_FLAGS); \
} while (0)
#define rw_destroy(lock) sx_destroy(lock)
#define rw_enter(lock, how) do { \
OpenPOWER on IntegriCloud