nfsd_file_acquire_opened(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… nfsd_file_acquire_opened(9) πŸ’…

okay so bestie, we're in the Kernel API Manual today and the star of the show is nfsd_file_acquire_opened β€” literally the function that grabs you a struct nfsd_file using an already-open file instead of going to all the trouble of opening a new one. iconic behavior tbh πŸŽ€


✨ NAME ✨

nfsd_file_acquire_opened β€” get a struct nfsd_file using existing open file 🫢


🌸 SYNOPSIS 🌸

__be32 nfsd_file_acquire_opened (struct svc_rqst *rqstp , struct svc_fh
*fhp , unsigned int may_flags , struct file *file , struct nfsd_file
**pnf );

no cap, that's the whole signature πŸ’–


πŸ¦‹ ARGUMENTS πŸ¦‹

  • rqstp β€” the RPC transaction being executed, i.e. the whole reason we're here rn ✨
  • fhp β€” the NFS filehandle of the file just created πŸ‘‘
  • may_flags β€” the NFSD_MAY_ settings for the file, so it knows what's allowed πŸ’…
  • file β€” cached, already-open file. and yes bestie, it may be NULL or not yet opened πŸ™ˆ
  • pnf β€” OUT: the new or found struct nfsd_file object lands here πŸŽ€

πŸ”₯ DESCRIPTION πŸ”₯

so the vibe here is: acquire an nfsd_file object that is not GC'ed. that's the whole mission. ⭐

and if one doesn't already exist, and file has FMODE_OPENED set, then use it to instantiate a new nfsd_file instead of opening a new one. the way that saves you an open call… obsessed πŸ˜­πŸ’–

Return values, listen up:

  • nfs_ok β€” pnf points to an nfsd_file with its reference count boosted πŸ‘‘ (yes, boosted, main character reference count energy)
  • On error, an nfsstat value in network byte order is returned 🌈
fr fr, remember the network byte order part, it's giving "I will bite you if you forget" πŸ’€

πŸ’œ SEE ALSO πŸ’œ

Kernel file ./fs/nfsd/filecache.c

nfsd_file_check_write_error(9), nfsd_file_put(9), nfsd_file_put_local(9), nfsd_file_file(9), nfsd_file_dispose_list_delayed(9), nfsd_file_net_dispose(9), nfsd_file_lru_cb(9), nfsd_file_cond_queue(9), nfsd_file_queue_for_close(9), nfsd_file_close_inode(9), nfsd_file_close_inode_sync(9), nfsd_file_close_export(9), __nfsd_file_cache_purge(9), nfsd_file_cache_purge(9), nfsd_file_is_cached(9), nfsd_file_acquire_gc(9), nfsd_file_acquire(9), nfsd_file_acquire_local(9), nfsd_file_acquire_dir(9), nfsd_fsnotify_recalc_mask(9)

like. the whole friend group. go say hi πŸ«ΆπŸ’…


and that's the page babes πŸŽ€ huge shoutout to ./fs/nfsd, dated October 2026, for making this little kernel-API moment possible. slay, periodt, bye πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from