diff options
author | Pavel Shilovsky <piastry@etersoft.ru> | 2012-03-17 02:46:55 -0400 |
---|---|---|
committer | Steve French <stevef@smf-gateway.(none)> | 2012-03-19 11:20:22 -0400 |
commit | ce85852b90a214cf577fc1b4f49d99fd7e98784a (patch) | |
tree | 4ddd1c31ba83be828df57167e25308ff6f563e31 /fs/cifs | |
parent | c16fa4f2ad19908a47c63d8fa436a1178438c7e7 (diff) |
CIFS: Fix a spurious error in cifs_push_posix_locks
Signed-off-by: Pavel Shilovsky <piastry@etersoft.ru>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Reported-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Steve French <stevef@smf-gateway.(none)>
Diffstat (limited to 'fs/cifs')
-rw-r--r-- | fs/cifs/file.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 5e64748a2917..8e02dbd88ae1 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -960,9 +960,9 @@ cifs_push_posix_locks(struct cifsFileInfo *cfile) | |||
960 | INIT_LIST_HEAD(&locks_to_send); | 960 | INIT_LIST_HEAD(&locks_to_send); |
961 | 961 | ||
962 | /* | 962 | /* |
963 | * Allocating count locks is enough because no locks can be added to | 963 | * Allocating count locks is enough because no FL_POSIX locks can be |
964 | * the list while we are holding cinode->lock_mutex that protects | 964 | * added to the list while we are holding cinode->lock_mutex that |
965 | * locking operations of this inode. | 965 | * protects locking operations of this inode. |
966 | */ | 966 | */ |
967 | for (; i < count; i++) { | 967 | for (; i < count; i++) { |
968 | lck = kmalloc(sizeof(struct lock_to_push), GFP_KERNEL); | 968 | lck = kmalloc(sizeof(struct lock_to_push), GFP_KERNEL); |
@@ -973,18 +973,20 @@ cifs_push_posix_locks(struct cifsFileInfo *cfile) | |||
973 | list_add_tail(&lck->llist, &locks_to_send); | 973 | list_add_tail(&lck->llist, &locks_to_send); |
974 | } | 974 | } |
975 | 975 | ||
976 | i = 0; | ||
977 | el = locks_to_send.next; | 976 | el = locks_to_send.next; |
978 | lock_flocks(); | 977 | lock_flocks(); |
979 | cifs_for_each_lock(cfile->dentry->d_inode, before) { | 978 | cifs_for_each_lock(cfile->dentry->d_inode, before) { |
979 | flock = *before; | ||
980 | if ((flock->fl_flags & FL_POSIX) == 0) | ||
981 | continue; | ||
980 | if (el == &locks_to_send) { | 982 | if (el == &locks_to_send) { |
981 | /* something is really wrong */ | 983 | /* |
984 | * The list ended. We don't have enough allocated | ||
985 | * structures - something is really wrong. | ||
986 | */ | ||
982 | cERROR(1, "Can't push all brlocks!"); | 987 | cERROR(1, "Can't push all brlocks!"); |
983 | break; | 988 | break; |
984 | } | 989 | } |
985 | flock = *before; | ||
986 | if ((flock->fl_flags & FL_POSIX) == 0) | ||
987 | continue; | ||
988 | length = 1 + flock->fl_end - flock->fl_start; | 990 | length = 1 + flock->fl_end - flock->fl_start; |
989 | if (flock->fl_type == F_RDLCK || flock->fl_type == F_SHLCK) | 991 | if (flock->fl_type == F_RDLCK || flock->fl_type == F_SHLCK) |
990 | type = CIFS_RDLCK; | 992 | type = CIFS_RDLCK; |
@@ -996,7 +998,6 @@ cifs_push_posix_locks(struct cifsFileInfo *cfile) | |||
996 | lck->length = length; | 998 | lck->length = length; |
997 | lck->type = type; | 999 | lck->type = type; |
998 | lck->offset = flock->fl_start; | 1000 | lck->offset = flock->fl_start; |
999 | i++; | ||
1000 | el = el->next; | 1001 | el = el->next; |
1001 | } | 1002 | } |
1002 | unlock_flocks(); | 1003 | unlock_flocks(); |