From owner-svn-src-all@freebsd.org Tue Aug 1 23:14:39 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7D22DBFAF7; Tue, 1 Aug 2017 23:14:39 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 366036CCCD; Tue, 1 Aug 2017 23:14:39 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v71NEcQm091617; Tue, 1 Aug 2017 23:14:38 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v71NEcUj091616; Tue, 1 Aug 2017 23:14:38 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201708012314.v71NEcUj091616@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 1 Aug 2017 23:14:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321896 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 321896 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Aug 2017 23:14:39 -0000 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,