aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/locks.c10
-rw-r--r--fs/nfs/file.c4
-rw-r--r--include/linux/fs.h2
3 files changed, 8 insertions, 8 deletions
diff --git a/fs/locks.c b/fs/locks.c
index 4c73b857dded..4a8072736efa 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -659,7 +659,7 @@ static int locks_block_on_timeout(struct file_lock *blocker, struct file_lock *w
659 return result; 659 return result;
660} 660}
661 661
662int 662void
663posix_test_lock(struct file *filp, struct file_lock *fl) 663posix_test_lock(struct file *filp, struct file_lock *fl)
664{ 664{
665 struct file_lock *cfl; 665 struct file_lock *cfl;
@@ -671,14 +671,12 @@ posix_test_lock(struct file *filp, struct file_lock *fl)
671 if (posix_locks_conflict(cfl, fl)) 671 if (posix_locks_conflict(cfl, fl))
672 break; 672 break;
673 } 673 }
674 if (cfl) { 674 if (cfl)
675 __locks_copy_lock(fl, cfl); 675 __locks_copy_lock(fl, cfl);
676 unlock_kernel(); 676 else
677 return 1;
678 } else
679 fl->fl_type = F_UNLCK; 677 fl->fl_type = F_UNLCK;
680 unlock_kernel(); 678 unlock_kernel();
681 return 0; 679 return;
682} 680}
683 681
684EXPORT_SYMBOL(posix_test_lock); 682EXPORT_SYMBOL(posix_test_lock);
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 13ac6fa2b62b..c87dc713b5d7 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -402,7 +402,9 @@ static int do_getlk(struct file *filp, int cmd, struct file_lock *fl)
402 402
403 lock_kernel(); 403 lock_kernel();
404 /* Try local locking first */ 404 /* Try local locking first */
405 if (posix_test_lock(filp, fl)) { 405 posix_test_lock(filp, fl);
406 if (fl->fl_type != F_UNLCK) {
407 /* found a conflict */
406 goto out; 408 goto out;
407 } 409 }
408 410
diff --git a/include/linux/fs.h b/include/linux/fs.h
index b188c2e5338d..80deaaf1b746 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -862,7 +862,7 @@ extern void locks_init_lock(struct file_lock *);
862extern void locks_copy_lock(struct file_lock *, struct file_lock *); 862extern void locks_copy_lock(struct file_lock *, struct file_lock *);
863extern void locks_remove_posix(struct file *, fl_owner_t); 863extern void locks_remove_posix(struct file *, fl_owner_t);
864extern void locks_remove_flock(struct file *); 864extern void locks_remove_flock(struct file *);
865extern int posix_test_lock(struct file *, struct file_lock *); 865extern void posix_test_lock(struct file *, struct file_lock *);
866extern int posix_lock_file(struct file *, struct file_lock *, struct file_lock *); 866extern int posix_lock_file(struct file *, struct file_lock *, struct file_lock *);
867extern int posix_lock_file_wait(struct file *, struct file_lock *); 867extern int posix_lock_file_wait(struct file *, struct file_lock *);
868extern int posix_unblock_lock(struct file *, struct file_lock *); 868extern int posix_unblock_lock(struct file *, struct file_lock *);