setattr_copy(9)
π setattr_copy π
okay so bestie, welcome to the setattr_copy(9) page from the Kernel API Manual β¨ this one is short but she is important: she copies simple metadata updates into the generic inode, and she has very specific lock and idmap energy. iykyk π
π NAME π
setattr_copy β copy simple metadata updates into the generic inode. that's the whole name, no notes π
β¨ SYNOPSIS β¨
here's the signature, exactly as she comes:
void setattr_copy (struct mnt_idmap *idmap , struct inode *inode , const
struct iattr *attr );
π«Ά ARGUMENTS π«Ά
the lil cast of characters:
idmapβ the idmap of the mount the inode was found from π¦inodeβ the inode to be updated β¨attrβ the new attributes π
πΈ DESCRIPTION πΈ
setattr_copymust be called withi_rwsemheld exclusively. no cap, exclusive lock energy only π
It updates the inode's metadata with that specified in attr on idmapped mounts. The necessary permission checks to determine whether or not the S_ISGID property needs to be removed are performed with the correct idmapped mount permission helpers. iconic, but also very specific π
Noticeably missing is inode size update, which is more complex as it requires pagecache updates. so yeah, size is not invited to this function's party π
If the inode has been found through an idmapped mount, the idmap of the vfsmount must be passed through idmap. This function will then take care to map the inode according to idmap before checking permissions. On non-idmapped mounts, or if permission checking is to be performed on the raw inode, simply pass nop_mnt_idmap. π¦
The inode is not marked as dirty after this operation. The rationale is that for "simple" filesystems, the struct inode is the inode storage. The caller is free to mark the inode dirty afterwards if needed. periodt β¨
π₯ SEE ALSO π₯
Kernel file ./fs/attr.c is the home base, and the whole squad is:
setattr_should_drop_sgid(9)setattr_should_drop_suidgid(9)chown_ok(9)chgrp_ok(9)setattr_prepare(9)inode_newsize_ok(9)setattr_copy_mgtime(9)notify_change(9)
mwah π this page lives in ./fs, is dated October 2026, and stars setattr_copy(9) β bye bestie, go be iconic with your metadata π«Άπ
π¦ 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