inode_newsize_ok(9)
πΈ NAME πΈ
inode_newsize_ok(9) β bestie, this is the Kernel API Manual entry for the function that asks: may this inode be truncated to a given size? β¨
π SYNOPSIS π
int inode_newsize_ok (const struct inode *inode , loff_t offset );
π ARGUMENTS π
inodeβ the inode that's getting truncated, aka the main character here. πoffsetβ the new size you want to assign to that inode. Not a suggestion, bestie.
π¦ DESCRIPTION π¦
Okay so first rule: inode_newsize_ok must be called with i_rwsem held exclusively. Like, not optional, not βoops I forgotβ β hold it exclusively. π
Then it checks filesystem limits and ulimits to make sure the new inode size is within limits. It will also send SIGXFSZ when necessary. Lowkey important. π
β οΈ If failure is returned, the caller must not proceed with the inode size change. Periodt.
Also: inode must be a file (not a directory), with appropriate permissions to allow truncate. And because this is giving βread the roomβ: inode_newsize_ok does NOT check these conditions. That's on the caller, bestie β no cap. π
π₯ RETURN π₯
0on success β slay. β¨-ve errnoon failure β not slay, handle it. π
π SEE ALSO π
Kernel file ./fs/attr.c: setattr_should_drop_sgid(9), setattr_should_drop_suidgid(9), chown_ok(9), chgrp_ok(9), setattr_prepare(9), setattr_copy_mgtime(9), setattr_copy(9), notify_change(9).
mwah π β source/version ./fs, date October 2026, page inode_newsize_ok(9). Byeee π«Ά
π¦ 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