vfs_setlease(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– vfs_setlease(9) πŸ’–

okay so bestie, welcome to the Kernel API Manual β€” this one's vfs_setlease(9), and it's the whole "put a lease on an open file" situation. coming at you fresh from the ./fs directory, October 2026 edition. let's get into it 🫢


✨ NAME ✨

vfs_setlease β€” sets a lease on an open file. that's it, that's the whole vibe. πŸŽ€


🌸 SYNOPSIS 🌸

int vfs_setlease (struct file *filp , int arg , struct file_lease
**lease , void **priv );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • filp β€” the file pointer. like, which file are we even talking about, bestie πŸ’…
  • arg β€” the type of lease you're trying to obtain. yes, this one matters πŸ‘‘
  • lease β€” the file_lock to use when adding a lease 🌈
  • priv β€” private info for lm_setup when adding a lease. it may be NULL if lm_setup doesn't require it, so no pressure πŸ“

πŸ’œ DESCRIPTION πŸ’œ

Call this to establish a lease on the file. simple enough, right? 😌

Lowkey the tea here: the lease argument is not used for F_UNLCK requests, and it may be NULL. so don't come for it when it's not even invited πŸ«₯

Now for commands that set or alter an existing lease, the (*lease)->fl_lmops->lm_break operation must be set. if it's not, this function will return -ENOLCK (and generate a scary-looking stack trace). not me warning you twice β€” it's giving "you were told" energy, so please set it πŸ™ˆπŸ’€

The priv pointer is passed directly to the lm_setup function, as-is. it may be NULL if the lm_setup operation doesn't require it. no middleman, no processing, just straight through ✨


πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./fs/locks.c, plus this whole friend group of functions that also live in the (9) section β€” literally the group chat, iykyk:


okay that's the whole page, bestie, you ate that πŸ† and just so it's on the record: this one shipped in the Kernel API Manual from ./fs, dated October 2026, and it's vfs_setlease(9) β€” iconic, no cap. mwah πŸ’‹πŸ’–


πŸ“¦ where this page comes from