diff options
author | Jeff Layton <jeff.layton@primarydata.com> | 2015-02-16 14:32:03 -0500 |
---|---|---|
committer | Jeff Layton <jeff.layton@primarydata.com> | 2015-02-16 14:32:03 -0500 |
commit | e084c1bd40926938ff8d26af3bde34396dd4d06d (patch) | |
tree | 5d4dd8e3eaf5c46430670d4858084230128f3bbd /fs/cifs | |
parent | 1fa185ebcbcefdc5229c783450c9f0439a69f0c1 (diff) |
Revert "locks: keep a count of locks on the flctx lists"
This reverts commit 9bd0f45b7037fcfa8b575c7e27d0431d6e6dc3bb.
Linus rightly pointed out that I failed to initialize the counters
when adding them, so they don't work as expected. Just revert this
patch for now.
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jeff Layton <jeff.layton@primarydata.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r-- | fs/cifs/file.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 8fe1f7a21b3e..a94b3e673182 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -1129,7 +1129,7 @@ cifs_push_posix_locks(struct cifsFileInfo *cfile) | |||
1129 | struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); | 1129 | struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); |
1130 | struct file_lock *flock; | 1130 | struct file_lock *flock; |
1131 | struct file_lock_context *flctx = inode->i_flctx; | 1131 | struct file_lock_context *flctx = inode->i_flctx; |
1132 | unsigned int i; | 1132 | unsigned int count = 0, i; |
1133 | int rc = 0, xid, type; | 1133 | int rc = 0, xid, type; |
1134 | struct list_head locks_to_send, *el; | 1134 | struct list_head locks_to_send, *el; |
1135 | struct lock_to_push *lck, *tmp; | 1135 | struct lock_to_push *lck, *tmp; |
@@ -1140,14 +1140,20 @@ cifs_push_posix_locks(struct cifsFileInfo *cfile) | |||
1140 | if (!flctx) | 1140 | if (!flctx) |
1141 | goto out; | 1141 | goto out; |
1142 | 1142 | ||
1143 | spin_lock(&flctx->flc_lock); | ||
1144 | list_for_each(el, &flctx->flc_posix) { | ||
1145 | count++; | ||
1146 | } | ||
1147 | spin_unlock(&flctx->flc_lock); | ||
1148 | |||
1143 | INIT_LIST_HEAD(&locks_to_send); | 1149 | INIT_LIST_HEAD(&locks_to_send); |
1144 | 1150 | ||
1145 | /* | 1151 | /* |
1146 | * Allocating flc_posix_cnt locks is enough because no FL_POSIX locks | 1152 | * Allocating count locks is enough because no FL_POSIX locks can be |
1147 | * can be added to the list while we are holding cinode->lock_sem that | 1153 | * added to the list while we are holding cinode->lock_sem that |
1148 | * protects locking operations of this inode. | 1154 | * protects locking operations of this inode. |
1149 | */ | 1155 | */ |
1150 | for (i = 0; i < flctx->flc_posix_cnt; i++) { | 1156 | for (i = 0; i < count; i++) { |
1151 | lck = kmalloc(sizeof(struct lock_to_push), GFP_KERNEL); | 1157 | lck = kmalloc(sizeof(struct lock_to_push), GFP_KERNEL); |
1152 | if (!lck) { | 1158 | if (!lck) { |
1153 | rc = -ENOMEM; | 1159 | rc = -ENOMEM; |