Increase the iocount on a vnode.


int vnode_get(vnode_t);

Return Value

0 for success, ENOENT if the vnode is dead and without existing io-reference.


If vnode_get() succeeds, the resulting io-reference must be dropped with vnode_put(). This function succeeds unless the vnode in question is dead or in the process of dying AND the current iocount is zero. This means that it can block an ongoing reclaim which is blocked behind some other iocount.

On success, vnode_get() returns with an iocount held on the vnode; this type of reference is intended to be held only for short periods of time (e.g. across a function call) and provides a strong guarantee about the life of the vnode; vnodes with positive iocounts cannot be recycled, and an iocount is required for any operation on a vnode. However, vnode_get() does not provide any guarantees about the identity of the vnode it is called on; unless there is a known existing iocount on the vnode at time the call is made, it could be recycled and put back in use before the vnode_get() succeeds, so the caller may be referencing a completely different vnode than was intended. vnode_getwithref() and vnode_getwithvid() provide guarantees about vnode identity.