aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSteve French <smfrench@austin.rr.com>2005-04-29 01:41:10 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-29 01:41:10 -0400
commitcd63499cbe37e53e6cc084c8a35d911a4613c797 (patch)
tree5f365aa9daaf89a9890c53dc681474a7fd292e45 /fs
parent275cde1a1f3880601509c851d72c82bb8d3ee67c (diff)
[PATCH] cifs: Handle case of multiple trans2 responses for one SMB request (part 2 of 2)
Signed-off-by: Steve French (sfrench@us.ibm.com) Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/CHANGES2
-rw-r--r--fs/cifs/cifssmb.c22
-rw-r--r--fs/cifs/connect.c19
3 files changed, 23 insertions, 20 deletions
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES
index 0414eb325468..3d61d96d7407 100644
--- a/fs/cifs/CHANGES
+++ b/fs/cifs/CHANGES
@@ -4,6 +4,8 @@ Fix caching problem, in which readdir of directory containing a file
4which was cached could cause the file's time stamp to be updated 4which was cached could cause the file's time stamp to be updated
5without invalidating the readahead data (so we could get stale 5without invalidating the readahead data (so we could get stale
6file data on the client for that file even as the server copy changed). 6file data on the client for that file even as the server copy changed).
7Cleanup response processing so cifsd can not loop when abnormally
8terminated.
7 9
8 10
9Version 1.32 11Version 1.32
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index a6e66974b286..f8edf816b4be 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -470,7 +470,7 @@ CIFSSMBTDis(const int xid, struct cifsTconInfo *tcon)
470 return rc; 470 return rc;
471 } else { 471 } else {
472 smb_buffer_response = smb_buffer; /* BB removeme BB */ 472 smb_buffer_response = smb_buffer; /* BB removeme BB */
473 } 473 }
474 rc = SendReceive(xid, tcon->ses, smb_buffer, smb_buffer_response, 474 rc = SendReceive(xid, tcon->ses, smb_buffer, smb_buffer_response,
475 &length, 0); 475 &length, 0);
476 if (rc) 476 if (rc)
@@ -2517,9 +2517,6 @@ findFirstRetry:
2517 psrch_inf->srch_entries_start = 2517 psrch_inf->srch_entries_start =
2518 (char *) &pSMBr->hdr.Protocol + 2518 (char *) &pSMBr->hdr.Protocol +
2519 le16_to_cpu(pSMBr->t2.DataOffset); 2519 le16_to_cpu(pSMBr->t2.DataOffset);
2520/* if(le16_to_cpu(pSMBr->t2.DataCount) != le16_to_cpu(pSMBr->t2.TotalDataCount)) {
2521 cERROR(1,("DC: %d TDC: %d",pSMBr->t2.DataCount,pSMBr->t2.TotalDataCount));
2522} */ /* BB removeme BB */
2523 parms = (T2_FFIRST_RSP_PARMS *)((char *) &pSMBr->hdr.Protocol + 2520 parms = (T2_FFIRST_RSP_PARMS *)((char *) &pSMBr->hdr.Protocol +
2524 le16_to_cpu(pSMBr->t2.ParameterOffset)); 2521 le16_to_cpu(pSMBr->t2.ParameterOffset));
2525 2522
@@ -2531,7 +2528,6 @@ findFirstRetry:
2531 psrch_inf->entries_in_buffer = le16_to_cpu(parms->SearchCount); 2528 psrch_inf->entries_in_buffer = le16_to_cpu(parms->SearchCount);
2532 psrch_inf->index_of_last_entry = 2529 psrch_inf->index_of_last_entry =
2533 psrch_inf->entries_in_buffer; 2530 psrch_inf->entries_in_buffer;
2534/*cFYI(1,("entries in buf %d index_of_last %d",psrch_inf->entries_in_buffer,psrch_inf->index_of_last_entry)); */ /* BB removeme BB */
2535 *pnetfid = parms->SearchHandle; 2531 *pnetfid = parms->SearchHandle;
2536 } else { 2532 } else {
2537 cifs_buf_release(pSMB); 2533 cifs_buf_release(pSMB);
@@ -3451,11 +3447,13 @@ CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size,
3451 3447
3452 cFYI(1, ("SetFileSize (via SetFileInfo) %lld", 3448 cFYI(1, ("SetFileSize (via SetFileInfo) %lld",
3453 (long long)size)); 3449 (long long)size));
3454 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB, 3450 rc = small_smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB);
3455 (void **) &pSMBr); 3451
3456 if (rc) 3452 if (rc)
3457 return rc; 3453 return rc;
3458 3454
3455 pSMBr = (struct smb_com_transaction2_sfi_rsp *)pSMB;
3456
3459 pSMB->hdr.Pid = cpu_to_le16((__u16)pid_of_opener); 3457 pSMB->hdr.Pid = cpu_to_le16((__u16)pid_of_opener);
3460 pSMB->hdr.PidHigh = cpu_to_le16((__u16)(pid_of_opener >> 16)); 3458 pSMB->hdr.PidHigh = cpu_to_le16((__u16)(pid_of_opener >> 16));
3461 3459
@@ -3515,7 +3513,7 @@ CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size,
3515 } 3513 }
3516 3514
3517 if (pSMB) 3515 if (pSMB)
3518 cifs_buf_release(pSMB); 3516 cifs_small_buf_release(pSMB);
3519 3517
3520 /* Note: On -EAGAIN error only caller can retry on handle based calls 3518 /* Note: On -EAGAIN error only caller can retry on handle based calls
3521 since file handle passed in no longer valid */ 3519 since file handle passed in no longer valid */
@@ -3541,11 +3539,13 @@ CIFSSMBSetFileTimes(const int xid, struct cifsTconInfo *tcon, const FILE_BASIC_I
3541 __u16 params, param_offset, offset, byte_count, count; 3539 __u16 params, param_offset, offset, byte_count, count;
3542 3540
3543 cFYI(1, ("Set Times (via SetFileInfo)")); 3541 cFYI(1, ("Set Times (via SetFileInfo)"));
3544 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB, 3542 rc = small_smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB);
3545 (void **) &pSMBr); 3543
3546 if (rc) 3544 if (rc)
3547 return rc; 3545 return rc;
3548 3546
3547 pSMBr = (struct smb_com_transaction2_sfi_rsp *)pSMB;
3548
3549 /* At this point there is no need to override the current pid 3549 /* At this point there is no need to override the current pid
3550 with the pid of the opener, but that could change if we someday 3550 with the pid of the opener, but that could change if we someday
3551 use an existing handle (rather than opening one on the fly) */ 3551 use an existing handle (rather than opening one on the fly) */
@@ -3591,7 +3591,7 @@ CIFSSMBSetFileTimes(const int xid, struct cifsTconInfo *tcon, const FILE_BASIC_I
3591 cFYI(1,("Send error in Set Time (SetFileInfo) = %d",rc)); 3591 cFYI(1,("Send error in Set Time (SetFileInfo) = %d",rc));
3592 } 3592 }
3593 3593
3594 cifs_buf_release(pSMB); 3594 cifs_small_buf_release(pSMB);
3595 3595
3596 /* Note: On -EAGAIN error only caller can retry on handle based calls 3596 /* Note: On -EAGAIN error only caller can retry on handle based calls
3597 since file handle passed in no longer valid */ 3597 since file handle passed in no longer valid */
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index a8d592bc33fe..e3b177a90b37 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -544,15 +544,13 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
544 if ((mid_entry->mid == smb_buffer->Mid) && 544 if ((mid_entry->mid == smb_buffer->Mid) &&
545 (mid_entry->midState == MID_REQUEST_SUBMITTED) && 545 (mid_entry->midState == MID_REQUEST_SUBMITTED) &&
546 (mid_entry->command == smb_buffer->Command)) { 546 (mid_entry->command == smb_buffer->Command)) {
547 cFYI(1,("Found Mid 0x%x wake", mid_entry->mid));
548
549 if(check2ndT2(smb_buffer,server->maxBuf) > 0) { 547 if(check2ndT2(smb_buffer,server->maxBuf) > 0) {
550 /* We have a multipart transact2 resp */ 548 /* We have a multipart transact2 resp */
549 isMultiRsp = TRUE;
551 if(mid_entry->resp_buf) { 550 if(mid_entry->resp_buf) {
552 /* merge response - fix up 1st*/ 551 /* merge response - fix up 1st*/
553 if(coalesce_t2(smb_buffer, 552 if(coalesce_t2(smb_buffer,
554 mid_entry->resp_buf)) { 553 mid_entry->resp_buf)) {
555 isMultiRsp = TRUE;
556 break; 554 break;
557 } else { 555 } else {
558 /* all parts received */ 556 /* all parts received */
@@ -564,10 +562,10 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
564 /* BB maybe we can fix this up, switch 562 /* BB maybe we can fix this up, switch
565 to already allocated large buffer? */ 563 to already allocated large buffer? */
566 } else { 564 } else {
565 /* Have first buffer */
567 mid_entry->resp_buf = 566 mid_entry->resp_buf =
568 smb_buffer; 567 smb_buffer;
569 mid_entry->largeBuf = 1; 568 mid_entry->largeBuf = 1;
570 isMultiRsp = TRUE;
571 bigbuf = NULL; 569 bigbuf = NULL;
572 } 570 }
573 } 571 }
@@ -586,11 +584,14 @@ multi_t2_fnd:
586 } 584 }
587 spin_unlock(&GlobalMid_Lock); 585 spin_unlock(&GlobalMid_Lock);
588 if (task_to_wake) { 586 if (task_to_wake) {
589 if(isLargeBuf) 587 /* Was previous buf put in mpx struct for multi-rsp? */
590 bigbuf = NULL; 588 if(!isMultiRsp) {
591 else 589 /* smb buffer will be freed by user thread */
592 smallbuf = NULL; 590 if(isLargeBuf) {
593 /* smb buffer freed by user thread when done */ 591 bigbuf = NULL;
592 } else
593 smallbuf = NULL;
594 }
594 wake_up_process(task_to_wake); 595 wake_up_process(task_to_wake);
595 } else if ((is_valid_oplock_break(smb_buffer) == FALSE) 596 } else if ((is_valid_oplock_break(smb_buffer) == FALSE)
596 && (isMultiRsp == FALSE)) { 597 && (isMultiRsp == FALSE)) {