diff options
| -rw-r--r-- | fs/cifs/cifsfs.c | 5 | ||||
| -rw-r--r-- | fs/gfs2/file.c | 2 | ||||
| -rw-r--r-- | fs/locks.c | 3 | ||||
| -rw-r--r-- | fs/nfs/file.c | 3 | ||||
| -rw-r--r-- | include/linux/fs.h | 1 |
5 files changed, 11 insertions, 3 deletions
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 75c4eaa79588..54745b6c3db9 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
| @@ -625,8 +625,11 @@ static int cifs_setlease(struct file *file, long arg, struct file_lock **lease) | |||
| 625 | knows that the file won't be changed on the server | 625 | knows that the file won't be changed on the server |
| 626 | by anyone else */ | 626 | by anyone else */ |
| 627 | return generic_setlease(file, arg, lease); | 627 | return generic_setlease(file, arg, lease); |
| 628 | else | 628 | else { |
| 629 | if (arg != F_UNLCK) | ||
| 630 | locks_free_lock(*lease); | ||
| 629 | return -EAGAIN; | 631 | return -EAGAIN; |
| 632 | } | ||
| 630 | } | 633 | } |
| 631 | 634 | ||
| 632 | struct file_system_type cifs_fs_type = { | 635 | struct file_system_type cifs_fs_type = { |
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index aa996471ec5c..ac943c1307b5 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c | |||
| @@ -629,6 +629,8 @@ static ssize_t gfs2_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
| 629 | 629 | ||
| 630 | static int gfs2_setlease(struct file *file, long arg, struct file_lock **fl) | 630 | static int gfs2_setlease(struct file *file, long arg, struct file_lock **fl) |
| 631 | { | 631 | { |
| 632 | if (arg != F_UNLCK) | ||
| 633 | locks_free_lock(*fl); | ||
| 632 | return -EINVAL; | 634 | return -EINVAL; |
| 633 | } | 635 | } |
| 634 | 636 | ||
diff --git a/fs/locks.c b/fs/locks.c index 63fbc41cc573..5b526a977882 100644 --- a/fs/locks.c +++ b/fs/locks.c | |||
| @@ -186,7 +186,7 @@ void locks_release_private(struct file_lock *fl) | |||
| 186 | EXPORT_SYMBOL_GPL(locks_release_private); | 186 | EXPORT_SYMBOL_GPL(locks_release_private); |
| 187 | 187 | ||
| 188 | /* Free a lock which is not in use. */ | 188 | /* Free a lock which is not in use. */ |
| 189 | static void locks_free_lock(struct file_lock *fl) | 189 | void locks_free_lock(struct file_lock *fl) |
| 190 | { | 190 | { |
| 191 | BUG_ON(waitqueue_active(&fl->fl_wait)); | 191 | BUG_ON(waitqueue_active(&fl->fl_wait)); |
| 192 | BUG_ON(!list_empty(&fl->fl_block)); | 192 | BUG_ON(!list_empty(&fl->fl_block)); |
| @@ -195,6 +195,7 @@ static void locks_free_lock(struct file_lock *fl) | |||
| 195 | locks_release_private(fl); | 195 | locks_release_private(fl); |
| 196 | kmem_cache_free(filelock_cache, fl); | 196 | kmem_cache_free(filelock_cache, fl); |
| 197 | } | 197 | } |
| 198 | EXPORT_SYMBOL(locks_free_lock); | ||
| 198 | 199 | ||
| 199 | void locks_init_lock(struct file_lock *fl) | 200 | void locks_init_lock(struct file_lock *fl) |
| 200 | { | 201 | { |
diff --git a/fs/nfs/file.c b/fs/nfs/file.c index e756075637b0..1e524fb73ba5 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c | |||
| @@ -884,6 +884,7 @@ static int nfs_setlease(struct file *file, long arg, struct file_lock **fl) | |||
| 884 | dprintk("NFS: setlease(%s/%s, arg=%ld)\n", | 884 | dprintk("NFS: setlease(%s/%s, arg=%ld)\n", |
| 885 | file->f_path.dentry->d_parent->d_name.name, | 885 | file->f_path.dentry->d_parent->d_name.name, |
| 886 | file->f_path.dentry->d_name.name, arg); | 886 | file->f_path.dentry->d_name.name, arg); |
| 887 | 887 | if (arg != F_UNLCK) | |
| 888 | locks_free_lock(*fl); | ||
| 888 | return -EINVAL; | 889 | return -EINVAL; |
| 889 | } | 890 | } |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 7b7b507ffa1c..1eb29399a4ff 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -1129,6 +1129,7 @@ extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg); | |||
| 1129 | extern int fcntl_getlease(struct file *filp); | 1129 | extern int fcntl_getlease(struct file *filp); |
| 1130 | 1130 | ||
| 1131 | /* fs/locks.c */ | 1131 | /* fs/locks.c */ |
| 1132 | void locks_free_lock(struct file_lock *fl); | ||
| 1132 | extern void locks_init_lock(struct file_lock *); | 1133 | extern void locks_init_lock(struct file_lock *); |
| 1133 | extern struct file_lock * locks_alloc_lock(void); | 1134 | extern struct file_lock * locks_alloc_lock(void); |
| 1134 | extern void locks_copy_lock(struct file_lock *, struct file_lock *); | 1135 | extern void locks_copy_lock(struct file_lock *, struct file_lock *); |
