svn commit: r309784 - head/sys/kern

Mark Johnston markj at FreeBSD.org
Sat Dec 10 02:59:36 UTC 2016


Author: markj
Date: Sat Dec 10 02:59:34 2016
New Revision: 309784
URL: https://svnweb.freebsd.org/changeset/base/309784

Log:
  Use a consistent snapshot of the lock state in owner_mtx().
  
  MFC after:	2 weeks

Modified:
  head/sys/kern/kern_mutex.c

Modified: head/sys/kern/kern_mutex.c
==============================================================================
--- head/sys/kern/kern_mutex.c	Sat Dec 10 02:56:44 2016	(r309783)
+++ head/sys/kern/kern_mutex.c	Sat Dec 10 02:59:34 2016	(r309784)
@@ -249,10 +249,13 @@ unlock_spin(struct lock_object *lock)
 int
 owner_mtx(const struct lock_object *lock, struct thread **owner)
 {
-	const struct mtx *m = (const struct mtx *)lock;
+	const struct mtx *m;
+	uintptr_t x;
 
-	*owner = mtx_owner(m);
-	return (mtx_unowned(m) == 0);
+	m = (const struct mtx *)lock;
+	x = m->mtx_lock;
+	*owner = (struct thread *)(x & ~MTX_FLAGMASK);
+	return (x != MTX_UNOWNED);
 }
 #endif
 


More information about the svn-src-all mailing list