Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Aug 2017 23:14:38 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r321896 - head/sys/kern
Message-ID:  <201708012314.v71NEcUj091616@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Tue Aug  1 23:14:38 2017
New Revision: 321896
URL: https://svnweb.freebsd.org/changeset/base/321896

Log:
  Amend r321884 to check the refcount and update the class with w_mtx held.
  
  Reviewed by:	jhb
  X-MFC with:	r321884

Modified:
  head/sys/kern/subr_witness.c

Modified: head/sys/kern/subr_witness.c
==============================================================================
--- head/sys/kern/subr_witness.c	Tue Aug  1 21:41:14 2017	(r321895)
+++ head/sys/kern/subr_witness.c	Tue Aug  1 23:14:38 2017	(r321896)
@@ -1849,10 +1849,10 @@ enroll(const char *description, struct lock_class *loc
 	return (w);
 found:
 	w->w_refcount++;
-	mtx_unlock_spin(&w_mtx);
 	if (w->w_refcount == 1)
 		w->w_class = lock_class;
-	else if (lock_class != w->w_class)
+	mtx_unlock_spin(&w_mtx);
+	if (lock_class != w->w_class)
 		kassert_panic(
 		    "lock (%s) %s does not match earlier (%s) lock",
 		    description, lock_class->lc_name,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201708012314.v71NEcUj091616>