summaryrefslogtreecommitdiffstats
path: root/fs/cifs/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/file.c')
-rw-r--r--fs/cifs/file.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index b65166eb111e..8c2ca6f62bad 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -1125,7 +1125,7 @@ cifs_push_posix_locks(struct cifsFileInfo *cfile)
1125 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); 1125 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
1126 struct file_lock *flock; 1126 struct file_lock *flock;
1127 struct file_lock_context *flctx = inode->i_flctx; 1127 struct file_lock_context *flctx = inode->i_flctx;
1128 unsigned int count = 0, i; 1128 unsigned int i;
1129 int rc = 0, xid, type; 1129 int rc = 0, xid, type;
1130 struct list_head locks_to_send, *el; 1130 struct list_head locks_to_send, *el;
1131 struct lock_to_push *lck, *tmp; 1131 struct lock_to_push *lck, *tmp;
@@ -1136,20 +1136,14 @@ cifs_push_posix_locks(struct cifsFileInfo *cfile)
1136 if (!flctx) 1136 if (!flctx)
1137 goto out; 1137 goto out;
1138 1138
1139 spin_lock(&flctx->flc_lock);
1140 list_for_each(el, &flctx->flc_posix) {
1141 count++;
1142 }
1143 spin_unlock(&flctx->flc_lock);
1144
1145 INIT_LIST_HEAD(&locks_to_send); 1139 INIT_LIST_HEAD(&locks_to_send);
1146 1140
1147 /* 1141 /*
1148 * Allocating count locks is enough because no FL_POSIX locks can be 1142 * Allocating flc_posix_cnt locks is enough because no FL_POSIX locks
1149 * added to the list while we are holding cinode->lock_sem that 1143 * can be added to the list while we are holding cinode->lock_sem that
1150 * protects locking operations of this inode. 1144 * protects locking operations of this inode.
1151 */ 1145 */
1152 for (i = 0; i < count; i++) { 1146 for (i = 0; i < flctx->flc_posix_cnt; i++) {
1153 lck = kmalloc(sizeof(struct lock_to_push), GFP_KERNEL); 1147 lck = kmalloc(sizeof(struct lock_to_push), GFP_KERNEL);
1154 if (!lck) { 1148 if (!lck) {
1155 rc = -ENOMEM; 1149 rc = -ENOMEM;