VHOLD(9)
π VHOLD β ok so you wanna hold a vnode?? bestie same π
Welcome to the VHOLD(9) page from the Kernel Developer's Manual, section 9 β the little corner of the manual where we talk about acquire/release a hold on a vnode. Yes queen, this is your group chat briefing. Let's get into it β¨
πΈ SYNOPSIS πΈ
First things first, you gotta bring the right headers to the party or nothing compiles, periodt:
#include <sys/param.h>
#include <sys/vnode.h>
Then the four besties themselves, all returning void because they're above returning things π
:
void
vhold(struct vnode *vp);
void
vholdl(struct vnode *vp);
void
vdrop(struct vnode *vp);
void
vdropl(struct vnode *vp);
π¦ DESCRIPTION π¦
Okay so here's the tea β
The vhold() and vholdl() functions increment the v_holdcnt of the given vnode. That's it, that's the job, no cap. And if that vnode has already been added to the free list and is still referenced, it will be removed. So like⦠it was on the free list, but you said "no ma'am, we're still using this" and it gets pulled back off. Iconic behaviour honestly.
The vdrop() and vdropl() functions decrement the v_holdcnt of the vnode. Now listen, this is the part where you pay attention π β if the holdcount is less than or equal to zero prior to calling vdrop() or vdropl(), the system will panic. Not a vibe. Not cute. A whole kernel panic. π And if the vnode is no longer referenced, it will be freed.
And here's the lock lore, iykyk π:
vhold()andvdrop()β these two lock the vnode interlock themselves. They handle it. They're the responsible ones.vholdl()andvdropl()β these two expect the interlock to already be held. They're not locking anything for you, bestie. You show up with the lock already in hand or you don't show up at all. π
β¨ Quick mnemonic because I love you: thelat the end means "lock's already held, girl." Nol= it locks for you. The more you know π
π SEE ALSO π
Go read your other bestie when you're done here:
vnode(9)β the whole vnode lore, the main character energy, the source material π«Ά
π AUTHORS π
This manual page was written by Chad David <davidc@acns.ab.ca>. We love a credited author, we stan, we give flowers ππΈ
Okay that's the whole page, you're officially a vnode-holding expert now, go forth and do not panic the kernel, I believe in you fr fr π
This came to you from the Debian crew, dated April 1, 2007, filed under VHOLD(9) β mwah, take care of yourself and your reference counts π§β¨π
π¦ 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) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms