Subject: Re: vnode locking in kern/vfs_syscalls.c looks inconsistent
To: Roland Illig <rillig@NetBSD.org>
From: Bill Studenmund <wrstuden@netbsd.org>
List: tech-kern
Date: 07/03/2006 11:45:57
--48TaNjbzBVislYPb
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,
>=20
> the vnode locking in the change_mode function looks very strange to me.=
=20
> It is locked by vn_lock(), but unlocked by VOP_UNLOCK().
>=20
> 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=
=20
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=
=20
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,
Bill
--48TaNjbzBVislYPb
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (NetBSD)
iD8DBQFEqWXlWz+3JHUci9cRAn+mAJ0W0vO76tg9GdtIg/UI+mN0YHGzegCeN06t
VfFhM+9HbeBCfpHjvHrDWcA=
=Tni3
-----END PGP SIGNATURE-----
--48TaNjbzBVislYPb--