kernfs_dere..._node_locked(9)
π kernfs_dere..._node_locked(9) β¨
okay bestie, welcome to the Kernel API Manual π β no cap, this one's a short one but it's important, so like, pay attention fr fr.
πΈ NAME πΈ
kernfs_deref_open_node_locked β grab the kernfs_open_node that matches @kn, that's literally the whole job π«Ά
β¨ SYNOPSIS β¨
struct kernfs_open_node * kernfs_deref_open_node_locked (struct kernfs_node *kn );
like yes, that's the whole signature, she's lowkey minimal π
π¦ ARGUMENTS π¦
knβ the targetkernfs_node. this is the node you're asking about, bestie, hand her over and she'll hand you the goods β¨
π DESCRIPTION π
okay so here's the vibe: this thing fetches and returns ->attr.open of kn β but only when the caller is already holding kernfs_open_file_mutex_ptr(kn). that's the whole deal, iykyk π₯
and like, why does that matter? because updates to ->attr.open happen under kernfs_open_file_mutex_ptr(kn). so when the caller guarantees that this mutex is being held, other updaters literally can't touch ->attr.open, which means β and this is the iconic part β we can safely deref ->attr.open outside an RCU read-side critical section. no RCU era needed, we're free π¦β¨
β οΈ but listen: the caller needs to make sure that kernfs_open_file_mutex is held. that's not a suggestion, that's the whole contract, bestie. don't skip it π
π RETURN π
kn->attr.open β returned when kernfs_open_file_mutex is held. that's it. that's the return value. periodt π
π SEE ALSO π
- Kernel file
./fs/kernfs/file.c of_on(9)kernfs_get_open_node(9)kernfs_unlink_open_file(9)kernfs_notify(9)__kernfs_create_file(9)
and that's the page, bestie!! ππ«Ά mwah π β this one came straight out of ./fs/kernfs, dated October 2026, under the same title kernfs_dere..._node_locked(9). slay, go hold that mutex πβ¨
π¦ 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