[Port-solaris] EBUSY unmount check

Andrew Deason adeason@sinenomine.net
Mon, 12 Apr 2010 16:08:09 -0500

Right now the OpenAFS solaris kernel module doesn't check if someone is
accessing something in AFS when we .vfs_unmount, and solaris doesn't
check for us, either. This has the effect of possibly panic'ing when we
umount AFS (typically at shutdown). This has been brought up before:
but I don't think anything ever came of it.

I'd like to add a check, but I'm no expert on the Solaris VFS layer. At
first, I thought that checking the vfs_count member of the given
struct vfs* would work for this, but that always appears to be 1, even
if we have files in AFS open at the time of unmounting. So, my
understanding is that we must inc/dec that field for it to be useful for
this, presumably with VFS_HOLD/VFS_RELE.

If we VFS_HOLD in our (OpenAFS') .vfs_vget function, and VFS_RELE in our
.vop_inactive function, would that make checking vfs_count in unmount be
a sufficient check? Or should we just check the v_count of the vnode
referenced by the struct vfs* given to us?

The original way I was going to check for this was by checking all of
our vnodes to see if they were in use, but that's slow. I presume a
similar walk will be necessary to support force-unmounting, but I want
to get EBUSY for regular unmounts first.

Andrew Deason