---
name: "insmntque1"
section: "9freebsd"
platform: "linux"
package: "freebsd-manpages"
version: "12.2-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/insmntque/9freebsd"
---

# insmntque1(9freebsd)

associate a vnode with a mount

Part of [insmntque(9freebsd)](/insmntque/9freebsd.md).

## NAME

**insmntque**, **insmntque1** – associate a vnode with a mount

## SYNOPSIS

**#include \<sys/param.h\>**

**#include \<sys/vnode.h\>**

*int*\

**insmntque**(*struct vnode \*vp*, *struct mount \*mp*);

*int*\

**insmntque1**(*struct vnode \*vp*, *struct mount \*mp*, *void (\*dtr)(struct vnode \*, void \*)*, *void \*dtr\_arg*);

## DESCRIPTION

The **insmntque**() function associates a vnode with a mount. This includes updating *v\_mount* for the vnode, and inserting the vnode into the mount's vnode list.

The mount reference count is incremented for each vnode added to the mount, and that reference is decremented by [vgone(9)](/vgone/9.md).

The mount's interlock is held while the vnode is inserted. For MP-safe file systems, the vnode must be exclusively locked.

On failure, **insmntque**() calls [vgone(9)](/vgone/9.md) on the supplied vnode, and then drops the vnode lock and reference. If more elaborated cleanup after **insmntque**() failure is needed, the **insmntque1**() function may be used instead. The *dtr* argument is a pointer to a function that is called on failure. This function may perform any custom cleanup. The vnode pointer is supplied as the first argument to *dtr*. The *dtr\_arg* argument is the second, supplying any additional context needed.

## RETURN VALUES

The **insmntque**() function will always return 0, unless the file system is currently being unmounted in which case it may return EBUSY. Also, **insmntque**() may be forced to insert the vnode into the mount's vnode list by setting the *VV\_FORCEINSMQ* flag in the vnode *v\_flag*, even if the file system is being unmounted.

## SEE ALSO

[vgone(9)](/vgone/9.md)

## AUTHORS

This manual page was written by Chad David ⟨*davidc@acns.ab.ca*⟩.
