lock_two_nondirectories(9)
π lock_two_nondirectories(9) β Kernel API Manual, bestie edition β¨
Okay so listen π«Ά this is lock_two_nondirectories, from the Kernel API Manual, and it's genuinely one of those tiny-but-iconic little helpers. Sit down, grab a π, and let's get into it.
β¨ NAME β¨
lock_two_nondirectories β take two i_mutexes on non-directory objects π₯
Like, it locks two of them. Two. i_mutexes. On objects that are not directories. That's the whole assignment and it ate. π
πΈ SYNOPSIS πΈ
void lock_two_nondirectories (struct inode *inode1 , struct inode
*inode2 );
Lowkey just two inodes going in, and nothing coming out (void, she's giving no return value, main character energy). β¨
π ARGUMENTS π
inode1β the first inode to lock, bestie. First in line, first to get locked. πinode2β the second inode to lock. She's second but she still slays. π¦
π DESCRIPTION π
So here's the vibe: it locks any non-NULL argument. That's it, that's the whole personality. π
π¨ Important queen behaviour: the objects you pass in must not be directories. Like, genuinely must not. This function is for non-directories β the name literally says it, iykyk.
And the count? Zero, one or two objects may be locked by this function. Zero is valid! One is valid! Two is valid! The way she's flexible like that π π
π§ SEE ALSO π§
The kernel file ./fs/inode.c, plus all these lil friends β and yes, I'm listing every single one because we don't skip anyone in this group chat π:
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)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)find_inode_by_ino_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)
β Also shoutout to unlock_two_nondirectories(9) up there β she's the cleanup crew, the lock_two's other half, the one who actually lets go. Iconic duo, no cap. π«Ά
Alright bestie, that's the whole page π β brought to you by the ./fs crew, dated October 2026, and printed in your very own terminal. Go lock those non-directories. Responsibly. Periodt. πππ
π¦ 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