diff options
-rw-r--r-- | fs/locks.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/fs/locks.c b/fs/locks.c index 2c2d4f5022a7..7dd4defb4d8d 100644 --- a/fs/locks.c +++ b/fs/locks.c | |||
@@ -1022,18 +1022,21 @@ static int __posix_lock_file(struct inode *inode, struct file_lock *request, str | |||
1022 | locks_delete_lock(before); | 1022 | locks_delete_lock(before); |
1023 | continue; | 1023 | continue; |
1024 | } | 1024 | } |
1025 | /* Replace the old lock with the new one. | 1025 | /* |
1026 | * Wake up anybody waiting for the old one, | 1026 | * Replace the old lock with new_fl, and |
1027 | * as the change in lock type might satisfy | 1027 | * remove the old one. It's safe to do the |
1028 | * their needs. | 1028 | * insert here since we know that we won't be |
1029 | * using new_fl later, and that the lock is | ||
1030 | * just replacing an existing lock. | ||
1029 | */ | 1031 | */ |
1030 | locks_wake_up_blocks(fl); | 1032 | error = -ENOLCK; |
1031 | fl->fl_start = request->fl_start; | 1033 | if (!new_fl) |
1032 | fl->fl_end = request->fl_end; | 1034 | goto out; |
1033 | fl->fl_type = request->fl_type; | 1035 | locks_copy_lock(new_fl, request); |
1034 | locks_release_private(fl); | 1036 | request = new_fl; |
1035 | locks_copy_private(fl, request); | 1037 | new_fl = NULL; |
1036 | request = fl; | 1038 | locks_delete_lock(before); |
1039 | locks_insert_lock(before, request); | ||
1037 | added = true; | 1040 | added = true; |
1038 | } | 1041 | } |
1039 | } | 1042 | } |