From cae4ab7f3718736b51c048440a5eadd7d7251623 Mon Sep 17 00:00:00 2001
From: Mateusz Guzik <mjg@FreeBSD.org>
Date: Sun, 5 Feb 2017 09:35:17 +0000
Subject: [PATCH] mtx: fix up _mtx_obtain_lock_fetch usage in thread lock

Since _mtx_obtain_lock_fetch no longer sets the argument to MTX_UNOWNED,
callers have to do it on their own.
---
 sys/kern/kern_mutex.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c
index f49d87c81999..76a009d0cfca 100644
--- a/sys/kern/kern_mutex.c
+++ b/sys/kern/kern_mutex.c
@@ -782,6 +782,7 @@ thread_lock_flags_(struct thread *td, int opts, const char *file, int line)
 #ifdef KDTRACE_HOOKS
 	spin_time -= lockstat_nsecs(&td->td_lock->lock_object);
 #endif
+	v = MTX_UNOWNED;
 	for (;;) {
 retry:
 		spinlock_enter();