[OpenAFS-devel] Keeping track of vcaches/vnodes

Frank Batschulat (Home) Frank.Batschulat@Sun.COM
Sat, 10 Feb 2007 08:26:19 +0100


Dale Ghent wrote:
> 
> In my further study (ha!) of the Solaris client driver, I noticed that 
> the vfs unmount call unconditionally says "yo'kay" to umount requests 
> for /afs... which is alright if the /afs mount is quiescent and no 
> vnodes are referenced. But if there are, your machine is in panicville.
> 
> So I'm putting some safety in afs_unmount() and trying to figure out how 
> best to determine when returning EBUSY is appropriate.
> 
> Would I be correct in thinking that the most straight-forward approach 
> is to take the passed vfs struct that was passed in, get the vnode it 
> references, and see if v_count member is > 0 ?

I can only speak for the Solaris side of things.

As far as the Solaris VFS/VNODE framework is concerned you'd usually
check if the vnode's v_count is > 1 as the vnode is born
with a reference count of 1 (vn_alloc()->vn_reinit())
and return EBUSY in that case in your VFS_UNMOUNT() routine indicating
that you still have refrenced vnode's.
Note, you'd usually do this for any possible active vnode's in your 
particular file system specific cache (e.g. the ufs inode cache)

> Then there's the question of supporting forced unmounts... Are there any 
> good interfaces to call to invalidate all vcache/vnodes ?

if you want to implement forcible unmounts, there's kind of a
framework in the VFS/VNODE layer since Solaris 8 to do this. if you
decid to take that route, your busy check becomes much simpler
(against the vfs structures vfs->vfs_count) when using 
VFS_HOLD()/VFS_RELE(). Let me know if you want to implement umount -f
for AFS and I'm happy to guide you to the interfaces and implementation
details, just drop me a note.

---
frankB