From se@FreeBSD.org  Tue Dec 31 07:13:45 2002
Return-Path: <se@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id C56FC37B401
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 31 Dec 2002 07:13:45 -0800 (PST)
Received: from mailout11.sul.t-online.com (mailout11.sul.t-online.com [194.25.134.85])
	by mx1.FreeBSD.org (Postfix) with ESMTP id F366443EC5
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 31 Dec 2002 07:13:44 -0800 (PST)
	(envelope-from se@FreeBSD.org)
Received: from fwd04.sul.t-online.de 
	by mailout11.sul.t-online.com with smtp 
	id 18TMox-0003TA-04; Tue, 31 Dec 2002 14:52:39 +0100
Received: from Gatekeeper.FreeBSD.org (520047440004-0001@[217.227.249.229]) by fmrl04.sul.t-online.com
	with esmtp id 18TMon-15Co5oC; Tue, 31 Dec 2002 14:52:29 +0100
Received: from StefanEsser.FreeBSD.org (StefanEsser [10.0.0.1])
	by Gatekeeper.FreeBSD.org (Postfix) with ESMTP id AD8435F1C
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 31 Dec 2002 14:52:27 +0100 (CET)
Received: by StefanEsser.FreeBSD.org (Postfix, from userid 200)
	id 84B861550; Tue, 31 Dec 2002 14:52:27 +0100 (CET)
Message-Id: <20021231135227.84B861550@StefanEsser.FreeBSD.org>
Date: Tue, 31 Dec 2002 14:52:27 +0100 (CET)
From: Stefan Esser <se@FreeBSD.org>
Reply-To: Stefan Esser <se@FreeBSD.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: DEBUG_VFS_LOCKS never checks locks for **vpp
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         46652
>Category:       kern
>Synopsis:       DEBUG_VFS_LOCKS never checks locks for **vpp
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Dec 31 07:20:01 PST 2002
>Closed-Date:    Fri Jun 20 05:26:27 PDT 2003
>Last-Modified:  Fri Jun 20 05:26:27 PDT 2003
>Originator:     Stefan Esser
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
>Environment:
System: FreeBSD StefanEsser.FreeBSD.org 5.0-CURRENT FreeBSD 5.0-CURRENT #11: Sun Dec 29 19:23:53 CET 2002 root@:/usr/src/sys/i386/compile/ISDN686 i386


	
>Description:
There is an inconsistency in "/sys/tools/vnode_if.awk", which causes VOP 
locking assertions to be missed for one specific argument name:

No assertions are ever generated for VOP argument **vpp, since that 
argument name is mangled into "*vpp" when reading the locking requirements,
but not when generating the test macros in "add_debug_code".
>How-To-Repeat:
Have a look at the generated "vnode_if.h" in the kernel build directory.
There are no assertions for "vpp", though locking is specified for that 
argument in vnode_if.src.
>Fix:
The minimal patch (requires no changes to vnode_if.src) follows:

Apply the following simple patch to /sys/tools/vnode_if.awk in order
to match the mangled name when generating debug code:

Index: /sys/tools/vnode_if.awk
===================================================================
RCS file: /usr/cvs/src/sys/tools/vnode_if.awk,v
retrieving revision 1.37
diff -u -3 -r1.37 vnode_if.awk
--- /sys/tools/vnode_if.awk	26 Sep 2002 04:48:43 -0000	1.37
+++ /sys/tools/vnode_if.awk	31 Dec 2002 13:37:20 -0000
@@ -65,6 +65,8 @@
 
 function add_debug_code(name, arg, pos)
 {
+	if (arg == "vpp")
+		arg = "*vpp";
 	if (lockdata[name, arg, pos]) {
 		printh("\tASSERT_VI_UNLOCKED("arg", \""uname"\");");
 		# Add assertions for locking

(An alternative fix would be to specify locking for vpp in the form
"#% *vpp L L L" instead of "#% vpp L L L". This requires a small change 
to the regular expression in line 171 (permit optional leading "*" for $2) 
and the removal of the name mangling in line 174f ...)
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: se 
State-Changed-When: Fri Jun 20 05:24:29 PDT 2003 
State-Changed-Why:  
Patch committed. The alternative patch suggested in the PR prooved to 
complex and was not completed. Instead a warning about **vpp being  
special-cased was added to the comments at the head of vnode_if.src. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=46652 
>Unformatted:
