diff options
Diffstat (limited to 'fs/cifs/transport.c')
-rw-r--r-- | fs/cifs/transport.c | 91 |
1 files changed, 45 insertions, 46 deletions
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c index ad081fe7eb18..28f563cef5d7 100644 --- a/fs/cifs/transport.c +++ b/fs/cifs/transport.c | |||
@@ -43,7 +43,7 @@ AllocMidQEntry(const struct smb_hdr *smb_buffer, struct TCP_Server_Info *server) | |||
43 | struct mid_q_entry *temp; | 43 | struct mid_q_entry *temp; |
44 | 44 | ||
45 | if (server == NULL) { | 45 | if (server == NULL) { |
46 | cERROR(1, ("Null TCP session in AllocMidQEntry")); | 46 | cERROR(1, "Null TCP session in AllocMidQEntry"); |
47 | return NULL; | 47 | return NULL; |
48 | } | 48 | } |
49 | 49 | ||
@@ -55,7 +55,7 @@ AllocMidQEntry(const struct smb_hdr *smb_buffer, struct TCP_Server_Info *server) | |||
55 | temp->mid = smb_buffer->Mid; /* always LE */ | 55 | temp->mid = smb_buffer->Mid; /* always LE */ |
56 | temp->pid = current->pid; | 56 | temp->pid = current->pid; |
57 | temp->command = smb_buffer->Command; | 57 | temp->command = smb_buffer->Command; |
58 | cFYI(1, ("For smb_command %d", temp->command)); | 58 | cFYI(1, "For smb_command %d", temp->command); |
59 | /* do_gettimeofday(&temp->when_sent);*/ /* easier to use jiffies */ | 59 | /* do_gettimeofday(&temp->when_sent);*/ /* easier to use jiffies */ |
60 | /* when mid allocated can be before when sent */ | 60 | /* when mid allocated can be before when sent */ |
61 | temp->when_alloc = jiffies; | 61 | temp->when_alloc = jiffies; |
@@ -140,7 +140,7 @@ smb_sendv(struct TCP_Server_Info *server, struct kvec *iov, int n_vec) | |||
140 | total_len += iov[i].iov_len; | 140 | total_len += iov[i].iov_len; |
141 | 141 | ||
142 | smb_buffer->smb_buf_length = cpu_to_be32(smb_buffer->smb_buf_length); | 142 | smb_buffer->smb_buf_length = cpu_to_be32(smb_buffer->smb_buf_length); |
143 | cFYI(1, ("Sending smb: total_len %d", total_len)); | 143 | cFYI(1, "Sending smb: total_len %d", total_len); |
144 | dump_smb(smb_buffer, len); | 144 | dump_smb(smb_buffer, len); |
145 | 145 | ||
146 | i = 0; | 146 | i = 0; |
@@ -168,9 +168,8 @@ smb_sendv(struct TCP_Server_Info *server, struct kvec *iov, int n_vec) | |||
168 | reconnect which may clear the network problem. | 168 | reconnect which may clear the network problem. |
169 | */ | 169 | */ |
170 | if ((i >= 14) || (!server->noblocksnd && (i > 2))) { | 170 | if ((i >= 14) || (!server->noblocksnd && (i > 2))) { |
171 | cERROR(1, | 171 | cERROR(1, "sends on sock %p stuck for 15 seconds", |
172 | ("sends on sock %p stuck for 15 seconds", | 172 | ssocket); |
173 | ssocket)); | ||
174 | rc = -EAGAIN; | 173 | rc = -EAGAIN; |
175 | break; | 174 | break; |
176 | } | 175 | } |
@@ -184,13 +183,13 @@ smb_sendv(struct TCP_Server_Info *server, struct kvec *iov, int n_vec) | |||
184 | total_len = 0; | 183 | total_len = 0; |
185 | break; | 184 | break; |
186 | } else if (rc > total_len) { | 185 | } else if (rc > total_len) { |
187 | cERROR(1, ("sent %d requested %d", rc, total_len)); | 186 | cERROR(1, "sent %d requested %d", rc, total_len); |
188 | break; | 187 | break; |
189 | } | 188 | } |
190 | if (rc == 0) { | 189 | if (rc == 0) { |
191 | /* should never happen, letting socket clear before | 190 | /* should never happen, letting socket clear before |
192 | retrying is our only obvious option here */ | 191 | retrying is our only obvious option here */ |
193 | cERROR(1, ("tcp sent no data")); | 192 | cERROR(1, "tcp sent no data"); |
194 | msleep(500); | 193 | msleep(500); |
195 | continue; | 194 | continue; |
196 | } | 195 | } |
@@ -213,8 +212,8 @@ smb_sendv(struct TCP_Server_Info *server, struct kvec *iov, int n_vec) | |||
213 | } | 212 | } |
214 | 213 | ||
215 | if ((total_len > 0) && (total_len != smb_buf_length + 4)) { | 214 | if ((total_len > 0) && (total_len != smb_buf_length + 4)) { |
216 | cFYI(1, ("partial send (%d remaining), terminating session", | 215 | cFYI(1, "partial send (%d remaining), terminating session", |
217 | total_len)); | 216 | total_len); |
218 | /* If we have only sent part of an SMB then the next SMB | 217 | /* If we have only sent part of an SMB then the next SMB |
219 | could be taken as the remainder of this one. We need | 218 | could be taken as the remainder of this one. We need |
220 | to kill the socket so the server throws away the partial | 219 | to kill the socket so the server throws away the partial |
@@ -223,7 +222,7 @@ smb_sendv(struct TCP_Server_Info *server, struct kvec *iov, int n_vec) | |||
223 | } | 222 | } |
224 | 223 | ||
225 | if (rc < 0) { | 224 | if (rc < 0) { |
226 | cERROR(1, ("Error %d sending data on socket to server", rc)); | 225 | cERROR(1, "Error %d sending data on socket to server", rc); |
227 | } else | 226 | } else |
228 | rc = 0; | 227 | rc = 0; |
229 | 228 | ||
@@ -296,7 +295,7 @@ static int allocate_mid(struct cifsSesInfo *ses, struct smb_hdr *in_buf, | |||
296 | } | 295 | } |
297 | 296 | ||
298 | if (ses->server->tcpStatus == CifsNeedReconnect) { | 297 | if (ses->server->tcpStatus == CifsNeedReconnect) { |
299 | cFYI(1, ("tcp session dead - return to caller to retry")); | 298 | cFYI(1, "tcp session dead - return to caller to retry"); |
300 | return -EAGAIN; | 299 | return -EAGAIN; |
301 | } | 300 | } |
302 | 301 | ||
@@ -348,7 +347,7 @@ static int wait_for_response(struct cifsSesInfo *ses, | |||
348 | lrt += time_to_wait; | 347 | lrt += time_to_wait; |
349 | if (time_after(jiffies, lrt)) { | 348 | if (time_after(jiffies, lrt)) { |
350 | /* No replies for time_to_wait. */ | 349 | /* No replies for time_to_wait. */ |
351 | cERROR(1, ("server not responding")); | 350 | cERROR(1, "server not responding"); |
352 | return -1; | 351 | return -1; |
353 | } | 352 | } |
354 | } else { | 353 | } else { |
@@ -379,7 +378,7 @@ SendReceiveNoRsp(const unsigned int xid, struct cifsSesInfo *ses, | |||
379 | iov[0].iov_len = in_buf->smb_buf_length + 4; | 378 | iov[0].iov_len = in_buf->smb_buf_length + 4; |
380 | flags |= CIFS_NO_RESP; | 379 | flags |= CIFS_NO_RESP; |
381 | rc = SendReceive2(xid, ses, iov, 1, &resp_buf_type, flags); | 380 | rc = SendReceive2(xid, ses, iov, 1, &resp_buf_type, flags); |
382 | cFYI(DBG2, ("SendRcvNoRsp flags %d rc %d", flags, rc)); | 381 | cFYI(DBG2, "SendRcvNoRsp flags %d rc %d", flags, rc); |
383 | 382 | ||
384 | return rc; | 383 | return rc; |
385 | } | 384 | } |
@@ -402,7 +401,7 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses, | |||
402 | 401 | ||
403 | if ((ses == NULL) || (ses->server == NULL)) { | 402 | if ((ses == NULL) || (ses->server == NULL)) { |
404 | cifs_small_buf_release(in_buf); | 403 | cifs_small_buf_release(in_buf); |
405 | cERROR(1, ("Null session")); | 404 | cERROR(1, "Null session"); |
406 | return -EIO; | 405 | return -EIO; |
407 | } | 406 | } |
408 | 407 | ||
@@ -471,7 +470,7 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses, | |||
471 | else if (long_op == CIFS_BLOCKING_OP) | 470 | else if (long_op == CIFS_BLOCKING_OP) |
472 | timeout = 0x7FFFFFFF; /* large, but not so large as to wrap */ | 471 | timeout = 0x7FFFFFFF; /* large, but not so large as to wrap */ |
473 | else { | 472 | else { |
474 | cERROR(1, ("unknown timeout flag %d", long_op)); | 473 | cERROR(1, "unknown timeout flag %d", long_op); |
475 | rc = -EIO; | 474 | rc = -EIO; |
476 | goto out; | 475 | goto out; |
477 | } | 476 | } |
@@ -490,8 +489,8 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses, | |||
490 | spin_lock(&GlobalMid_Lock); | 489 | spin_lock(&GlobalMid_Lock); |
491 | 490 | ||
492 | if (midQ->resp_buf == NULL) { | 491 | if (midQ->resp_buf == NULL) { |
493 | cERROR(1, ("No response to cmd %d mid %d", | 492 | cERROR(1, "No response to cmd %d mid %d", |
494 | midQ->command, midQ->mid)); | 493 | midQ->command, midQ->mid); |
495 | if (midQ->midState == MID_REQUEST_SUBMITTED) { | 494 | if (midQ->midState == MID_REQUEST_SUBMITTED) { |
496 | if (ses->server->tcpStatus == CifsExiting) | 495 | if (ses->server->tcpStatus == CifsExiting) |
497 | rc = -EHOSTDOWN; | 496 | rc = -EHOSTDOWN; |
@@ -504,7 +503,7 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses, | |||
504 | if (rc != -EHOSTDOWN) { | 503 | if (rc != -EHOSTDOWN) { |
505 | if (midQ->midState == MID_RETRY_NEEDED) { | 504 | if (midQ->midState == MID_RETRY_NEEDED) { |
506 | rc = -EAGAIN; | 505 | rc = -EAGAIN; |
507 | cFYI(1, ("marking request for retry")); | 506 | cFYI(1, "marking request for retry"); |
508 | } else { | 507 | } else { |
509 | rc = -EIO; | 508 | rc = -EIO; |
510 | } | 509 | } |
@@ -521,8 +520,8 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses, | |||
521 | receive_len = midQ->resp_buf->smb_buf_length; | 520 | receive_len = midQ->resp_buf->smb_buf_length; |
522 | 521 | ||
523 | if (receive_len > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE) { | 522 | if (receive_len > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE) { |
524 | cERROR(1, ("Frame too large received. Length: %d Xid: %d", | 523 | cERROR(1, "Frame too large received. Length: %d Xid: %d", |
525 | receive_len, xid)); | 524 | receive_len, xid); |
526 | rc = -EIO; | 525 | rc = -EIO; |
527 | goto out; | 526 | goto out; |
528 | } | 527 | } |
@@ -548,7 +547,7 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses, | |||
548 | &ses->server->mac_signing_key, | 547 | &ses->server->mac_signing_key, |
549 | midQ->sequence_number+1); | 548 | midQ->sequence_number+1); |
550 | if (rc) { | 549 | if (rc) { |
551 | cERROR(1, ("Unexpected SMB signature")); | 550 | cERROR(1, "Unexpected SMB signature"); |
552 | /* BB FIXME add code to kill session */ | 551 | /* BB FIXME add code to kill session */ |
553 | } | 552 | } |
554 | } | 553 | } |
@@ -569,7 +568,7 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses, | |||
569 | DeleteMidQEntry */ | 568 | DeleteMidQEntry */ |
570 | } else { | 569 | } else { |
571 | rc = -EIO; | 570 | rc = -EIO; |
572 | cFYI(1, ("Bad MID state?")); | 571 | cFYI(1, "Bad MID state?"); |
573 | } | 572 | } |
574 | 573 | ||
575 | out: | 574 | out: |
@@ -591,11 +590,11 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses, | |||
591 | struct mid_q_entry *midQ; | 590 | struct mid_q_entry *midQ; |
592 | 591 | ||
593 | if (ses == NULL) { | 592 | if (ses == NULL) { |
594 | cERROR(1, ("Null smb session")); | 593 | cERROR(1, "Null smb session"); |
595 | return -EIO; | 594 | return -EIO; |
596 | } | 595 | } |
597 | if (ses->server == NULL) { | 596 | if (ses->server == NULL) { |
598 | cERROR(1, ("Null tcp session")); | 597 | cERROR(1, "Null tcp session"); |
599 | return -EIO; | 598 | return -EIO; |
600 | } | 599 | } |
601 | 600 | ||
@@ -607,8 +606,8 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses, | |||
607 | use ses->maxReq */ | 606 | use ses->maxReq */ |
608 | 607 | ||
609 | if (in_buf->smb_buf_length > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE - 4) { | 608 | if (in_buf->smb_buf_length > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE - 4) { |
610 | cERROR(1, ("Illegal length, greater than maximum frame, %d", | 609 | cERROR(1, "Illegal length, greater than maximum frame, %d", |
611 | in_buf->smb_buf_length)); | 610 | in_buf->smb_buf_length); |
612 | return -EIO; | 611 | return -EIO; |
613 | } | 612 | } |
614 | 613 | ||
@@ -665,7 +664,7 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses, | |||
665 | else if (long_op == CIFS_BLOCKING_OP) | 664 | else if (long_op == CIFS_BLOCKING_OP) |
666 | timeout = 0x7FFFFFFF; /* large but no so large as to wrap */ | 665 | timeout = 0x7FFFFFFF; /* large but no so large as to wrap */ |
667 | else { | 666 | else { |
668 | cERROR(1, ("unknown timeout flag %d", long_op)); | 667 | cERROR(1, "unknown timeout flag %d", long_op); |
669 | rc = -EIO; | 668 | rc = -EIO; |
670 | goto out; | 669 | goto out; |
671 | } | 670 | } |
@@ -681,8 +680,8 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses, | |||
681 | 680 | ||
682 | spin_lock(&GlobalMid_Lock); | 681 | spin_lock(&GlobalMid_Lock); |
683 | if (midQ->resp_buf == NULL) { | 682 | if (midQ->resp_buf == NULL) { |
684 | cERROR(1, ("No response for cmd %d mid %d", | 683 | cERROR(1, "No response for cmd %d mid %d", |
685 | midQ->command, midQ->mid)); | 684 | midQ->command, midQ->mid); |
686 | if (midQ->midState == MID_REQUEST_SUBMITTED) { | 685 | if (midQ->midState == MID_REQUEST_SUBMITTED) { |
687 | if (ses->server->tcpStatus == CifsExiting) | 686 | if (ses->server->tcpStatus == CifsExiting) |
688 | rc = -EHOSTDOWN; | 687 | rc = -EHOSTDOWN; |
@@ -695,7 +694,7 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses, | |||
695 | if (rc != -EHOSTDOWN) { | 694 | if (rc != -EHOSTDOWN) { |
696 | if (midQ->midState == MID_RETRY_NEEDED) { | 695 | if (midQ->midState == MID_RETRY_NEEDED) { |
697 | rc = -EAGAIN; | 696 | rc = -EAGAIN; |
698 | cFYI(1, ("marking request for retry")); | 697 | cFYI(1, "marking request for retry"); |
699 | } else { | 698 | } else { |
700 | rc = -EIO; | 699 | rc = -EIO; |
701 | } | 700 | } |
@@ -712,8 +711,8 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses, | |||
712 | receive_len = midQ->resp_buf->smb_buf_length; | 711 | receive_len = midQ->resp_buf->smb_buf_length; |
713 | 712 | ||
714 | if (receive_len > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE) { | 713 | if (receive_len > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE) { |
715 | cERROR(1, ("Frame too large received. Length: %d Xid: %d", | 714 | cERROR(1, "Frame too large received. Length: %d Xid: %d", |
716 | receive_len, xid)); | 715 | receive_len, xid); |
717 | rc = -EIO; | 716 | rc = -EIO; |
718 | goto out; | 717 | goto out; |
719 | } | 718 | } |
@@ -736,7 +735,7 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses, | |||
736 | &ses->server->mac_signing_key, | 735 | &ses->server->mac_signing_key, |
737 | midQ->sequence_number+1); | 736 | midQ->sequence_number+1); |
738 | if (rc) { | 737 | if (rc) { |
739 | cERROR(1, ("Unexpected SMB signature")); | 738 | cERROR(1, "Unexpected SMB signature"); |
740 | /* BB FIXME add code to kill session */ | 739 | /* BB FIXME add code to kill session */ |
741 | } | 740 | } |
742 | } | 741 | } |
@@ -753,7 +752,7 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses, | |||
753 | BCC(out_buf) = le16_to_cpu(BCC_LE(out_buf)); | 752 | BCC(out_buf) = le16_to_cpu(BCC_LE(out_buf)); |
754 | } else { | 753 | } else { |
755 | rc = -EIO; | 754 | rc = -EIO; |
756 | cERROR(1, ("Bad MID state?")); | 755 | cERROR(1, "Bad MID state?"); |
757 | } | 756 | } |
758 | 757 | ||
759 | out: | 758 | out: |
@@ -824,13 +823,13 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon, | |||
824 | struct cifsSesInfo *ses; | 823 | struct cifsSesInfo *ses; |
825 | 824 | ||
826 | if (tcon == NULL || tcon->ses == NULL) { | 825 | if (tcon == NULL || tcon->ses == NULL) { |
827 | cERROR(1, ("Null smb session")); | 826 | cERROR(1, "Null smb session"); |
828 | return -EIO; | 827 | return -EIO; |
829 | } | 828 | } |
830 | ses = tcon->ses; | 829 | ses = tcon->ses; |
831 | 830 | ||
832 | if (ses->server == NULL) { | 831 | if (ses->server == NULL) { |
833 | cERROR(1, ("Null tcp session")); | 832 | cERROR(1, "Null tcp session"); |
834 | return -EIO; | 833 | return -EIO; |
835 | } | 834 | } |
836 | 835 | ||
@@ -842,8 +841,8 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon, | |||
842 | use ses->maxReq */ | 841 | use ses->maxReq */ |
843 | 842 | ||
844 | if (in_buf->smb_buf_length > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE - 4) { | 843 | if (in_buf->smb_buf_length > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE - 4) { |
845 | cERROR(1, ("Illegal length, greater than maximum frame, %d", | 844 | cERROR(1, "Illegal length, greater than maximum frame, %d", |
846 | in_buf->smb_buf_length)); | 845 | in_buf->smb_buf_length); |
847 | return -EIO; | 846 | return -EIO; |
848 | } | 847 | } |
849 | 848 | ||
@@ -933,8 +932,8 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon, | |||
933 | spin_unlock(&GlobalMid_Lock); | 932 | spin_unlock(&GlobalMid_Lock); |
934 | receive_len = midQ->resp_buf->smb_buf_length; | 933 | receive_len = midQ->resp_buf->smb_buf_length; |
935 | } else { | 934 | } else { |
936 | cERROR(1, ("No response for cmd %d mid %d", | 935 | cERROR(1, "No response for cmd %d mid %d", |
937 | midQ->command, midQ->mid)); | 936 | midQ->command, midQ->mid); |
938 | if (midQ->midState == MID_REQUEST_SUBMITTED) { | 937 | if (midQ->midState == MID_REQUEST_SUBMITTED) { |
939 | if (ses->server->tcpStatus == CifsExiting) | 938 | if (ses->server->tcpStatus == CifsExiting) |
940 | rc = -EHOSTDOWN; | 939 | rc = -EHOSTDOWN; |
@@ -947,7 +946,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon, | |||
947 | if (rc != -EHOSTDOWN) { | 946 | if (rc != -EHOSTDOWN) { |
948 | if (midQ->midState == MID_RETRY_NEEDED) { | 947 | if (midQ->midState == MID_RETRY_NEEDED) { |
949 | rc = -EAGAIN; | 948 | rc = -EAGAIN; |
950 | cFYI(1, ("marking request for retry")); | 949 | cFYI(1, "marking request for retry"); |
951 | } else { | 950 | } else { |
952 | rc = -EIO; | 951 | rc = -EIO; |
953 | } | 952 | } |
@@ -958,8 +957,8 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon, | |||
958 | } | 957 | } |
959 | 958 | ||
960 | if (receive_len > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE) { | 959 | if (receive_len > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE) { |
961 | cERROR(1, ("Frame too large received. Length: %d Xid: %d", | 960 | cERROR(1, "Frame too large received. Length: %d Xid: %d", |
962 | receive_len, xid)); | 961 | receive_len, xid); |
963 | rc = -EIO; | 962 | rc = -EIO; |
964 | goto out; | 963 | goto out; |
965 | } | 964 | } |
@@ -968,7 +967,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon, | |||
968 | 967 | ||
969 | if ((out_buf == NULL) || (midQ->midState != MID_RESPONSE_RECEIVED)) { | 968 | if ((out_buf == NULL) || (midQ->midState != MID_RESPONSE_RECEIVED)) { |
970 | rc = -EIO; | 969 | rc = -EIO; |
971 | cERROR(1, ("Bad MID state?")); | 970 | cERROR(1, "Bad MID state?"); |
972 | goto out; | 971 | goto out; |
973 | } | 972 | } |
974 | 973 | ||
@@ -986,7 +985,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon, | |||
986 | &ses->server->mac_signing_key, | 985 | &ses->server->mac_signing_key, |
987 | midQ->sequence_number+1); | 986 | midQ->sequence_number+1); |
988 | if (rc) { | 987 | if (rc) { |
989 | cERROR(1, ("Unexpected SMB signature")); | 988 | cERROR(1, "Unexpected SMB signature"); |
990 | /* BB FIXME add code to kill session */ | 989 | /* BB FIXME add code to kill session */ |
991 | } | 990 | } |
992 | } | 991 | } |