Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 61448
b: refs/heads/master
c: f9ffed2
h: refs/heads/master
v: v3
  • Loading branch information
J. Bruce Fields authored and J. Bruce Fields committed Jul 18, 2007
1 parent 7dbdf6f commit 5dbb797
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a9933cea7a1d80dd9efae9f1acd857f5dce742b9
refs/heads/master: f9ffed26d6f3e6ac9988947242821579d615fda7
24 changes: 22 additions & 2 deletions trunk/fs/locks.c
Original file line number Diff line number Diff line change
Expand Up @@ -1429,15 +1429,35 @@ static int setlease(struct file *filp, long arg, struct file_lock **flp)
* @lease: file_lock to use
*
* Call this to establish a lease on the file.
* The fl_lmops fl_break function is required by break_lease
* The (*lease)->fl_lmops->fl_break operation must be set; if not,
* break_lease will oops!
*
* This will call the filesystem's setlease file method, if
* defined. Note that there is no getlease method; instead, the
* filesystem setlease method should call back to setlease() to
* add a lease to the inode's lease list, where fcntl_getlease() can
* find it. Since fcntl_getlease() only reports whether the current
* task holds a lease, a cluster filesystem need only do this for
* leases held by processes on this node.
*
* There is also no break_lease method; filesystems that
* handle their own leases shoud break leases themselves from the
* filesystem's open, create, and (on truncate) setattr methods.
*
* Warning: the only current setlease methods exist only to disable
* leases in certain cases. More vfs changes may be required to
* allow a full filesystem lease implementation.
*/

int vfs_setlease(struct file *filp, long arg, struct file_lock **lease)
{
int error;

lock_kernel();
error = setlease(filp, arg, lease);
if (filp->f_op && filp->f_op->setlease)
error = filp->f_op->setlease(filp, arg, lease);
else
error = setlease(filp, arg, lease);
unlock_kernel();

return error;
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1122,6 +1122,7 @@ struct file_operations {
int (*flock) (struct file *, int, struct file_lock *);
ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int);
ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int);
int (*setlease)(struct file *, long, struct file_lock **);
};

struct inode_operations {
Expand Down

0 comments on commit 5dbb797

Please sign in to comment.