[CIFS] Fix spurious reconnect on 2nd peek from read of SMB length
authorPetr Tesarik <ptesarik@suse.cz>
Tue, 20 Nov 2007 02:24:08 +0000 (02:24 +0000)
committerSteve French <sfrench@us.ibm.com>
Tue, 20 Nov 2007 02:24:08 +0000 (02:24 +0000)
When retrying kernel_recvmsg() because of a short read, check returned
length against the remaining length, not against total length. This
avoids unneeded session reconnects which would otherwise occur when
kernel_recvmsg() finally returns zero when asked to read zero bytes.

Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
fs/cifs/connect.c

index c4b32b7f4355e4c2a56c35134457abf501c98212..fd9147cdb5a98d76b8a354b3b2a8efd518aeb565 100644 (file)
@@ -438,9 +438,9 @@ incomplete_rcv:
                        csocket = server->ssocket;
                        wake_up(&server->response_q);
                        continue;
-               } else if (length < 4) {
-                       cFYI(1, ("less than four bytes received (%d bytes)",
-                             length));
+               } else if (length < pdu_length) {
+                       cFYI(1, ("requested %d bytes but only got %d bytes",
+                                 pdu_length, length));
                        pdu_length -= length;
                        msleep(1);
                        goto incomplete_rcv;