Bug 46652

Summary: DEBUG_VFS_LOCKS never checks locks for **vpp
Product: Base System Reporter: Stefan Eßer <se>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 5.0-CURRENT   
Hardware: Any   
OS: Any   

Description Stefan Eßer freebsd_committer freebsd_triage 2002-12-31 15:20:01 UTC
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".

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:



(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 ...)--BgRdNPXIqF4BWB1aPFyaORFbOyzCnErv2hjHI43KWHZ5cXlP
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

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
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.
Comment 1 Stefan Eßer freebsd_committer freebsd_triage 2003-06-20 13:24:29 UTC
State Changed
From-To: open->closed

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.