xref: /freebsd/share/man/man9/insmntque.9 (revision cbb3ec25236ba72f91cbdf23f8b78b9d1af0cedf)
1.\" Copyright (C) 2008 Chad David <davidc@acns.ab.ca>.
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice(s), this list of conditions and the following disclaimer as
9.\"    the first lines of this file unmodified other than the possible
10.\"    addition of one or more copyright notices.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice(s), this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
16.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18.\" DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
19.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
25.\" DAMAGE.
26.\"
27.Dd January 29, 2022
28.Dt INSMNTQUE 9
29.Os
30.Sh NAME
31.Nm insmntque ,
32.Nm insmntque1
33.Nd "associate a vnode with a mount"
34.Sh SYNOPSIS
35.In sys/param.h
36.In sys/vnode.h
37.Ft int
38.Fn insmntque "struct vnode *vp" "struct mount *mp"
39.Ft int
40.Fn insmntque1 "struct vnode *vp" "struct mount *mp"
41.Sh DESCRIPTION
42The
43.Fn insmntque
44function associates a vnode with a mount.
45This includes updating
46.Va v_mount
47for the vnode, and inserting the vnode into the mount's vnode list.
48.Pp
49The indirect mount reference count, maintained as the count of the
50vnodes owned by it, is incremented for each vnode added to the
51mount, and that reference is decremented by
52.Xr vgone 9 .
53.Pp
54The mount's interlock is held while the vnode is inserted.
55The vnode must be exclusively locked.
56.Pp
57On failure,
58.Fn insmntque
59resets vnode' operation vector to the vector of
60.Xr deadfs 9 ,
61clears
62.Va v_data ,
63and then calls
64.Xr vgone 9
65and
66.Xr vput 9 .
67If more elaborated cleanup after
68.Fn insmntque
69failure is needed, the
70.Fn insmntque1
71function may be used instead.
72It does not do any cleanup following a failure, leaving all
73the work to the caller.
74In particular, the operation vector
75.Va v_op
76and
77.Va v_data
78fields of the vnode are kept intact.
79.Sh RETURN VALUES
80The
81.Fn insmntque
82function will always return 0, unless the file system is currently being unmounted
83in which case it may return
84.Dv EBUSY .
85Also,
86.Fn insmntque
87may be forced to insert the vnode into the mount's vnode list
88by setting the
89.Va VV_FORCEINSMQ
90flag in the vnode
91.Va v_flag ,
92even if the file system is being unmounted.
93.Sh SEE ALSO
94.Xr vgone 9
95.Sh AUTHORS
96This manual page was written by
97.An Chad David Aq Mt davidc@acns.ab.ca .
98