nfs_vmtruncate(9)
π nfs_vmtruncate(9) β like, the Kernel API Manual bestie, we're in it π
okay so welcome to the nfs_vmtruncate page, this is from the Kernel API Manual and it's lowkey one of those tiny functions that does one very specific thing and will absolutely wreck your day if you call it wrong, so let's get into it β¨
πΈ NAME πΈ
nfs_vmtruncate β unmaps the mappings that got "freed" by the truncate() syscall π«Ά
like, the syscall said "these pages are gone bestie" and this function is the one that actually makes the mappings go away for real. no cap.
π¦ SYNOPSIS π¦
int nfs_vmtruncate (struct inode * inode , loff_t offset );
that's the whole signature, she's compact, she's iconic π
π ARGUMENTS π
inodeβ the inode of the file that's being used. yes, that inode. the one you already have. πoffsetβ the file offset where the truncating starts. everything from here on out is getting unmapped βοΈ
π DESCRIPTION π
so here's the tea β β this is literally a copy of the common vmtruncate, but with the locking corrected. why, you ask? because NFS has requirements, and those requirements say that inode->i_size must be updated while holding inode->i_lock. so the locking got reworked to actually respect that. main character energy from the lock, honestly π₯
β NOTE β
π¨ must be called with inode->i_lock held! π¨
not "should", not "ideally", not "if you feel like it" β must. do not skip this. this is the whole point of the function existing. fr fr π
π SEE ALSO π
the whole friend group, in the order the page gives them, bestie:
- Kernel file
./fs/nfs/inode.cnfs_sync_mapping(9) nfs_setattr_update_inode(9)nfs_close_context(9)nfs_revalidate_inode(9)nfs_clear_invalid_mapping(9)nfs_revalidate_mapping(9)nfs_check_inode_attributes(9)nfs_fattr_set_barrier(9)nfs_inode_attrs_cmp_generic(9)nfs_inode_attrs_cmp_monotonic(9)nfs_inode_attrs_cmp_strict_monotonic(9)nfs_inode_attrs_cmp(9)nfs_inode_finish_partial_attr_update(9)nfs_refresh_inode(9)nfs_post_op_update_inode(9)nfs_post_op_update_inode_force_wcc_locked(9)nfs_post_op_update_inode_force_wcc(9)
that's a lot of siblings but they're all slaying in their own way π§π
okay that's the page!! π this one lives in ./fs/nfs, it's dated October 2026, and the page itself is nfs_vmtruncate(9) β mwah, go hold that i_lock before you call her, i'm begging ππ
π¦ 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