file_modified_flags(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… file_modified_flags β€” Kernel API Manual (section 9, bestie)

okay so picture this: it's giving "official kernel API manual" energy, the page header says file_modified_flags(9), and today we're reading it together. grab a snack. πŸ“


✨ NAME ✨

file_modified_flags β€” the function that handles mandated vfs changes when you modify a file. yes, mandated. like, it's not optional, it's the law of the vfs. πŸ‘‘


πŸ¦‹ SYNOPSIS πŸ¦‹

int file_modified_flags (struct file *file , int flags );

that's it. that's the whole call. two args, one int back. clean. iconic. πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • file β€” the file that was modified, bestie. the one we're out here modifying. 🫢
  • flags β€” kiocb flags. that's the whole description, don't come for me, I'm just the messenger. 🌸

πŸ’– DESCRIPTION πŸ’–

so when file has been modified, this function makes sure two things happen:

  • special file privileges get removed 🧚
  • time settings get updated ⭐

that's the whole job. slay.

but β€” and this is the part where you need to pay attention β€” if IOCB_NOWAIT is set, then:

  • special file privileges will not be removed
  • time settings will not be updated
  • and it returns -EAGAIN
lowkey that's the whole vibe check of this function: IOCB_NOWAIT means "nope, not doing the privilege/timestamp work, try again later." no cap. 😭

πŸ”₯ CONTEXT πŸ”₯

the caller must hold the file's inode lock. not "should", not "ideally" β€” must. this is not a drill, this is a locking requirement, periodt. πŸ’€


🌈 RETURN 🌈

  • 0 on success πŸŽ‰
  • negative errno on failure πŸ˜”

πŸ‘‘ SEE ALSO πŸ‘‘

okay this list is LONG, so buckle up, we're going through all of it. every single one. no skipping, that's the rule. πŸ’œ

the Kernel file is ./fs/inode.c and here's the full squad:

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), 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(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)

like I said. the whole squad. 🫑


and that's the page, bestie!! we ate, we left no crumbs. this one's from ./fs, dated October 2026, and it's the file_modified_flags(9) kernel API manual page β€” go forth and modify your files responsibly, and please, for the love of everything, hold that inode lock. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from