Subject: VOP_ADVLOCK() argument confusion
To: None <tech-kern@netbsd.org>
From: Nathan J. Williams <nathanw@MIT.EDU>
List: tech-kern
Date: 08/27/2000 19:00:21
The VFS operation VOP_ADVLOCK() takes an "id" argument. Almost every
use of VOP_ADVLOCK() passed a struct proc * as the id value. The
back-end locking code in vfs_lockf.c assumes that the value is a
process pointer in many places, such as the POSIX lock deadlock
detection and debugging output (as well as a comment that says: * Misc
cleanups: "caddr_t id" should be visible in the API as a * "struct
proc *".)

However, the two uses of VOP_ADVLOCK in sys_open() and sys_fhopen()
pass a struct file * instead. Since they are flock() style locks and
not POSIX-style locks, the only effect seems to be that locks aquired
with open() will not upgrade or downgrade locks acquired by flock() by
the same process (or vise versa), as a series of flock() calls would
have done.

Is this a bug, or is there some subtle, desirable side effect I don't
see? It could be as simple as a typo of "fp" for "p" in
sys_open()...

        - Nathan