xref: /freebsd/share/man/man9/insmntque.9 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
14c2d7071SChristian Brueffer.\" Copyright (C) 2008 Chad David <davidc@acns.ab.ca>.
24c2d7071SChristian Brueffer.\" All rights reserved.
319589ea1SChad David.\"
419589ea1SChad David.\" Redistribution and use in source and binary forms, with or without
519589ea1SChad David.\" modification, are permitted provided that the following conditions
619589ea1SChad David.\" are met:
719589ea1SChad David.\" 1. Redistributions of source code must retain the above copyright
819589ea1SChad David.\"    notice(s), this list of conditions and the following disclaimer as
919589ea1SChad David.\"    the first lines of this file unmodified other than the possible
1019589ea1SChad David.\"    addition of one or more copyright notices.
1119589ea1SChad David.\" 2. Redistributions in binary form must reproduce the above copyright
1219589ea1SChad David.\"    notice(s), this list of conditions and the following disclaimer in the
1319589ea1SChad David.\"    documentation and/or other materials provided with the distribution.
1419589ea1SChad David.\"
1519589ea1SChad David.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
1619589ea1SChad David.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
1719589ea1SChad David.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
1819589ea1SChad David.\" DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
1919589ea1SChad David.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
2019589ea1SChad David.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2119589ea1SChad David.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2219589ea1SChad David.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2319589ea1SChad David.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2419589ea1SChad David.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
2519589ea1SChad David.\" DAMAGE.
2619589ea1SChad David.\"
27*90be4091SKonstantin Belousov.Dd January 29, 2022
28134d45e8SUlrich Spörlein.Dt INSMNTQUE 9
2919589ea1SChad David.Os
3019589ea1SChad David.Sh NAME
3143826d2cSKonstantin Belousov.Nm insmntque ,
3243826d2cSKonstantin Belousov.Nm insmntque1
3319589ea1SChad David.Nd "associate a vnode with a mount"
3419589ea1SChad David.Sh SYNOPSIS
3519589ea1SChad David.In sys/param.h
3619589ea1SChad David.In sys/vnode.h
3719589ea1SChad David.Ft int
3819589ea1SChad David.Fn insmntque "struct vnode *vp" "struct mount *mp"
3943826d2cSKonstantin Belousov.Ft int
40*90be4091SKonstantin Belousov.Fn insmntque1 "struct vnode *vp" "struct mount *mp"
4119589ea1SChad David.Sh DESCRIPTION
4219589ea1SChad DavidThe
4319589ea1SChad David.Fn insmntque
4419589ea1SChad Davidfunction associates a vnode with a mount.
4519589ea1SChad DavidThis includes updating
4619589ea1SChad David.Va v_mount
47c62a048bSChristian Bruefferfor the vnode, and inserting the vnode into the mount's vnode list.
4819589ea1SChad David.Pp
49*90be4091SKonstantin BelousovThe indirect mount reference count, maintained as the count of the
50*90be4091SKonstantin Belousovvnodes owned by it, is incremented for each vnode added to the
5119589ea1SChad Davidmount, and that reference is decremented by
5243826d2cSKonstantin Belousov.Xr vgone 9 .
5319589ea1SChad David.Pp
5419589ea1SChad DavidThe mount's interlock is held while the vnode is inserted.
55*90be4091SKonstantin BelousovThe vnode must be exclusively locked.
5643826d2cSKonstantin Belousov.Pp
5743826d2cSKonstantin BelousovOn failure,
5843826d2cSKonstantin Belousov.Fn insmntque
59*90be4091SKonstantin Belousovresets vnode' operation vector to the vector of
60*90be4091SKonstantin Belousov.Xr deadfs 9 ,
61*90be4091SKonstantin Belousovclears
62*90be4091SKonstantin Belousov.Va v_data ,
63*90be4091SKonstantin Belousovand then calls
6443826d2cSKonstantin Belousov.Xr vgone 9
65*90be4091SKonstantin Belousovand
66*90be4091SKonstantin Belousov.Xr vput 9 .
6743826d2cSKonstantin BelousovIf more elaborated cleanup after
6843826d2cSKonstantin Belousov.Fn insmntque
6943826d2cSKonstantin Belousovfailure is needed, the
7043826d2cSKonstantin Belousov.Fn insmntque1
7143826d2cSKonstantin Belousovfunction may be used instead.
72*90be4091SKonstantin BelousovIt does not do any cleanup following a failure, leaving all
73*90be4091SKonstantin Belousovthe work to the caller.
74*90be4091SKonstantin BelousovIn particular, the operation vector
75*90be4091SKonstantin Belousov.Va v_op
76*90be4091SKonstantin Belousovand
77*90be4091SKonstantin Belousov.Va v_data
78*90be4091SKonstantin Belousovfields of the vnode are kept intact.
7919589ea1SChad David.Sh RETURN VALUES
8043826d2cSKonstantin BelousovThe
8143826d2cSKonstantin Belousov.Fn insmntque
82c62a048bSChristian Bruefferfunction will always return 0, unless the file system is currently being unmounted
83c62a048bSChristian Bruefferin which case it may return
84c62a048bSChristian Brueffer.Dv EBUSY .
85c62a048bSChristian BruefferAlso,
86c62a048bSChristian Brueffer.Fn insmntque
87c62a048bSChristian Brueffermay be forced to insert the vnode into the mount's vnode list
8843826d2cSKonstantin Belousovby setting the
8943826d2cSKonstantin Belousov.Va VV_FORCEINSMQ
9043826d2cSKonstantin Belousovflag in the vnode
9143826d2cSKonstantin Belousov.Va v_flag ,
9243826d2cSKonstantin Belousoveven if the file system is being unmounted.
9319589ea1SChad David.Sh SEE ALSO
9419589ea1SChad David.Xr vgone 9
9519589ea1SChad David.Sh AUTHORS
9619589ea1SChad DavidThis manual page was written by
978a7314fcSBaptiste Daroussin.An Chad David Aq Mt davidc@acns.ab.ca .
98