diff options
-rw-r--r-- | fs/cifs/transport.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c index 7ce8a585abd6..ed104c0550e8 100644 --- a/fs/cifs/transport.c +++ b/fs/cifs/transport.c | |||
@@ -538,15 +538,20 @@ wait_for_free_credits(struct TCP_Server_Info *server, const int timeout, | |||
538 | } | 538 | } |
539 | 539 | ||
540 | static int | 540 | static int |
541 | wait_for_free_request(struct TCP_Server_Info *server, const int timeout, | 541 | wait_for_free_request(struct TCP_Server_Info *server, const int flags, |
542 | const int optype, unsigned int *instance) | 542 | unsigned int *instance) |
543 | { | 543 | { |
544 | int *val; | 544 | int *val; |
545 | int timeout, optype; | ||
546 | |||
547 | timeout = flags & CIFS_TIMEOUT_MASK; | ||
548 | optype = flags & CIFS_OP_MASK; | ||
545 | 549 | ||
546 | val = server->ops->get_credits_field(server, optype); | 550 | val = server->ops->get_credits_field(server, optype); |
547 | /* Since an echo is already inflight, no need to wait to send another */ | 551 | /* Since an echo is already inflight, no need to wait to send another */ |
548 | if (*val <= 0 && optype == CIFS_ECHO_OP) | 552 | if (*val <= 0 && optype == CIFS_ECHO_OP) |
549 | return -EAGAIN; | 553 | return -EAGAIN; |
554 | |||
550 | return wait_for_free_credits(server, timeout, val, instance); | 555 | return wait_for_free_credits(server, timeout, val, instance); |
551 | } | 556 | } |
552 | 557 | ||
@@ -646,16 +651,16 @@ cifs_call_async(struct TCP_Server_Info *server, struct smb_rqst *rqst, | |||
646 | mid_handle_t *handle, void *cbdata, const int flags, | 651 | mid_handle_t *handle, void *cbdata, const int flags, |
647 | const struct cifs_credits *exist_credits) | 652 | const struct cifs_credits *exist_credits) |
648 | { | 653 | { |
649 | int rc, timeout, optype; | 654 | int rc; |
650 | struct mid_q_entry *mid; | 655 | struct mid_q_entry *mid; |
651 | struct cifs_credits credits = { .value = 0, .instance = 0 }; | 656 | struct cifs_credits credits = { .value = 0, .instance = 0 }; |
652 | unsigned int instance; | 657 | unsigned int instance; |
658 | int optype; | ||
653 | 659 | ||
654 | timeout = flags & CIFS_TIMEOUT_MASK; | ||
655 | optype = flags & CIFS_OP_MASK; | 660 | optype = flags & CIFS_OP_MASK; |
656 | 661 | ||
657 | if ((flags & CIFS_HAS_CREDITS) == 0) { | 662 | if ((flags & CIFS_HAS_CREDITS) == 0) { |
658 | rc = wait_for_free_request(server, timeout, optype, &instance); | 663 | rc = wait_for_free_request(server, flags, &instance); |
659 | if (rc) | 664 | if (rc) |
660 | return rc; | 665 | return rc; |
661 | credits.value = 1; | 666 | credits.value = 1; |
@@ -871,8 +876,7 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses, | |||
871 | const int flags, const int num_rqst, struct smb_rqst *rqst, | 876 | const int flags, const int num_rqst, struct smb_rqst *rqst, |
872 | int *resp_buf_type, struct kvec *resp_iov) | 877 | int *resp_buf_type, struct kvec *resp_iov) |
873 | { | 878 | { |
874 | int i, j, rc = 0; | 879 | int i, j, optype, rc = 0; |
875 | int timeout, optype; | ||
876 | struct mid_q_entry *midQ[MAX_COMPOUND]; | 880 | struct mid_q_entry *midQ[MAX_COMPOUND]; |
877 | bool cancelled_mid[MAX_COMPOUND] = {false}; | 881 | bool cancelled_mid[MAX_COMPOUND] = {false}; |
878 | struct cifs_credits credits[MAX_COMPOUND] = { | 882 | struct cifs_credits credits[MAX_COMPOUND] = { |
@@ -882,7 +886,6 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses, | |||
882 | unsigned int first_instance = 0; | 886 | unsigned int first_instance = 0; |
883 | char *buf; | 887 | char *buf; |
884 | 888 | ||
885 | timeout = flags & CIFS_TIMEOUT_MASK; | ||
886 | optype = flags & CIFS_OP_MASK; | 889 | optype = flags & CIFS_OP_MASK; |
887 | 890 | ||
888 | for (i = 0; i < num_rqst; i++) | 891 | for (i = 0; i < num_rqst; i++) |
@@ -933,8 +936,7 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses, | |||
933 | * Ensure we obtain 1 credit per request in the compound chain. | 936 | * Ensure we obtain 1 credit per request in the compound chain. |
934 | */ | 937 | */ |
935 | for (i = 0; i < num_rqst; i++) { | 938 | for (i = 0; i < num_rqst; i++) { |
936 | rc = wait_for_free_request(ses->server, timeout, optype, | 939 | rc = wait_for_free_request(ses->server, flags, &instance); |
937 | &instance); | ||
938 | 940 | ||
939 | if (rc == 0) { | 941 | if (rc == 0) { |
940 | credits[i].value = 1; | 942 | credits[i].value = 1; |
@@ -1057,7 +1059,7 @@ setup_rqsts: | |||
1057 | smb311_update_preauth_hash(ses, rqst[0].rq_iov, | 1059 | smb311_update_preauth_hash(ses, rqst[0].rq_iov, |
1058 | rqst[0].rq_nvec); | 1060 | rqst[0].rq_nvec); |
1059 | 1061 | ||
1060 | if (timeout == CIFS_ASYNC_OP) | 1062 | if ((flags & CIFS_TIMEOUT_MASK) == CIFS_ASYNC_OP) |
1061 | goto out; | 1063 | goto out; |
1062 | 1064 | ||
1063 | for (i = 0; i < num_rqst; i++) { | 1065 | for (i = 0; i < num_rqst; i++) { |
@@ -1194,7 +1196,7 @@ SendReceive2(const unsigned int xid, struct cifs_ses *ses, | |||
1194 | int | 1196 | int |
1195 | SendReceive(const unsigned int xid, struct cifs_ses *ses, | 1197 | SendReceive(const unsigned int xid, struct cifs_ses *ses, |
1196 | struct smb_hdr *in_buf, struct smb_hdr *out_buf, | 1198 | struct smb_hdr *in_buf, struct smb_hdr *out_buf, |
1197 | int *pbytes_returned, const int timeout) | 1199 | int *pbytes_returned, const int flags) |
1198 | { | 1200 | { |
1199 | int rc = 0; | 1201 | int rc = 0; |
1200 | struct mid_q_entry *midQ; | 1202 | struct mid_q_entry *midQ; |
@@ -1225,7 +1227,7 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses, | |||
1225 | return -EIO; | 1227 | return -EIO; |
1226 | } | 1228 | } |
1227 | 1229 | ||
1228 | rc = wait_for_free_request(ses->server, timeout, 0, &credits.instance); | 1230 | rc = wait_for_free_request(ses->server, flags, &credits.instance); |
1229 | if (rc) | 1231 | if (rc) |
1230 | return rc; | 1232 | return rc; |
1231 | 1233 | ||
@@ -1264,7 +1266,7 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses, | |||
1264 | if (rc < 0) | 1266 | if (rc < 0) |
1265 | goto out; | 1267 | goto out; |
1266 | 1268 | ||
1267 | if (timeout == CIFS_ASYNC_OP) | 1269 | if ((flags & CIFS_TIMEOUT_MASK) == CIFS_ASYNC_OP) |
1268 | goto out; | 1270 | goto out; |
1269 | 1271 | ||
1270 | rc = wait_for_response(ses->server, midQ); | 1272 | rc = wait_for_response(ses->server, midQ); |
@@ -1367,8 +1369,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon, | |||
1367 | return -EIO; | 1369 | return -EIO; |
1368 | } | 1370 | } |
1369 | 1371 | ||
1370 | rc = wait_for_free_request(ses->server, CIFS_BLOCKING_OP, 0, | 1372 | rc = wait_for_free_request(ses->server, CIFS_BLOCKING_OP, &instance); |
1371 | &instance); | ||
1372 | if (rc) | 1373 | if (rc) |
1373 | return rc; | 1374 | return rc; |
1374 | 1375 | ||