do_inode_permission(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… do_inode_permission(9) β€” from the Kernel API Manual, bestie

Okay so picture this: you're in the kernel, you need a permission check, and you want it fast. This is that function. Let's get into it 🫢


✨ NAME ✨

do_inode_permission β€” literally just UNIX permission checking, no cap πŸ’…


🌸 SYNOPSIS 🌸

int do_inode_permission (struct mnt_idmap *idmap , struct inode *inode ,
       int mask );

Three args, one int back. Clean. Iconic. We love a signature that doesn't overstay its welcome ✨


πŸŽ€ ARGUMENTS πŸŽ€

  • idmap β€” the idmap of the mount that this inode was found from. like, which mount family it belongs to, yk? πŸ¦‹
  • inode β€” the actual inode we're checking permissions on. this is the main character here πŸ‘‘
  • mask β€” which right(s) you're checking for β€” think MAY_READ, MAY_WRITE, MAY_EXEC ... that whole squad πŸ’«

πŸ’– DESCRIPTION πŸ’–

So here's the vibe: we _really_ want to just call generic_permission without even looking at the inode->i_op values. Like, why are we even checking, right? πŸ™ˆ

The way we pull this off is by keeping a cache flag in inode->i_opflags that basically says:

"this has not special permission function, use the fast case" ⚑

Translation bestie: if that flag's set, we skip the whole investigation and go straight to the fast path. No detours, no drama, just speed 🏎️✨


πŸ¦‹ SEE ALSO πŸ¦‹

Everything's in the kernel file ./fs/namei.c β€” here's the whole friend group, no one left out fr fr:


ngl bestie, if you're poking at i_opflags yourself, pls be careful β€” the fast case is only fast because that flag tells the truth πŸ’€

🌈 and that's the page!! brought to you by ./fs, dated October 2026 β€” mwah, read it again whenever you forget how the fast path works πŸ’œπŸŽ€

πŸ“¦ where this page comes from