[OpenAFS-devel] Re: [Port-solaris] bozonlock

chas williams - CONTRACTOR chas@cmf.nrl.navy.mil
Mon, 14 Jul 2014 09:19:29 -0400


Forgive me, I don't subscribe to port-solaris, so I am forced to
cut-paste mangle this message to reply.

On Thu, 3 Jul 2014 22:15:54 +0000
mvitale@sinenomine.net (Mark Vitale) wrote:

> I'm hoping someone on the list can provide more historical background on th=
> e "bozonlock" (AFS_BOZONLOCK_ENV, vcache->pvnLock).  By reading how it is u=
> sed in code, it is clearly intended to only allow one thread at a time to i=
> nteract with the paging subsystem for a given vcache's memory-mapped pages.=
>   This is also alluded to in the name "pvnLock" - paged vnode lock. =20

> Some code comments (1) imply that bozonlock was originally intended for use=
>  in the Solaris port.  However, sometime before IBM 1.0, it was specificall=
> y disabled for Solaris by the addition of #define AFS_NOBOZO_LOCK (2).

At some point the SunOS VM system was changed such that it became
re-entrant.  Locking a vnode and calling into the VM system would
eventually callback into the AFS code which would attempt to lock the
vnode again.  I don't know the specific call path.

The BozonLock only protected operations involving pvn_getpages().  So I
imagine trying to get a page for a vnode with existing multiple pages
might cause some of other pages in that vnode to be flushed/dropped
resulting in a call back into AFS with the vnode already locked.

> Currently bozonlock function (AFS_BOZONLOCK_ENV 1) is only defined for the =
> Darwin port (and DUX).

And only defined for certain Darwin versions as well.  See

http://gerrit.openafs.org/#change,11108

I don't believe that Darwin port even uses the BozonLock correctly since
it doesn't actually take the BozonLock anywhere in its page in/out
routines.

> Does anyone know why bozonlock was disabled for Solaris?  Does anyone know =
> any reason why it could/should not be reinstated for Solaris?

The comments from the SOLARIS/osi_vnodeops.c seem relevant:

         * afs_GetOnePage will be called multiple times by pvn_getpages in
         * order to get all of the requested pages. One of the later
         * afs_GetOnePage calls may need to evict some cache entries in order
         * to perform its read. If we try to kick out one of the entries an
         * earlier afs_GetOnePage call used, we will deadlock since we have
         * the page locked. So, to tell afs_GetDownD that it should skip over
         * any entries we've read in due to this afs_getpage call, record the
         * offset and length in avc->multiPage.

This was part of commit 31a001f60e5fe729b315f679d1d43b367bd74ea5.  This
was a re-implementation of the previous multiPage flag which potentially
avoided the need for the BozonLock (but I guess it didn't do a very
good job or it wouldn't have needed rewritten).  The multiPage flag and
no BozonLock on Solaris 2.x has been around since before AFS 3.4a

> this function to Sun Microsystems' Version 4.0 virtual memory system, w=

They meant SunOS 4.0 -- Quite a long time ago actually.