Bug 194643

Summary: VFS vnode locking incorrect for non-lockmgr vnodes
Product: Base System Reporter: Conrad Meyer <cse.cem>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: New ---    
Severity: Affects Only Me CC: attilio, benno, cem
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   

Description Conrad Meyer 2014-10-27 21:39:13 UTC
insmntque and probably other parts of VFS are broken for VFS that do not use lockmgr.

E.g. insmntque_stddtr enters with the vnode locked exclusive, wipes out the v_op table, and then calls vput() which uses VOP_ISLOCKED, VOP_LOCK, VOP_UNLOCK.

For VFS where vop_lock1, vop_unlock, vop_islocked doesn't use lockmgr, insmntque_stddtr leaks the original lock; then vput tries to upgrade via dead_vnops. This is pretty bogus. Even for VFS that use lockmgr, insmntque_stddtr doesn't reset v_vnlock to &v_lock; it should probably do this (or just let vgone() do it).

Additionally, since vgonel() wipes out v_op with dead_vnops, anything else that holds a vnode lock over vgone() is bogus. (But, not observably so for lockmgr- / v_lock-using VFS.)