close_cached_dir_locked(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… close_cached_dir_locked(9)

okay so real talk, bestie β€” this is a page from the Kernel API Manual, section 9, and we're about to make friends with a very specific little function. it's not the main character of the file, but it is the main character of this page. periodt. πŸŽ€


✨ NAME ✨

close_cached_dir_locked β€” put a reference of a cached dir with cfid_list_lock held πŸ¦‹

🌸 SYNOPSIS 🌸

void close_cached_dir_locked (struct cached_fid *cfid );

πŸ’– ARGUMENTS πŸ’–

  • cfid β€” the cached dir. yeah. that's the whole argument. she's the dir, she's cached, she's the one we're putting a reference on. iconic behavior honestly 🫢

πŸ”₯ DESCRIPTION πŸ”₯

okay so here's the tea β˜• β€” if you call close_cached_dir while holding cfid_list_lock, there's a potential effect of causing a deadlock, and that only happens if the invariant refcount >= 2 is false. so like… not always, but the risk is right there and we're not about to pretend it isn't. 😭

this function exists for paths that hold cfid_list_lock and expect at least two references. that's the whole vibe check: two refs minimum, no exceptions. if that invariant is violated, it WARNs and returns without dropping a reference β€” not a single one, nope, she's not doing that 🚫

⚠️ so if you're in that violated-invariant situation, you're not done. the final put must still go through close_cached_dir. don't skip it, don't forget it, don't "it's probably fine" it. it's not fine. go do the final put. πŸ’€

πŸ‘‘ SEE ALSO πŸ‘‘

  • Kernel file ./fs/smb/client/cached_dir.c
  • close_cached_dir(9) β€” the other one, the one you actually finish with πŸ’œ

and that's the whole page, bestie! 🌈 this absolute gem lives in ./fs/smb/client and it's dated October 2026, page close_cached_dir_locked(9) in the Kernel API Manual. lowkey obsessed with how short and specific she is. slay, go drop that reference properly βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from