svn commit: r208003 - in head/sys: kern sys

Matthew Fleming matthew.fleming at isilon.com
Mon May 17 15:45:54 UTC 2010


> From: Kostik Belousov [mailto:kostikbel at gmail.com]
> On Wed, May 12, 2010 at 09:24:46PM +0000, Zachary Loafman wrote:
> > Author: zml
> > Date: Wed May 12 21:24:46 2010
> > New Revision: 208003
> > URL: http://svn.freebsd.org/changeset/base/208003
> > 
> > Log:
> >   Add VOP_ADVLOCKPURGE so that the file system is called when purging
> >   locks (in the case where the VFS impl isn't using lf_*)
> >   
> >   Submitted by:       Matthew Fleming <matthew.fleming at isilon.com>
> >   Reviewed by:        zml, dfr
> 
> After looking at what happen to nullfs, see r208003, I wonder why
> the vop is needed. It is called after VOP_RECLAIM is called by vgonel(),
> after fs-specific data are destroyed. So, on the one hand, vop can only
> operate on struct vnode proper, on the other hand, the actions performed
> by vop_advlockpurge implementation can be done by vop_reclaim as well.
> 
> Could you, please, give some details on the supposed use of the vop ?

>From a design perspective, it makes little sense to allow overriding the advlock operation, but not the purge.  A specific example is if an implementation does not use struct lockf to implement advlock, then the hack you mention of purging in VOP_RECLAIM is needed.

After looking over the history of the changes, I believe it would be sufficient to have the lock purge done before the reclaim.  The vnode is locked exclusively for both operations, so I don't believe there will be any timing windows.  But I am still not 100% sure when the file lock is used versus the interlock for serializing access to various fields.

The advlock VOPs are analogous to the regular VOP_LOCK in that we expect an implementation may override the VOP and also the data structures used, e.g. to not use the vnode's v_lock field for the VOP_LOCK.  Thus any code which refers to v_lockf should be wrapped in a VOP to allow correct overriding.

Thanks,
matthew


More information about the svn-src-all mailing list