nfsd_cache_lookup(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… nfsd_cache_lookup(9) β€” from the Kernel API Manual, bestie

okay so picture this: it's giving kernel internals, it's giving duplicate reply cache realness. This is nfsd_cache_lookup, straight out of the Kernel API Manual, and honestly? She's iconic. Let's get into it 🫢


✨ NAME ✨

nfsd_cache_lookup β€” bestie's whole job is finding an entry in the duplicate reply cache. That's it, that's the vibe. πŸ”


🌸 SYNOPSIS 🌸

int nfsd_cache_lookup (struct svc_rqst *rqstp , unsigned int start ,
       unsigned int len , struct nfsd_cacherep **cacherep );

no cap, that's the exact signature, copy it character for character or the compiler will absolutely come for you 😭


πŸŽ€ ARGUMENTS πŸŽ€

  • rqstp β€” the Incoming Call we're trying to find. like, the main character of this whole search πŸ’«
  • start β€” starting byte in rqstp->rq_arg of the NFS Call header. yes, that rqstp->rq_arg, keep up bestie 🧚
  • len β€” size of the NFS Call header, in bytes. units matter, always πŸ’œ
  • cacherep β€” OUT parameter, meaning it's how the function hands stuff back to you: it's the DRC entry for this request πŸ“€

πŸ”₯ DESCRIPTION πŸ”₯

So the goal is literally just: try to find an entry matching the current call in the cache. That's the mission. 🎯

When none is found (and yeah, it happens), we try to grab the oldest expired entry off the LRU list. Recycling! Sustainable queen behavior 🌈

But if a suitable one isn't there either? Then we drop the cache_lock and allocate a new one β€” and then we search again, just in case one got inserted while this thread didn't hold the lock. the way that race condition could have ended us 😭 locked-in behavior fr fr πŸ’€

lowkey important: that second search exists for a reason. Threads be threading. Don't skip it, don't "optimize" it, just trust the process ✨

And now the return values, aka the vibe check results:

  • RC_DOIT β€” Process the request normally. slay, business as usual πŸ’…
  • RC_REPLY β€” Reply from cache. we already had this one, we're just serving it up again πŸ‘‘
  • RC_DROPIT β€” Do not process the request further. that's a wrap, we're done here πŸ™ˆ

πŸ¦‹ SEE ALSO πŸ¦‹

Kernel file ./fs/nfsd/nfscache.c, plus the whole friend group:

go read them, iykyk πŸ“š


this has been nfsd_cache_lookup(9) from ./fs/nfsd, dated October 2026 β€” and yes the page header said nfsd_cache_lookup(9) too, because consistency is chic πŸ’– stay caffeinated, stay locked, and remember: the cache sees everything πŸŽ€βœ¨

πŸ“¦ where this page comes from