VHOLD(9)
πΈ VHOLD(9) β the Kernel Developer's Manual, but make it make sense πΈ
okay bestie, welcome to section 9 of the Kernel Developer's Manual β you're in the big-kid kernel-functions part now, and today's episode is all about getting and releasing a hold on a vnode. yes. that's the whole vibe. let's go π
β¨ NAME β¨
vhold, vdrop, vdropl β acquire/release a hold on a vnode
(yes, the NAME line says exactly those three β vhold, vdrop, vdropl β and we are not editing it, we are respecting it π«Ά vholdl shows up in the synopsis below, don't worry, she's there too.)
β¨ SYNOPSIS β¨
#include <sys/param.h>
#include <sys/vnode.h>
void
vhold(struct vnode *vp);
void
vholdl(struct vnode *vp);
void
vdrop(struct vnode *vp);
void
vdropl(struct vnode *vp);
four little functions, all void, all taking a struct vnode *vp, all iconic in their own way π
π DESCRIPTION π
so. vhold() and vholdl() β these two cuties increment the v_holdcnt of the vnode you hand them. and like, plot twist: if that vnode has already been added to the free list and is still referenced, it gets removed from there. say bye π
meanwhile vdrop() and vdropl() are the opposite girlies β they decrement the v_holdcnt of the vnode. and if the holdcount is less than or equal to zero before you call vdrop() or vdropl()...
π¨ the system will panic. like, full-on. not a vibe check, an actual panic. do not let v_holdcnt hit zero-or-below before you drop. periodt. π
and if the vnode is no longer referenced? it gets freed. clean. gone. released into the void π¦
now the locking tea β β because this is the part everyone forgets:
vhold()andvdrop()lock the vnode interlock for you. they handle it. main character energy, they've got it covered.vholdl()andvdropl()expect the interlock to already be held</> when you call them. so if you didn't lock it first, that's on you, bestie π
iykyk β the trailing l is the "locked already" one. no cap.
π SEE ALSO π
vnode(9)β go read it, she's the whole ecosystem π§
π AUTHORS π
This manual page was written by Chad David <davidc@acns.ab.ca>. thank you Chad, king behavior πβ¨
and that's the page!! π this beauty shipped with Debian and is dated April 1, 2007 β so if the panic warning felt like a joke, it is NOT, it's from 2007 and it's still real π mwah, go hold some vnodes responsibly π«Ά
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms