vput (9)
Leading comments
Copyright (c) 1996 Doug Rabson Copyright (c) 2010 Konstantin Belousov <kib@FreeBSD.org> All rights reserved. This program is free software. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice...
NAME
vput vrele vunref - decrement the use count for a vnodeSYNOPSIS
In sys/param.h In sys/vnode.h Ft void Fn vput struct vnode *vp Ft void Fn vrele struct vnode *vp Ft void Fn vunref struct vnode *vpDESCRIPTION
Decrement the v_usecount field of a vnode.- Fa vp
- the vnode to decrement
The Fn vrele function takes an unlocked vnode and returns with the vnode unlocked.
The Fn vput function should be given a locked vnode as argument, the vnode is unlocked after the function returned. The Fn vput is operationally equivalent to calling VOP_UNLOCK9 followed by vrele(9), with less overhead.
The Fn vunref function takes a locked vnode as argument, and returns with the vnode locked.
Any code in the system which signified its use of a vnode by usecount should call one of the listed function to decrement use counter. If the v_usecount field of the non-doomed vnode reaches zero, then it will be inactivated and placed on the free list. Since the functions might need to call VOPs for the vnode, the Giant mutex should be conditionally locked around the call.
The hold count for the vnode is always greater or equal to the usecount. Non-forced unmount fails when mount point owns a vnode that has non-zero usecount, see vflush(9).