Coda File System

Re: [Greg Troxel] vnode locking in coda_lookup

From: Jan Harkes <jaharkes_at_cs.cmu.edu>
Date: Thu, 5 Apr 2007 15:57:33 -0400
On Wed, Apr 04, 2007 at 07:42:25PM -0400, Greg Troxel wrote:
> If any of you are running NetBSD-current and feeling brave, the patch
> below may be of interest.  If you're one of the 5 people in the world
> who understands vnode locking protocols, then I'd appreciate review.

I don't know much of the finer details of NetBSD's locking, but I
noticed that the area where the parent/child lock ordering is fixed for
'..' lookups, it also intentionally skips '.'.

Just wondering if it is useful to short-circuit such lookups earlier on
before we even bother trying the coda_nc_lookup and venus_lookup. I
assume that we would just return the current object, still locked with
possible an additional vref. But returning early means we avoid the
upcall to venus, don't have to add it to the coda namecache, and avoid
the special case near the end.

It looks like the patch already got committed to CVS, so I guess my
other worry is unfounded. I was wondering if the locked parent directory
vnode had a vref or not, dropping the lock without having a reference
could lead to a hard to trigger, but nasty race where the vnode could
possibly be dropped from memory while we're blocked trying to lock the
vnode we want to return.

Jan
Received on 2007-04-05 16:00:40