nfsd_cache_lookup(9)
π 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 inrqstp->rq_argof the NFS Call header. yes, thatrqstp->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
- 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