Subject: Re: Why does specfs use genfs_nolock?
To: Jason Thorpe <>
From: Bill Studenmund <>
List: tech-kern
Date: 09/02/2004 15:42:35
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Aug 31, 2004 at 10:31:26AM -0700, Jason Thorpe wrote:
> Any particular reason why specfs doesn't follow the locking protocol? =20
> (Sure leads to confusion when looking at code that use bdevvp() ...=20
> calls VOP_OPEN() without first vn_lock()'ing the vnode... and bdevvp()=20
> doesn't vn_lock() the vnode itself...).

I think because of aliasing. A comment from spec_vnops.c gives:

 * This vnode operations vector is used for two things only:
 * - special device nodes created from whole cloth by the kernel.  =20
 * - as a temporary vnodeops replacement for vnodes which were found to
 *      be aliased by callers of checkalias().
 * For the ops vector for vnodes built from special devices found in a
 * filesystem, see (e.g) ffs_specop_entries[] in ffs_vnops.c or the=20
 * equivalent for other filesystems.

I think the checkalias() comment may be a little out of date.

The real problem is that when this code was made, locking was solely the=20
domain of the FS; lockmgr() locking was not there yet. So there was no=20
clear way to transfer lock state amongst nodes. aliased nodes are like=20
layered vnodes, except they don't have a vertical hierarcy. If anything,=20
they are siblings.

Take care,


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

Version: GnuPG v1.2.3 (NetBSD)