diff options
author | Jeff Layton <jlayton@redhat.com> | 2013-06-21 08:58:12 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-06-29 04:57:39 -0400 |
commit | 1cb360125966cb6cb594e414ea80a0154617b846 (patch) | |
tree | a11881df79dfb2b4ba707756e8e91f928b744f9f /fs/locks.c | |
parent | d4f22d19dffed6d9b50de4123f66b91875464435 (diff) |
locks: comment cleanups and clarifications
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/locks.c')
-rw-r--r-- | fs/locks.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/fs/locks.c b/fs/locks.c index 804bb9e01a65..ddeab49fe2be 100644 --- a/fs/locks.c +++ b/fs/locks.c | |||
@@ -518,9 +518,10 @@ static void locks_insert_block(struct file_lock *blocker, | |||
518 | list_add(&waiter->fl_link, &blocked_list); | 518 | list_add(&waiter->fl_link, &blocked_list); |
519 | } | 519 | } |
520 | 520 | ||
521 | /* Wake up processes blocked waiting for blocker. | 521 | /* |
522 | * If told to wait then schedule the processes until the block list | 522 | * Wake up processes blocked waiting for blocker. |
523 | * is empty, otherwise empty the block list ourselves. | 523 | * |
524 | * Must be called with the file_lock_lock held! | ||
524 | */ | 525 | */ |
525 | static void locks_wake_up_blocks(struct file_lock *blocker) | 526 | static void locks_wake_up_blocks(struct file_lock *blocker) |
526 | { | 527 | { |
@@ -806,6 +807,11 @@ static int __posix_lock_file(struct inode *inode, struct file_lock *request, str | |||
806 | } | 807 | } |
807 | 808 | ||
808 | lock_flocks(); | 809 | lock_flocks(); |
810 | /* | ||
811 | * New lock request. Walk all POSIX locks and look for conflicts. If | ||
812 | * there are any, either return error or put the request on the | ||
813 | * blocker's list of waiters and the global blocked_list. | ||
814 | */ | ||
809 | if (request->fl_type != F_UNLCK) { | 815 | if (request->fl_type != F_UNLCK) { |
810 | for_each_lock(inode, before) { | 816 | for_each_lock(inode, before) { |
811 | fl = *before; | 817 | fl = *before; |
@@ -844,7 +850,7 @@ static int __posix_lock_file(struct inode *inode, struct file_lock *request, str | |||
844 | before = &fl->fl_next; | 850 | before = &fl->fl_next; |
845 | } | 851 | } |
846 | 852 | ||
847 | /* Process locks with this owner. */ | 853 | /* Process locks with this owner. */ |
848 | while ((fl = *before) && posix_same_owner(request, fl)) { | 854 | while ((fl = *before) && posix_same_owner(request, fl)) { |
849 | /* Detect adjacent or overlapping regions (if same lock type) | 855 | /* Detect adjacent or overlapping regions (if same lock type) |
850 | */ | 856 | */ |
@@ -930,10 +936,9 @@ static int __posix_lock_file(struct inode *inode, struct file_lock *request, str | |||
930 | } | 936 | } |
931 | 937 | ||
932 | /* | 938 | /* |
933 | * The above code only modifies existing locks in case of | 939 | * The above code only modifies existing locks in case of merging or |
934 | * merging or replacing. If new lock(s) need to be inserted | 940 | * replacing. If new lock(s) need to be inserted all modifications are |
935 | * all modifications are done bellow this, so it's safe yet to | 941 | * done below this, so it's safe yet to bail out. |
936 | * bail out. | ||
937 | */ | 942 | */ |
938 | error = -ENOLCK; /* "no luck" */ | 943 | error = -ENOLCK; /* "no luck" */ |
939 | if (right && left == right && !new_fl2) | 944 | if (right && left == right && !new_fl2) |