Subject: Re: vnode locking in kern/vfs_syscalls.c looks inconsistent
To: Roland Illig <rillig@NetBSD.org>
From: Bill Studenmund <firstname.lastname@example.org>
Date: 07/03/2006 11:45:57
Content-Type: text/plain; charset=us-ascii
On Mon, Jul 03, 2006 at 07:55:33AM +0200, Roland Illig wrote:
> the vnode locking in the change_mode function looks very strange to me.=
> It is locked by vn_lock(), but unlocked by VOP_UNLOCK().
> Can someone who knows please explain why the combination=20
> vn_lock/vn_unlock or VOP_LOCK/VOP_UNLOCK cannot be used here? The CVS=20
> log does not explain it.
The reason we need vn_lock() is that there are certain operations that rip=
the vnode away from a given file system. Since a given file system=20
determines what VOP_LOCK() really does, you need a way to block access to=
VOP_LOCK(). Thus vn_lock() and VXLOCK.
> Oh, I'm just seeing that there is no function called vn_unlock.=20
> Shouldn't there be one just to make the code nice-looking?
We could add one, but it really isn't needed. It would just call=20
VOP_UNLOCK(), and take up stack space.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (NetBSD)
-----END PGP SIGNATURE-----