diff options
Diffstat (limited to 'fs/cifs/transport.c')
-rw-r--r-- | fs/cifs/transport.c | 69 |
1 files changed, 57 insertions, 12 deletions
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c index c1ccca1a933f..46d8756f2b24 100644 --- a/fs/cifs/transport.c +++ b/fs/cifs/transport.c | |||
@@ -236,9 +236,9 @@ smb_sendv(struct TCP_Server_Info *server, struct kvec *iov, int n_vec) | |||
236 | server->tcpStatus = CifsNeedReconnect; | 236 | server->tcpStatus = CifsNeedReconnect; |
237 | } | 237 | } |
238 | 238 | ||
239 | if (rc < 0) { | 239 | if (rc < 0 && rc != -EINTR) |
240 | cERROR(1, "Error %d sending data on socket to server", rc); | 240 | cERROR(1, "Error %d sending data on socket to server", rc); |
241 | } else | 241 | else |
242 | rc = 0; | 242 | rc = 0; |
243 | 243 | ||
244 | /* Don't want to modify the buffer as a | 244 | /* Don't want to modify the buffer as a |
@@ -359,6 +359,10 @@ cifs_call_async(struct TCP_Server_Info *server, struct smb_hdr *in_buf, | |||
359 | if (rc) | 359 | if (rc) |
360 | return rc; | 360 | return rc; |
361 | 361 | ||
362 | /* enable signing if server requires it */ | ||
363 | if (server->secMode & (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) | ||
364 | in_buf->Flags2 |= SMBFLG2_SECURITY_SIGNATURE; | ||
365 | |||
362 | mutex_lock(&server->srv_mutex); | 366 | mutex_lock(&server->srv_mutex); |
363 | mid = AllocMidQEntry(in_buf, server); | 367 | mid = AllocMidQEntry(in_buf, server); |
364 | if (mid == NULL) { | 368 | if (mid == NULL) { |
@@ -453,6 +457,9 @@ sync_mid_result(struct mid_q_entry *mid, struct TCP_Server_Info *server) | |||
453 | case MID_RETRY_NEEDED: | 457 | case MID_RETRY_NEEDED: |
454 | rc = -EAGAIN; | 458 | rc = -EAGAIN; |
455 | break; | 459 | break; |
460 | case MID_RESPONSE_MALFORMED: | ||
461 | rc = -EIO; | ||
462 | break; | ||
456 | default: | 463 | default: |
457 | cERROR(1, "%s: invalid mid state mid=%d state=%d", __func__, | 464 | cERROR(1, "%s: invalid mid state mid=%d state=%d", __func__, |
458 | mid->mid, mid->midState); | 465 | mid->mid, mid->midState); |
@@ -570,17 +577,33 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses, | |||
570 | #endif | 577 | #endif |
571 | 578 | ||
572 | mutex_unlock(&ses->server->srv_mutex); | 579 | mutex_unlock(&ses->server->srv_mutex); |
573 | cifs_small_buf_release(in_buf); | ||
574 | 580 | ||
575 | if (rc < 0) | 581 | if (rc < 0) { |
582 | cifs_small_buf_release(in_buf); | ||
576 | goto out; | 583 | goto out; |
584 | } | ||
577 | 585 | ||
578 | if (long_op == CIFS_ASYNC_OP) | 586 | if (long_op == CIFS_ASYNC_OP) { |
587 | cifs_small_buf_release(in_buf); | ||
579 | goto out; | 588 | goto out; |
589 | } | ||
580 | 590 | ||
581 | rc = wait_for_response(ses->server, midQ); | 591 | rc = wait_for_response(ses->server, midQ); |
582 | if (rc != 0) | 592 | if (rc != 0) { |
583 | goto out; | 593 | send_nt_cancel(ses->server, in_buf, midQ); |
594 | spin_lock(&GlobalMid_Lock); | ||
595 | if (midQ->midState == MID_REQUEST_SUBMITTED) { | ||
596 | midQ->callback = DeleteMidQEntry; | ||
597 | spin_unlock(&GlobalMid_Lock); | ||
598 | cifs_small_buf_release(in_buf); | ||
599 | atomic_dec(&ses->server->inFlight); | ||
600 | wake_up(&ses->server->request_q); | ||
601 | return rc; | ||
602 | } | ||
603 | spin_unlock(&GlobalMid_Lock); | ||
604 | } | ||
605 | |||
606 | cifs_small_buf_release(in_buf); | ||
584 | 607 | ||
585 | rc = sync_mid_result(midQ, ses->server); | 608 | rc = sync_mid_result(midQ, ses->server); |
586 | if (rc != 0) { | 609 | if (rc != 0) { |
@@ -724,8 +747,19 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses, | |||
724 | goto out; | 747 | goto out; |
725 | 748 | ||
726 | rc = wait_for_response(ses->server, midQ); | 749 | rc = wait_for_response(ses->server, midQ); |
727 | if (rc != 0) | 750 | if (rc != 0) { |
728 | goto out; | 751 | send_nt_cancel(ses->server, in_buf, midQ); |
752 | spin_lock(&GlobalMid_Lock); | ||
753 | if (midQ->midState == MID_REQUEST_SUBMITTED) { | ||
754 | /* no longer considered to be "in-flight" */ | ||
755 | midQ->callback = DeleteMidQEntry; | ||
756 | spin_unlock(&GlobalMid_Lock); | ||
757 | atomic_dec(&ses->server->inFlight); | ||
758 | wake_up(&ses->server->request_q); | ||
759 | return rc; | ||
760 | } | ||
761 | spin_unlock(&GlobalMid_Lock); | ||
762 | } | ||
729 | 763 | ||
730 | rc = sync_mid_result(midQ, ses->server); | 764 | rc = sync_mid_result(midQ, ses->server); |
731 | if (rc != 0) { | 765 | if (rc != 0) { |
@@ -922,10 +956,21 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon, | |||
922 | } | 956 | } |
923 | } | 957 | } |
924 | 958 | ||
925 | if (wait_for_response(ses->server, midQ) == 0) { | 959 | rc = wait_for_response(ses->server, midQ); |
926 | /* We got the response - restart system call. */ | 960 | if (rc) { |
927 | rstart = 1; | 961 | send_nt_cancel(ses->server, in_buf, midQ); |
962 | spin_lock(&GlobalMid_Lock); | ||
963 | if (midQ->midState == MID_REQUEST_SUBMITTED) { | ||
964 | /* no longer considered to be "in-flight" */ | ||
965 | midQ->callback = DeleteMidQEntry; | ||
966 | spin_unlock(&GlobalMid_Lock); | ||
967 | return rc; | ||
968 | } | ||
969 | spin_unlock(&GlobalMid_Lock); | ||
928 | } | 970 | } |
971 | |||
972 | /* We got the response - restart system call. */ | ||
973 | rstart = 1; | ||
929 | } | 974 | } |
930 | 975 | ||
931 | rc = sync_mid_result(midQ, ses->server); | 976 | rc = sync_mid_result(midQ, ses->server); |