Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 54492
b: refs/heads/master
c: 2beb661
h: refs/heads/master
v: v3
  • Loading branch information
Marc Eshel authored and J. Bruce Fields committed May 7, 2007
1 parent 94e58f4 commit 5b81a81
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fd85b8170dabbf021987875ef7f903791f4f181e
refs/heads/master: 2beb6614f5e36c6165b704c167d82ef3e4ceaa0c
19 changes: 19 additions & 0 deletions trunk/fs/locks.c
Original file line number Diff line number Diff line change
Expand Up @@ -1698,6 +1698,25 @@ int fcntl_getlk(struct file *filp, struct flock __user *l)
* If the filesystem defines a private ->lock() method, then @conf will
* be left unchanged; so a caller that cares should initialize it to
* some acceptable default.
*
* To avoid blocking kernel daemons, such as lockd, that need to acquire POSIX
* locks, the ->lock() interface may return asynchronously, before the lock has
* been granted or denied by the underlying filesystem, if (and only if)
* fl_grant is set. Callers expecting ->lock() to return asynchronously
* will only use F_SETLK, not F_SETLKW; they will set FL_SLEEP if (and only if)
* the request is for a blocking lock. When ->lock() does return asynchronously,
* it must return -EINPROGRESS, and call ->fl_grant() when the lock
* request completes.
* If the request is for non-blocking lock the file system should return
* -EINPROGRESS then try to get the lock and call the callback routine with
* the result. If the request timed out the callback routine will return a
* nonzero return code and the file system should release the lock. The file
* system is also responsible to keep a corresponding posix lock when it
* grants a lock so the VFS can find out which locks are locally held and do
* the correct lock cleanup when required.
* The underlying filesystem must not drop the kernel lock or call
* ->fl_grant() before returning to the caller with a -EINPROGRESS
* return code.
*/
int vfs_lock_file(struct file *filp, unsigned int cmd, struct file_lock *fl, struct file_lock *conf)
{
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 @@ -785,6 +785,7 @@ struct file_lock_operations {
struct lock_manager_operations {
int (*fl_compare_owner)(struct file_lock *, struct file_lock *);
void (*fl_notify)(struct file_lock *); /* unblock callback */
int (*fl_grant)(struct file_lock *, struct file_lock *, int);
void (*fl_copy_lock)(struct file_lock *, struct file_lock *);
void (*fl_release_private)(struct file_lock *);
void (*fl_break)(struct file_lock *);
Expand Down

0 comments on commit 5b81a81

Please sign in to comment.