diff options
Diffstat (limited to 'fs/cifs/cifssmb.c')
-rw-r--r-- | fs/cifs/cifssmb.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 90b4f9f7de66..76fcb50295a3 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -1396,11 +1396,10 @@ openRetry: | |||
1396 | * current bigbuf. | 1396 | * current bigbuf. |
1397 | */ | 1397 | */ |
1398 | static int | 1398 | static int |
1399 | cifs_readv_discard(struct TCP_Server_Info *server, struct mid_q_entry *mid) | 1399 | discard_remaining_data(struct TCP_Server_Info *server) |
1400 | { | 1400 | { |
1401 | unsigned int rfclen = get_rfc1002_length(server->smallbuf); | 1401 | unsigned int rfclen = get_rfc1002_length(server->smallbuf); |
1402 | int remaining = rfclen + 4 - server->total_read; | 1402 | int remaining = rfclen + 4 - server->total_read; |
1403 | struct cifs_readdata *rdata = mid->callback_data; | ||
1404 | 1403 | ||
1405 | while (remaining > 0) { | 1404 | while (remaining > 0) { |
1406 | int length; | 1405 | int length; |
@@ -1414,10 +1413,20 @@ cifs_readv_discard(struct TCP_Server_Info *server, struct mid_q_entry *mid) | |||
1414 | remaining -= length; | 1413 | remaining -= length; |
1415 | } | 1414 | } |
1416 | 1415 | ||
1417 | dequeue_mid(mid, rdata->result); | ||
1418 | return 0; | 1416 | return 0; |
1419 | } | 1417 | } |
1420 | 1418 | ||
1419 | static int | ||
1420 | cifs_readv_discard(struct TCP_Server_Info *server, struct mid_q_entry *mid) | ||
1421 | { | ||
1422 | int length; | ||
1423 | struct cifs_readdata *rdata = mid->callback_data; | ||
1424 | |||
1425 | length = discard_remaining_data(server); | ||
1426 | dequeue_mid(mid, rdata->result); | ||
1427 | return length; | ||
1428 | } | ||
1429 | |||
1421 | int | 1430 | int |
1422 | cifs_readv_receive(struct TCP_Server_Info *server, struct mid_q_entry *mid) | 1431 | cifs_readv_receive(struct TCP_Server_Info *server, struct mid_q_entry *mid) |
1423 | { | 1432 | { |
@@ -1446,6 +1455,12 @@ cifs_readv_receive(struct TCP_Server_Info *server, struct mid_q_entry *mid) | |||
1446 | return length; | 1455 | return length; |
1447 | server->total_read += length; | 1456 | server->total_read += length; |
1448 | 1457 | ||
1458 | if (server->ops->is_status_pending && | ||
1459 | server->ops->is_status_pending(buf, server, 0)) { | ||
1460 | discard_remaining_data(server); | ||
1461 | return -1; | ||
1462 | } | ||
1463 | |||
1449 | /* Was the SMB read successful? */ | 1464 | /* Was the SMB read successful? */ |
1450 | rdata->result = server->ops->map_error(buf, false); | 1465 | rdata->result = server->ops->map_error(buf, false); |
1451 | if (rdata->result != 0) { | 1466 | if (rdata->result != 0) { |