INSMNTQUE(9)
π INSMNTQUE β associate a vnode with a mount π
okay bestie, welcome to the insmntque page, from section 9 of the kernel developer's manual. this is the one where we marry a vnode to a mount. it's giving matchmaker energy fr fr. π
β¨ 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 π¦
so like, the insmntque() function associates a vnode with a mount. that's the whole vibe. β¨ and it's not just setting a lil pointer, bestie β it's doing a whole lil ceremony:
- it updates
v_mountfor the vnode - and it inserts the vnode into the mount's vnode list
the mount reference count gets incremented for every vnode added to the mount, and that reference is decremented by vgone(9). so like, every time you add one, the mount's refcount goes up, and vgone(9) is the one that lets it back down. no cap. π
the mount's interlock is held while the vnode is inserted. and for MP-safe file systems? the vnode must be exclusively locked. that's not optional, that's the rules. π
π when it goes wrong (the failure arc) π
on failure, insmntque() calls vgone(9) on the supplied vnode, and then it drops the vnode lock and reference. that's just what it does, it's built different.
but likeβ¦ what if you need more elaborate cleanup after an insmntque() failure? π that's literally why insmntque1() exists, bestie. it's the glow-up version. here's the tea:
- the
dtrargument is a pointer to a function that gets called on failure - that function may perform any custom cleanup you need. go off, it's your moment. π
- the vnode pointer is supplied as the first argument to
dtr - the
dtr_argargument is the second one, supplying any additional context needed
so yeah, insmntque1() lets you do your own lil cleanup ritual instead of the default one. iconic.
β 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 theVV_FORCEINSMQflag in the vnodev_flagβ even if the file system is being unmounted. so like, you can override the vibe check if you really want to. slay, but carefully. π
π SEE ALSO π
π AUTHORS π
this manual page was written by Chad David <davidc@acns.ab.ca>. thank you chad, you ate. π«Ά
and that's the whole page bestie!! πβ¨ this one came from Debian, dated September 8, 2008 β so it's older than most of the group chat but it's still serving. go forth and associate those vnodes. mwah. π πΈ
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (C) 2008 Chad David <davidc@acns.ab.ca>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms