may_write_xattr(9)
π may_write_xattr(9) β the kernel API manual, bestie edition π
okay so bestie, welcome to the may_write_xattr(9) page β¨ it's a kernel API manual situation, and honestly it's giving "tiny function, big vibes." let's get into it π¦
πΈ NAME πΈ
may_write_xattr β literally just vibe-checks whether an inode allows writing xattr. that's the whole job. iconic, honestly π
β¨ SYNOPSIS β¨
int may_write_xattr (struct mnt_idmap *idmap , struct inode *inode );
π«Ά ARGUMENTS π«Ά
idmapβ the idmap of the mount that the inode was found from. like, which mount did this inode come from, bestie, we need receipts πinodeβ the inode you're trying to set an xattr on. the main character of this whole function, fr fr π
π DESCRIPTION π
okay so what this actually does: it checks whether the inode allows writing xattrs. vibe check, but for permissions π
specifically β and this is the important part, no cap β we can never set or remove an extended attribute on a read-only filesystem, or on an immutable / append-only inode. that's a hard no. not happening. the kernel said what it said π
we also need to make sure the inode has a mapping in the mount, so we don't risk writing back invalid i_{g,u}id values. like, we're not out here writing garbage back, that's not the move π
β RETURN β
- on success, zero is returned π
- on error, a negative
errnois returned π
that's it. that's the return value. simple, clean, slay β¨
π¦ SEE ALSO π¦
kernel file ./fs/xattr.c β go read it, iykyk π§
__vfs_setxattr_noperm(9)__vfs_setxattr_locked(9)vfs_listxattr(9)__vfs_removexattr_locked(9)generic_listxattr(9)xattr_full_name(9)simple_xattr_space(9)simple_xattr_free(9)simple_xattr_free_rcu(9)simple_xattr_alloc(9)simple_xattr_get(9)simple_xattr_set(9)simple_xattr_set_limited(9)simple_xattr_list(9)simple_xattr_add(9)simple_xattr_add_limited(9)simple_xattrs_free(9)simple_xattr_cache_cleanup(9)
like, the whole xattr friend group showed up to the function. we love a supportive community ππ
and that's the page, bestie! π«Ά this gem comes from./fs, dated October 2026, and the manual name ismay_write_xattr(9). go forth and write those xattrs β responsibly, obviously π β¨
π¦ 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