diff options
Diffstat (limited to 'fs/locks.c')
| -rw-r--r-- | fs/locks.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/fs/locks.c b/fs/locks.c index 242328e17f32..53b0cd153202 100644 --- a/fs/locks.c +++ b/fs/locks.c | |||
| @@ -1698,6 +1698,25 @@ out: | |||
| 1698 | * If the filesystem defines a private ->lock() method, then @conf will | 1698 | * If the filesystem defines a private ->lock() method, then @conf will |
| 1699 | * be left unchanged; so a caller that cares should initialize it to | 1699 | * be left unchanged; so a caller that cares should initialize it to |
| 1700 | * some acceptable default. | 1700 | * some acceptable default. |
| 1701 | * | ||
| 1702 | * To avoid blocking kernel daemons, such as lockd, that need to acquire POSIX | ||
| 1703 | * locks, the ->lock() interface may return asynchronously, before the lock has | ||
| 1704 | * been granted or denied by the underlying filesystem, if (and only if) | ||
| 1705 | * fl_grant is set. Callers expecting ->lock() to return asynchronously | ||
| 1706 | * will only use F_SETLK, not F_SETLKW; they will set FL_SLEEP if (and only if) | ||
| 1707 | * the request is for a blocking lock. When ->lock() does return asynchronously, | ||
| 1708 | * it must return -EINPROGRESS, and call ->fl_grant() when the lock | ||
| 1709 | * request completes. | ||
| 1710 | * If the request is for non-blocking lock the file system should return | ||
| 1711 | * -EINPROGRESS then try to get the lock and call the callback routine with | ||
| 1712 | * the result. If the request timed out the callback routine will return a | ||
| 1713 | * nonzero return code and the file system should release the lock. The file | ||
| 1714 | * system is also responsible to keep a corresponding posix lock when it | ||
| 1715 | * grants a lock so the VFS can find out which locks are locally held and do | ||
| 1716 | * the correct lock cleanup when required. | ||
| 1717 | * The underlying filesystem must not drop the kernel lock or call | ||
| 1718 | * ->fl_grant() before returning to the caller with a -EINPROGRESS | ||
| 1719 | * return code. | ||
| 1701 | */ | 1720 | */ |
| 1702 | int vfs_lock_file(struct file *filp, unsigned int cmd, struct file_lock *fl, struct file_lock *conf) | 1721 | int vfs_lock_file(struct file *filp, unsigned int cmd, struct file_lock *fl, struct file_lock *conf) |
| 1703 | { | 1722 | { |
