diff options
Diffstat (limited to 'fs/cifs/file.c')
-rw-r--r-- | fs/cifs/file.c | 75 |
1 files changed, 35 insertions, 40 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index de8abb6f7b56..513adbc211d7 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -1266,46 +1266,7 @@ cifs_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock, int xid) | |||
1266 | continue; | 1266 | continue; |
1267 | if (types[i] != li->type) | 1267 | if (types[i] != li->type) |
1268 | continue; | 1268 | continue; |
1269 | if (!cinode->can_cache_brlcks) { | 1269 | if (cinode->can_cache_brlcks) { |
1270 | cur->Pid = cpu_to_le16(li->pid); | ||
1271 | cur->LengthLow = cpu_to_le32((u32)li->length); | ||
1272 | cur->LengthHigh = | ||
1273 | cpu_to_le32((u32)(li->length>>32)); | ||
1274 | cur->OffsetLow = cpu_to_le32((u32)li->offset); | ||
1275 | cur->OffsetHigh = | ||
1276 | cpu_to_le32((u32)(li->offset>>32)); | ||
1277 | /* | ||
1278 | * We need to save a lock here to let us add | ||
1279 | * it again to the file's list if the unlock | ||
1280 | * range request fails on the server. | ||
1281 | */ | ||
1282 | list_move(&li->llist, &tmp_llist); | ||
1283 | if (++num == max_num) { | ||
1284 | stored_rc = cifs_lockv(xid, tcon, | ||
1285 | cfile->netfid, | ||
1286 | li->type, num, | ||
1287 | 0, buf); | ||
1288 | if (stored_rc) { | ||
1289 | /* | ||
1290 | * We failed on the unlock range | ||
1291 | * request - add all locks from | ||
1292 | * the tmp list to the head of | ||
1293 | * the file's list. | ||
1294 | */ | ||
1295 | cifs_move_llist(&tmp_llist, | ||
1296 | &cfile->llist); | ||
1297 | rc = stored_rc; | ||
1298 | } else | ||
1299 | /* | ||
1300 | * The unlock range request | ||
1301 | * succeed - free the tmp list. | ||
1302 | */ | ||
1303 | cifs_free_llist(&tmp_llist); | ||
1304 | cur = buf; | ||
1305 | num = 0; | ||
1306 | } else | ||
1307 | cur++; | ||
1308 | } else { | ||
1309 | /* | 1270 | /* |
1310 | * We can cache brlock requests - simply remove | 1271 | * We can cache brlock requests - simply remove |
1311 | * a lock from the file's list. | 1272 | * a lock from the file's list. |
@@ -1313,7 +1274,41 @@ cifs_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock, int xid) | |||
1313 | list_del(&li->llist); | 1274 | list_del(&li->llist); |
1314 | cifs_del_lock_waiters(li); | 1275 | cifs_del_lock_waiters(li); |
1315 | kfree(li); | 1276 | kfree(li); |
1277 | continue; | ||
1316 | } | 1278 | } |
1279 | cur->Pid = cpu_to_le16(li->pid); | ||
1280 | cur->LengthLow = cpu_to_le32((u32)li->length); | ||
1281 | cur->LengthHigh = cpu_to_le32((u32)(li->length>>32)); | ||
1282 | cur->OffsetLow = cpu_to_le32((u32)li->offset); | ||
1283 | cur->OffsetHigh = cpu_to_le32((u32)(li->offset>>32)); | ||
1284 | /* | ||
1285 | * We need to save a lock here to let us add it again to | ||
1286 | * the file's list if the unlock range request fails on | ||
1287 | * the server. | ||
1288 | */ | ||
1289 | list_move(&li->llist, &tmp_llist); | ||
1290 | if (++num == max_num) { | ||
1291 | stored_rc = cifs_lockv(xid, tcon, cfile->netfid, | ||
1292 | li->type, num, 0, buf); | ||
1293 | if (stored_rc) { | ||
1294 | /* | ||
1295 | * We failed on the unlock range | ||
1296 | * request - add all locks from the tmp | ||
1297 | * list to the head of the file's list. | ||
1298 | */ | ||
1299 | cifs_move_llist(&tmp_llist, | ||
1300 | &cfile->llist); | ||
1301 | rc = stored_rc; | ||
1302 | } else | ||
1303 | /* | ||
1304 | * The unlock range request succeed - | ||
1305 | * free the tmp list. | ||
1306 | */ | ||
1307 | cifs_free_llist(&tmp_llist); | ||
1308 | cur = buf; | ||
1309 | num = 0; | ||
1310 | } else | ||
1311 | cur++; | ||
1317 | } | 1312 | } |
1318 | if (num) { | 1313 | if (num) { |
1319 | stored_rc = cifs_lockv(xid, tcon, cfile->netfid, | 1314 | stored_rc = cifs_lockv(xid, tcon, cfile->netfid, |