Subject: Re: vnode locking in kern/vfs_syscalls.c looks inconsistent
To: Roland Illig <>
From: Bill Studenmund <>
List: tech-kern
Date: 07/03/2006 11:45:57
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Jul 03, 2006 at 07:55:33AM +0200, Roland Illig wrote:
> Hi,
> 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.

Take care,


Content-Type: application/pgp-signature
Content-Disposition: inline

Version: GnuPG v1.2.3 (NetBSD)