dget_dlock(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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:

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