aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/locks.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/locks.c b/fs/locks.c
index 50cb0a2b74d9..b0b41a64e10b 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -739,6 +739,8 @@ static int flock_lock_file(struct file *filp, struct file_lock *request)
739 int found = 0; 739 int found = 0;
740 740
741 lock_kernel(); 741 lock_kernel();
742 if (request->fl_flags & FL_ACCESS)
743 goto find_conflict;
742 for_each_lock(inode, before) { 744 for_each_lock(inode, before) {
743 struct file_lock *fl = *before; 745 struct file_lock *fl = *before;
744 if (IS_POSIX(fl)) 746 if (IS_POSIX(fl))
@@ -771,6 +773,7 @@ static int flock_lock_file(struct file *filp, struct file_lock *request)
771 if (found) 773 if (found)
772 cond_resched(); 774 cond_resched();
773 775
776find_conflict:
774 for_each_lock(inode, before) { 777 for_each_lock(inode, before) {
775 struct file_lock *fl = *before; 778 struct file_lock *fl = *before;
776 if (IS_POSIX(fl)) 779 if (IS_POSIX(fl))
@@ -784,6 +787,8 @@ static int flock_lock_file(struct file *filp, struct file_lock *request)
784 locks_insert_block(fl, request); 787 locks_insert_block(fl, request);
785 goto out; 788 goto out;
786 } 789 }
790 if (request->fl_flags & FL_ACCESS)
791 goto out;
787 locks_copy_lock(new_fl, request); 792 locks_copy_lock(new_fl, request);
788 locks_insert_lock(&inode->i_flock, new_fl); 793 locks_insert_lock(&inode->i_flock, new_fl);
789 new_fl = NULL; 794 new_fl = NULL;