VREF(9)

NAME
vref - Increment the primary reference count for an active vnode

SYNOPSIS
#include <sys/param.h>
#include <sys/vnode.h>
void
vref(struct vnode *vp);

DESCRIPTION
The primary reference count for an active vnode is incremented. The vnode must already have active references to it, usually acquired prior to the vnode pointer being passed to the code making this call or when vnode pointers are obtained from structures, such as file pointers, which hold an active reference to the vnode. Any attempt to use vref on an inactive vnode will result in a panic.

vp  The vnode being referenced.

Each vnode maintains a Primary and Auxiliary reference count. The primary reference count prevents the vnode from being deactivated while the auxiliary reference count keeps track of auxiliary structures, such as namecache and VM object structures, which are typically kept associated with the vnode for caching purposes even after the vnode has been deactivated.

A procedure will often acquire its own primary reference to a vnode to prevent the vnode from getting ripped out from under it during an operation due to the destruction of the parent data structure. For example, one thread may be blocked on a vnode operation related to a file descriptor that another thread then closes.

SEE ALSO
vdrop(9), vget(9), vhold(9), vnode(9), vn_lock(9), vn_unlock(9), vput(9), vrele(9)

AUTHORS
This manual page was written by Doug Rabson.