vfs_setlease(9)
π 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β thefile_lockto use when adding a lease πprivβ private info forlm_setupwhen adding a lease. it may beNULLiflm_setupdoesn'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:
locks_owner_has_blockers(9)lease_open_conflict(9)locks_delete_block(9)posix_lock_file(9)posix_lock_inode_wait(9)inode_lease_ignore_mask(9)__break_lease(9)lease_get_mtime(9)__fcntl_getlease(9)generic_setlease(9)fcntl_setlease(9)fcntl_setdeleg(9)flock_lock_inode_wait(9)locks_lock_inode_wait(9)sys_flock(9)vfs_test_lock(9)locks_translate_pid(9)vfs_lock_file(9)vfs_cancel_lock(9)vfs_inode_has_locks(9)
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
- 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