From owner-svn-src-head@FreeBSD.ORG Sat Feb 28 19:10:44 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D0AE11065676; Sat, 28 Feb 2009 19:10:44 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A58DB8FC18; Sat, 28 Feb 2009 19:10:43 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1SJAhRO019236; Sat, 28 Feb 2009 19:10:43 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1SJAho3019235; Sat, 28 Feb 2009 19:10:43 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200902281910.n1SJAho3019235@svn.freebsd.org> From: Andrew Thompson Date: Sat, 28 Feb 2009 19:10:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189194 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Feb 2009 19:10:46 -0000 Author: thompsa Date: Sat Feb 28 19:10:43 2009 New Revision: 189194 URL: http://svn.freebsd.org/changeset/base/189194 Log: Move the NORELEASE check to after the recurse count decrement and bailout, this is not counted as actually releasing the lock. Modified: head/sys/kern/subr_witness.c Modified: head/sys/kern/subr_witness.c ============================================================================== --- head/sys/kern/subr_witness.c Sat Feb 28 19:09:36 2009 (r189193) +++ head/sys/kern/subr_witness.c Sat Feb 28 19:10:43 2009 (r189194) @@ -1511,12 +1511,6 @@ found: instance->li_line); panic("share->uexcl"); } - if ((instance->li_flags & LI_NORELEASE) != 0 && witness_watch > 0) { - printf("forbidden unlock of (%s) %s @ %s:%d\n", class->lc_name, - lock->lo_name, file, line); - panic("lock marked norelease"); - } - /* If we are recursed, unrecurse. */ if ((instance->li_flags & LI_RECURSEMASK) > 0) { CTR4(KTR_WITNESS, "%s: pid %d unrecursed on %s r=%d", __func__, @@ -1525,6 +1519,12 @@ found: instance->li_flags--; return; } + /* The lock is now being dropped, check for NORELEASE flag */ + if ((instance->li_flags & LI_NORELEASE) != 0 && witness_watch > 0) { + printf("forbidden unlock of (%s) %s @ %s:%d\n", class->lc_name, + lock->lo_name, file, line); + panic("lock marked norelease"); + } /* Otherwise, remove this item from the list. */ s = intr_disable();