diff options
Diffstat (limited to 'fs/cifs/smb2file.c')
-rw-r--r-- | fs/cifs/smb2file.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/fs/cifs/smb2file.c b/fs/cifs/smb2file.c index 181e13d9f9db..0ddd617ffa1a 100644 --- a/fs/cifs/smb2file.c +++ b/fs/cifs/smb2file.c | |||
@@ -135,7 +135,7 @@ smb2_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock, | |||
135 | 135 | ||
136 | cur = buf; | 136 | cur = buf; |
137 | 137 | ||
138 | mutex_lock(&cinode->lock_mutex); | 138 | down_write(&cinode->lock_sem); |
139 | list_for_each_entry_safe(li, tmp, &cfile->llist->locks, llist) { | 139 | list_for_each_entry_safe(li, tmp, &cfile->llist->locks, llist) { |
140 | if (flock->fl_start > li->offset || | 140 | if (flock->fl_start > li->offset || |
141 | (flock->fl_start + length) < | 141 | (flock->fl_start + length) < |
@@ -196,7 +196,7 @@ smb2_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock, | |||
196 | } else | 196 | } else |
197 | cifs_free_llist(&tmp_llist); | 197 | cifs_free_llist(&tmp_llist); |
198 | } | 198 | } |
199 | mutex_unlock(&cinode->lock_mutex); | 199 | up_write(&cinode->lock_sem); |
200 | 200 | ||
201 | kfree(buf); | 201 | kfree(buf); |
202 | return rc; | 202 | return rc; |
@@ -253,9 +253,10 @@ smb2_push_mandatory_locks(struct cifsFileInfo *cfile) | |||
253 | struct cifs_fid_locks *fdlocks; | 253 | struct cifs_fid_locks *fdlocks; |
254 | 254 | ||
255 | xid = get_xid(); | 255 | xid = get_xid(); |
256 | mutex_lock(&cinode->lock_mutex); | 256 | /* we are going to update can_cache_brlcks here - need a write access */ |
257 | down_write(&cinode->lock_sem); | ||
257 | if (!cinode->can_cache_brlcks) { | 258 | if (!cinode->can_cache_brlcks) { |
258 | mutex_unlock(&cinode->lock_mutex); | 259 | up_write(&cinode->lock_sem); |
259 | free_xid(xid); | 260 | free_xid(xid); |
260 | return rc; | 261 | return rc; |
261 | } | 262 | } |
@@ -266,7 +267,7 @@ smb2_push_mandatory_locks(struct cifsFileInfo *cfile) | |||
266 | */ | 267 | */ |
267 | max_buf = tlink_tcon(cfile->tlink)->ses->server->maxBuf; | 268 | max_buf = tlink_tcon(cfile->tlink)->ses->server->maxBuf; |
268 | if (!max_buf) { | 269 | if (!max_buf) { |
269 | mutex_unlock(&cinode->lock_mutex); | 270 | up_write(&cinode->lock_sem); |
270 | free_xid(xid); | 271 | free_xid(xid); |
271 | return -EINVAL; | 272 | return -EINVAL; |
272 | } | 273 | } |
@@ -274,7 +275,7 @@ smb2_push_mandatory_locks(struct cifsFileInfo *cfile) | |||
274 | max_num = max_buf / sizeof(struct smb2_lock_element); | 275 | max_num = max_buf / sizeof(struct smb2_lock_element); |
275 | buf = kzalloc(max_num * sizeof(struct smb2_lock_element), GFP_KERNEL); | 276 | buf = kzalloc(max_num * sizeof(struct smb2_lock_element), GFP_KERNEL); |
276 | if (!buf) { | 277 | if (!buf) { |
277 | mutex_unlock(&cinode->lock_mutex); | 278 | up_write(&cinode->lock_sem); |
278 | free_xid(xid); | 279 | free_xid(xid); |
279 | return -ENOMEM; | 280 | return -ENOMEM; |
280 | } | 281 | } |
@@ -288,7 +289,7 @@ smb2_push_mandatory_locks(struct cifsFileInfo *cfile) | |||
288 | cinode->can_cache_brlcks = false; | 289 | cinode->can_cache_brlcks = false; |
289 | kfree(buf); | 290 | kfree(buf); |
290 | 291 | ||
291 | mutex_unlock(&cinode->lock_mutex); | 292 | up_write(&cinode->lock_sem); |
292 | free_xid(xid); | 293 | free_xid(xid); |
293 | return rc; | 294 | return rc; |
294 | } | 295 | } |