Subject: question about vnode locks and mount
To: None <tech-kern@netbsd.org>
From: Gordon Waidhofer <gww@traakan.com>
List: tech-kern
Date: 07/15/2004 12:04:49
I've been wading through various VFS_MOUNT()
implementations: ffs_vfsops.c, ntfs_vfsops.c, and
msdos_vfsops.c. I'm in the process of adding
mountroot to my file system.

I found something strange and want to check if
I'm missing something.

All three file system (FFS, MSDOS, NTFS) call
namei() with flags FOLLOW, but not LOCKLEAF.
There is a subsequent call to VOP_OPEN() with
(best I can tell) the vnode not locked. Other
calls, like VOP_ACCESS(), are surrounded with
vn_lock()/VOP_UNLOCK(). The VOP_OPEN(9) docs
and the kern/vnode_if.src say that the vnode
should be locked.

FFS surrounds a call to vinvalbuf() with
vn_lock()/VOP_UNLOCK(). The other two do
not.

kern/vfs_vnops.c/vn_open() does make
sure the vnode is locked before the
call to VOP_OPEN().

I believe it is a benign bug. Just a
bit of fluff.

But I want to be sure I'm not missing
something important.

Thanx for any help.

Regards,
	-gww