dget_dlock(9)
π dget_dlock β the manual page, but make it make sense
okay so bestie, welcome to the Kernel API Manual, section 9 (that's the kernel-y one π§). today we're talking about dget_dlock, and honestly? she's iconic, she's tiny, she's a one-job queen. let's get into it.
β¨ NAME β¨
dget_dlock β get a reference to a dentry π
like, that's it. that's her whole thing. grab a ref, keep it moving.
β¨ SYNOPSIS β¨
struct dentry * dget_dlock (struct dentry *dentry );
yes that's the whole signature, no cap. returns a struct dentry *, takes a struct dentry * named dentry. symmetrical. slay. π
β¨ ARGUMENTS β¨
dentryβ the dentry you want a reference to π«Ά that's the one, that's the girl, that's the dentry.
β¨ DESCRIPTION β¨
okay so picture this: you've got a live dentry (alive = the vibe, we'll get to it). hand it over to dget_dlock and she goes β¨ increment the reference count β¨ and gives you the dentry right back. boom. done. main character energy.
now the important part, and i need you to hear me on this one:
The caller must hold dentry->d_lock. fr fr. no exceptions. hold the lock, or don't come to the function. π
and the other big one: making sure that dentry is actually alive? that's the caller's responsibility, not hers. she's not doing vibe checks on your behalf, bestie. π
and before you panic β there are so many conditions that are sufficient to guarantee a dentry is alive. like, genuinely a lot of them. for example:
- anything with a non-negative refcount is alive β that one alone carries so hard π
- anything that's hashed counts too
- anything positive? alive.
- anyone's parent? also alive.
etc., etc. β the list keeps going, iykyk. π
β¨ SEE ALSO β¨
literally the whole friend group, all chilling in the kernel file ./include/linux/dcache.h:
dget(9)d_unhashed(9)d_really_is_negative(9)d_really_is_positive(9)d_inode(9)d_inode_rcu(9)d_backing_inode(9)d_real(9)d_real_inode(9)
go say hi to them. they're all in the same header, it's giving family reunion πΈ
okay that's the whole page, you ate that π this lil drop lives in ./include/linux, dated October 2026, and it's part of the Kernel API Manual β mwah, love u, go hold that lock πβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms