aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/connect.c
diff options
context:
space:
mode:
authorSteve French <smfrench@austin.rr.com>2005-04-29 01:41:09 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-29 01:41:09 -0400
commit67010fbc6ff889aaf86592bc148d705c5b9e1a27 (patch)
treeb599e682e12af8dd9d15d295bbb2d29f064a2904 /fs/cifs/connect.c
parent09d1db5c6131232f764046160c29118cd4e5e646 (diff)
[PATCH] cifs: Better handle errors on second socket recv message call
Signed-off-by: Steve French (sfrench@us.ibm.com) Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/cifs/connect.c')
-rw-r--r--fs/cifs/connect.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index d5d49b584db4..8c5d310514ea 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -359,20 +359,36 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
359 length = 0; 359 length = 0;
360 iov.iov_base = 4 + (char *)smb_buffer; 360 iov.iov_base = 4 + (char *)smb_buffer;
361 iov.iov_len = pdu_length; 361 iov.iov_len = pdu_length;
362 for (total_read = 0; 362 for (total_read = 0;
363 total_read < pdu_length; 363 total_read < pdu_length;
364 total_read += length) { 364 total_read += length) {
365 length = kernel_recvmsg(csocket, &smb_msg, 365 length = kernel_recvmsg(csocket, &smb_msg,
366 &iov, 1, 366 &iov, 1,
367 pdu_length - total_read, 0); 367 pdu_length - total_read, 0);
368 if (length == 0) { 368 if((server->tcpStatus == CifsExiting) ||
369 (length == -EINTR)) {
370 /* then will exit */
371 goto dmx_loop_end;
372 } else if (server->tcpStatus ==
373 CifsNeedReconnect) {
374 cifs_reconnect(server);
375 csocket = server->ssocket;
376 /* Reconnect wakes up rspns q */
377 /* Now we will reread sock */
378 goto dmx_loop_end;
379 } else if ((length == -ERESTARTSYS) ||
380 (length == -EAGAIN)) {
381 msleep(1); /* minimum sleep to prevent looping
382 allowing socket to clear and app threads to set
383 tcpStatus CifsNeedReconnect if server hung */
384 continue;
385 } else if (length <= 0) {
369 cERROR(1, 386 cERROR(1,
370 ("Zero length receive when expecting %d ", 387 ("Received no data, expecting %d",
371 pdu_length - total_read)); 388 pdu_length - total_read));
372 cifs_reconnect(server); 389 cifs_reconnect(server);
373 csocket = server->ssocket; 390 csocket = server->ssocket;
374 wake_up(&server->response_q); 391 goto dmx_loop_end;
375 continue;
376 } 392 }
377 } 393 }
378 length += 4; /* account for rfc1002 hdr */ 394 length += 4; /* account for rfc1002 hdr */
@@ -434,6 +450,9 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
434 wake_up(&server->response_q); 450 wake_up(&server->response_q);
435 continue; 451 continue;
436 } 452 }
453dmx_loop_end:
454 cFYI(1,("Exiting cifsd loop"));
455
437 } 456 }
438 spin_lock(&GlobalMid_Lock); 457 spin_lock(&GlobalMid_Lock);
439 server->tcpStatus = CifsExiting; 458 server->tcpStatus = CifsExiting;