chgrp_ok(9)
β¨ chgrp_ok β like, the kernel API manual bestie β¨
okay so this is a page from the Kernel API Manual (chgrp_ok(9)) and it's literally about how the kernel double-checks that you're actually allowed to chgrp an inode π
buckle up, it's short and iconic.
π NAME π
chgrp_ok β verify permissions to chgrp inode
like, it's the vibe check that says "bestie, are you sure you're allowed to change this inode's group?" π«Ά
πΈ SYNOPSIS πΈ
bool chgrp_ok (struct mnt_idmap *idmap , const struct inode *inode ,
vfsgid_t ia_vfsgid );
it gives you back a bool, bestie β yes or no, slay or nay π
π¦ ARGUMENTS π¦
idmapβ the idmap of the mount that the inode was found from. like, where did this inode come from, what's its whole mapping situation πinodeβ the inode we're checking permissions on. the main character, fr fr β¨ia_vfsgidβ the gid we want to chown the inode to. the group we're aiming for π―
π DESCRIPTION π
so here's the tea π β if the inode got found through an idmapped mount, then you must pass the idmap of the vfsmount through idmap. no cap, that part matters.
once you do that, this function takes care of mapping the inode according to idmap before it does any permission checking. like, it handles the translation for you, which is lowkey so considerate π§
now, on non-idmapped mounts β or if you wanna do the permission checking on the raw inode instead β just simply pass nop_mnt_idmap. that's it, that's the whole thing π
ngl this is the kind of function that looks tiny but is doing real work under the hood. respect π
π₯ SEE ALSO π₯
- Kernel file
./fs/attr.c setattr_should_drop_sgid(9)setattr_should_drop_suidgid(9)chown_ok(9)setattr_prepare(9)inode_newsize_ok(9)setattr_copy_mgtime(9)setattr_copy(9)notify_change(9)
go read those too, iykyk πβ¨
mwah π that's the page β brought to you by the fine folks over in ./fs, from October 2026, and yes the whole thing lives under the chgrp_ok(9) header. 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