nfs_vmtruncate(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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:

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