1.\" -*- nroff -*- 2.\" 3.\" Copyright (c) 1996 Doug Rabson 4.\" Copyright (c) 2010 Konstantin Belousov <kib@FreeBSD.org> 5.\" 6.\" All rights reserved. 7.\" 8.\" This program is free software. 9.\" 10.\" Redistribution and use in source and binary forms, with or without 11.\" modification, are permitted provided that the following conditions 12.\" are met: 13.\" 1. Redistributions of source code must retain the above copyright 14.\" notice, this list of conditions and the following disclaimer. 15.\" 2. Redistributions in binary form must reproduce the above copyright 16.\" notice, this list of conditions and the following disclaimer in the 17.\" documentation and/or other materials provided with the distribution. 18.\" 19.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR 20.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, 23.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29.\" 30.\" $FreeBSD$ 31.\" 32.Dd October 17, 2010 33.Dt VRELE 9 34.Os 35.Sh NAME 36.Nm vput , 37.Nm vrele , 38.Nm vunref 39.Nd decrement the use count for a vnode 40.Sh SYNOPSIS 41.In sys/param.h 42.In sys/vnode.h 43.Ft void 44.Fn vput "struct vnode *vp" 45.Ft void 46.Fn vrele "struct vnode *vp" 47.Ft void 48.Fn vunref "struct vnode *vp" 49.Sh DESCRIPTION 50Decrement the 51.Va v_usecount 52field of a vnode. 53.Bl -tag -width 2n 54.It Fa vp 55the vnode to decrement 56.El 57.Pp 58The 59.Fn vrele 60function takes an unlocked vnode and returns with the vnode unlocked. 61.Pp 62The 63.Fn vput 64function should be given a locked vnode as argument, the vnode is unlocked 65after the function returned. 66The 67.Fn vput 68is operationally equivalent to calling 69.Xr VOP_UNLOCK 9 70followed by 71.Xr vrele 9 , 72with less overhead. 73.Pp 74The 75.Fn vunref 76function takes a locked vnode as argument, and returns with the vnode locked. 77Nonetheless, the 78.Fn vunref 79might drop the vnode lock during the operation, so caller should not expect 80that non-doomed vnode is still non-doomed after the function returned. 81.Pp 82Any code in the system which signified its use of a vnode by usecount 83should call one of the listed function to decrement use counter. 84If the 85.Va v_usecount 86field of the non-doomed vnode reaches zero, then it will be inactivated 87and placed on the free list. 88Since the functions might need to call VOPs for the vnode, the 89.Va Giant 90mutex should be conditionally locked around the call. 91.Pp 92The hold count for the vnode is always greater or equal to the usecount. 93Non-forced unmount fails when mount point owns a vnode that has non-zero 94usecount, see 95.Xr vflush 9 . 96.Sh SEE ALSO 97.Xr vget 9 , 98.Xr vnode 9 , 99.Xr vref 9 , 100.Xr vrefcnt 9 101.Sh AUTHORS 102This manual page was written by 103.An Doug Rabson 104and 105.An Konstantin Belousov . 106