diff options
| -rw-r--r-- | fs/locks.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/fs/locks.c b/fs/locks.c index f2fa1465046b..c5f35910c57a 100644 --- a/fs/locks.c +++ b/fs/locks.c | |||
| @@ -816,47 +816,50 @@ locks_delete_lock_ctx(struct file_lock *fl, struct list_head *dispose) | |||
| 816 | /* Determine if lock sys_fl blocks lock caller_fl. Common functionality | 816 | /* Determine if lock sys_fl blocks lock caller_fl. Common functionality |
| 817 | * checks for shared/exclusive status of overlapping locks. | 817 | * checks for shared/exclusive status of overlapping locks. |
| 818 | */ | 818 | */ |
| 819 | static int locks_conflict(struct file_lock *caller_fl, struct file_lock *sys_fl) | 819 | static bool locks_conflict(struct file_lock *caller_fl, |
| 820 | struct file_lock *sys_fl) | ||
| 820 | { | 821 | { |
| 821 | if (sys_fl->fl_type == F_WRLCK) | 822 | if (sys_fl->fl_type == F_WRLCK) |
| 822 | return 1; | 823 | return true; |
| 823 | if (caller_fl->fl_type == F_WRLCK) | 824 | if (caller_fl->fl_type == F_WRLCK) |
| 824 | return 1; | 825 | return true; |
| 825 | return 0; | 826 | return false; |
| 826 | } | 827 | } |
| 827 | 828 | ||
| 828 | /* Determine if lock sys_fl blocks lock caller_fl. POSIX specific | 829 | /* Determine if lock sys_fl blocks lock caller_fl. POSIX specific |
| 829 | * checking before calling the locks_conflict(). | 830 | * checking before calling the locks_conflict(). |
| 830 | */ | 831 | */ |
| 831 | static int posix_locks_conflict(struct file_lock *caller_fl, struct file_lock *sys_fl) | 832 | static bool posix_locks_conflict(struct file_lock *caller_fl, |
| 833 | struct file_lock *sys_fl) | ||
| 832 | { | 834 | { |
| 833 | /* POSIX locks owned by the same process do not conflict with | 835 | /* POSIX locks owned by the same process do not conflict with |
| 834 | * each other. | 836 | * each other. |
| 835 | */ | 837 | */ |
| 836 | if (posix_same_owner(caller_fl, sys_fl)) | 838 | if (posix_same_owner(caller_fl, sys_fl)) |
| 837 | return (0); | 839 | return false; |
| 838 | 840 | ||
| 839 | /* Check whether they overlap */ | 841 | /* Check whether they overlap */ |
| 840 | if (!locks_overlap(caller_fl, sys_fl)) | 842 | if (!locks_overlap(caller_fl, sys_fl)) |
| 841 | return 0; | 843 | return false; |
| 842 | 844 | ||
| 843 | return (locks_conflict(caller_fl, sys_fl)); | 845 | return locks_conflict(caller_fl, sys_fl); |
| 844 | } | 846 | } |
| 845 | 847 | ||
| 846 | /* Determine if lock sys_fl blocks lock caller_fl. FLOCK specific | 848 | /* Determine if lock sys_fl blocks lock caller_fl. FLOCK specific |
| 847 | * checking before calling the locks_conflict(). | 849 | * checking before calling the locks_conflict(). |
| 848 | */ | 850 | */ |
| 849 | static int flock_locks_conflict(struct file_lock *caller_fl, struct file_lock *sys_fl) | 851 | static bool flock_locks_conflict(struct file_lock *caller_fl, |
| 852 | struct file_lock *sys_fl) | ||
| 850 | { | 853 | { |
| 851 | /* FLOCK locks referring to the same filp do not conflict with | 854 | /* FLOCK locks referring to the same filp do not conflict with |
| 852 | * each other. | 855 | * each other. |
| 853 | */ | 856 | */ |
| 854 | if (caller_fl->fl_file == sys_fl->fl_file) | 857 | if (caller_fl->fl_file == sys_fl->fl_file) |
| 855 | return (0); | 858 | return false; |
| 856 | if ((caller_fl->fl_type & LOCK_MAND) || (sys_fl->fl_type & LOCK_MAND)) | 859 | if ((caller_fl->fl_type & LOCK_MAND) || (sys_fl->fl_type & LOCK_MAND)) |
| 857 | return 0; | 860 | return false; |
| 858 | 861 | ||
| 859 | return (locks_conflict(caller_fl, sys_fl)); | 862 | return locks_conflict(caller_fl, sys_fl); |
| 860 | } | 863 | } |
| 861 | 864 | ||
| 862 | void | 865 | void |
