diff options
-rw-r--r-- | fs/locks.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/fs/locks.c b/fs/locks.c index efe1affe6bed..6e22c8129a80 100644 --- a/fs/locks.c +++ b/fs/locks.c | |||
@@ -733,6 +733,15 @@ static int flock_lock_file(struct file *filp, struct file_lock *request) | |||
733 | lock_kernel(); | 733 | lock_kernel(); |
734 | if (request->fl_flags & FL_ACCESS) | 734 | if (request->fl_flags & FL_ACCESS) |
735 | goto find_conflict; | 735 | goto find_conflict; |
736 | |||
737 | if (request->fl_type != F_UNLCK) { | ||
738 | error = -ENOMEM; | ||
739 | new_fl = locks_alloc_lock(); | ||
740 | if (new_fl == NULL) | ||
741 | goto out; | ||
742 | error = 0; | ||
743 | } | ||
744 | |||
736 | for_each_lock(inode, before) { | 745 | for_each_lock(inode, before) { |
737 | struct file_lock *fl = *before; | 746 | struct file_lock *fl = *before; |
738 | if (IS_POSIX(fl)) | 747 | if (IS_POSIX(fl)) |
@@ -754,10 +763,6 @@ static int flock_lock_file(struct file *filp, struct file_lock *request) | |||
754 | goto out; | 763 | goto out; |
755 | } | 764 | } |
756 | 765 | ||
757 | error = -ENOMEM; | ||
758 | new_fl = locks_alloc_lock(); | ||
759 | if (new_fl == NULL) | ||
760 | goto out; | ||
761 | /* | 766 | /* |
762 | * If a higher-priority process was blocked on the old file lock, | 767 | * If a higher-priority process was blocked on the old file lock, |
763 | * give it the opportunity to lock the file. | 768 | * give it the opportunity to lock the file. |