xref: /freebsd/share/man/man9/vrele.9 (revision 1c4ee7dfb8affed302171232b0f612e6bcba3c10)
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.Dd February 24, 2016
31.Dt VRELE 9
32.Os
33.Sh NAME
34.Nm vput ,
35.Nm vrele ,
36.Nm vunref
37.Nd decrement the use count for a vnode
38.Sh SYNOPSIS
39.In sys/param.h
40.In sys/vnode.h
41.Ft void
42.Fn vput "struct vnode *vp"
43.Ft void
44.Fn vrele "struct vnode *vp"
45.Ft void
46.Fn vunref "struct vnode *vp"
47.Sh DESCRIPTION
48Decrement the
49.Va v_usecount
50field of a vnode.
51.Bl -tag -width 2n
52.It Fa vp
53the vnode to decrement
54.El
55.Pp
56The
57.Fn vrele
58function takes an unlocked vnode and returns with the vnode unlocked.
59.Pp
60The
61.Fn vput
62function should be given a locked vnode as argument, the vnode is unlocked
63after the function returned.
64The
65.Fn vput
66is operationally equivalent to calling
67.Xr VOP_UNLOCK 9
68followed by
69.Fn vrele ,
70with less overhead.
71.Pp
72The
73.Fn vunref
74function takes a locked vnode as argument, and returns with the vnode locked.
75.Pp
76Any code in the system which signified its use of a vnode by usecount
77should call one of the listed function to decrement use counter.
78If the
79.Va v_usecount
80field of the non-doomed vnode reaches zero, then it will be inactivated
81and placed on the free list.
82.Pp
83The
84.Fn vrele
85function may lock the vnode.
86All three functions may sleep.
87.Pp
88The hold count for the vnode is always greater or equal to the usecount.
89Non-forced unmount fails when mount point owns a vnode that has non-zero
90usecount, see
91.Xr vflush 9 .
92.Sh SEE ALSO
93.Xr vget 9 ,
94.Xr vnode 9 ,
95.Xr vref 9 ,
96.Xr vrefcnt 9
97.Sh AUTHORS
98This manual page was written by
99.An Doug Rabson
100and
101.An Konstantin Belousov .
102