hrev54010 adds 1 changeset to branch 'master'
old head: cb837539f5d245cedff238f8894c0ae326c2eaf5
new head: 8e12c92fee6eae91d0a11e7947e5bf6ed6513c6c
overview:
https://git.haiku-os.org/haiku/log/?qt=range&q=8e12c92fee6e+%5Ecb837539f5d2
----------------------------------------------------------------------------
8e12c92fee6e: freebsd_network: Implement mtx_destroy for spinlocks.
Somehow, I missed this when implementing MTX_SPIN in the first place,
and it went largely unnoticed because MTX_SPIN is rarely used and
apparently even more rarely destroyed.
Should fix #15749.
[ waddlesplash <waddlesplash@xxxxxxxxx> ]
----------------------------------------------------------------------------
Revision: hrev54010
Commit: 8e12c92fee6eae91d0a11e7947e5bf6ed6513c6c
URL: https://git.haiku-os.org/haiku/commit/?id=8e12c92fee6e
Author: waddlesplash <waddlesplash@xxxxxxxxx>
Date: Wed Mar 25 01:06:37 2020 UTC
Ticket: https://dev.haiku-os.org/ticket/15749
----------------------------------------------------------------------------
1 file changed, 5 insertions(+), 4 deletions(-)
src/libs/compat/freebsd_network/mutex.c | 9 +++++----
----------------------------------------------------------------------------
diff --git a/src/libs/compat/freebsd_network/mutex.c
b/src/libs/compat/freebsd_network/mutex.c
index 4a035fb5de..1084437f70 100644
--- a/src/libs/compat/freebsd_network/mutex.c
+++ b/src/libs/compat/freebsd_network/mutex.c
@@ -10,8 +10,6 @@
#include <compat/sys/mutex.h>
-// these methods are bit unfriendly, a bit too much panic() around
-
struct mtx Giant;
struct rw_lock ifnet_rwlock;
struct mtx gIdStoreLock;
@@ -49,10 +47,13 @@ mtx_sysinit(void *arg)
void
mtx_destroy(struct mtx *mutex)
{
- if ((mutex->type & MTX_RECURSE) != 0)
+ if ((mutex->type & MTX_RECURSE) != 0) {
recursive_lock_destroy(&mutex->u.recursive);
- else
+ } else if ((mutex->type & MTX_SPIN) != 0) {
+ KASSERT(!B_SPINLOCK_IS_LOCKED(&mutex->u.spinlock.lock), ("spin
mutex is locked"));
+ } else {
mutex_destroy(&mutex->u.mutex.lock);
+ }
}