[OpenAFS-devel] Client vnode locking question

Garrett Wollman wollman@khavrinen.lcs.mit.edu
Thu, 2 Oct 2003 22:24:53 -0400 (EDT)


In my work on the FreeBSD client, I've noticed a locking problem.
It appears that afs_GetVCache() is sometimes called on locked vnodes,
and sometimes called on unlocked vnodes (or ultimately to create
vnodes which start out unlocked).  The calls with the vnode locked
arise from a call stack that looks like:

afs_GetVCache()
afs_VerifyVCache()
afs_getattr()
afs_vop_getattr()
vn_stat()
lstat()
syscall()

Or sometimes like:

afs_GetVCache()
afs_VerifyVCache()
afs_lookup()
afs_vop_lookup()
lookup()
namei()
osi_lookupname()
afs_syscall_pioctl()
...

I don't have a call graph for the times that afs_GetVCache() is called
without a locked vnode, but it's clear from the OpenBSD implementation
that this is expected -- so I expect that OpenBSD may have the same
problem.

Does anybody have any thoughts on how locking is supposed to work
here?  I've read the comment at the top of this function, which is a
nice summary that seems to totally miss the mark, since the locking
protocol is determined by the operating system and not by the AFS
code anyway.

-GAWollman