find_inode_by_ino_rcu(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ find_inode_by_ino_rcu(9) ✨

okay so this is a page from the Kernel API Manual, section 9, and bestie it's literally called find_inode_by_ino_rcu β€” we're doing inode cache scavenger hunts today, lmk if you're seated πŸ’…


πŸŽ€ NAME πŸŽ€

find_inode_by_ino_rcu β€” Find an inode in the inode cache. that's it, that's the whole vibe: you go looking for an inode, it's in the cache, slay 🌸


πŸ¦‹ SYNOPSIS πŸ¦‹

struct inode * find_inode_by_ino_rcu (struct super_block *sb , u64 ino );

like, you hand it a super block and an inode number, and it hands you back a struct inode *. iconic signature ngl 🫢


πŸ’– ARGUMENTS πŸ’–

  • sb β€” Super block of file system to search. this is the neighborhood you're snooping around in, bestie 🏘️
  • ino β€” The inode number to match. the exact number you're looking for, no substitutions, no "close enough" πŸ™…β€β™€οΈ

πŸ”₯ DESCRIPTION πŸ”₯

okay so here's what's going down: it searches for the inode specified by hashval and data in the inode cache. and the helper function test is the one doing the judging β€” it returns 0 if the inode does not match, and 1 if it does. real binary queen behavior πŸ‘‘

⚠️ and listen, the test function has responsibilities, okay? it must be responsible for taking the i_lock spin_lock and checking i_state for an inode being freed or being initialized. no cap, that's on test, not on this function πŸ’€

If successful, this will return the inode for which the test function returned 1, and NULL otherwise. so like, 1 = you found your girl, NULL = she's not here, go home 😭

and here's the strict part β€” the test function is not permitted to take a ref on any inode presented. also not permitted to sleep. nope. not allowed. we don't do that here πŸ™ˆ

πŸ’€ big one: the caller must hold the RCU read lock. like, must must. that's not a suggestion, that's the law of this function periodt.

🌈 SEE ALSO 🌈

Kernel file ./fs/inode.c β€” and honestly the whole inode squad is here, roll call bestie πŸ“‹:

inode_init_always_gfp(9), alloc_inode(9), drop_nlink(9), clear_nlink(9), set_nlink(9), inc_nlink(9), inode_sb_list_add(9), __insert_inode_hash(9), __remove_inode_hash(9), evict_inodes(9), new_inode(9), unlock_new_inode(9), lock_two_nondirectories(9), unlock_two_nondirectories(9), inode_insert5(9), iget5_locked(9), iget5_locked_rcu(9), iget_locked(9), iunique(9), ihold(9), ilookup5_nowait(9), ilookup5(9), ilookup(9), find_inode_nowait(9), find_inode_rcu(9), iput(9), iput_not_last(9), bmap(9), inode_update_time(9), generic_update_time(9), atime_needs_update(9), file_remove_privs(9), current_time(9), file_update_time(9), file_modified_flags(9), file_modified(9), kiocb_modified(9), inode_init_owner(9), inode_owner_or_capable(9), inode_dio_wait(9), timestamp_truncate(9), inode_set_ctime_current(9), inode_set_ctime_deleg(9), in_group_or_capable(9), mode_strip_sgid(9), dump_inode(9)

every single one, we don't skip the lineup πŸ’œ


and that's the page!! this one came from the source ./fs, dated October 2026 β€” bookmark it, screenshot it, send it to the group chat, whatever you gotta do πŸŽ€πŸ’–βœ¨ mwah, go find those inodes bestie πŸ¦‹

πŸ“¦ where this page comes from