Skip to content

Commit

Permalink
[CIFS] Fix spurious reconnect on 2nd peek from read of SMB length
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Petr Tesarik authored and Steve French committed Nov 20, 2007
1 parent f7a44ea commit 2a97468
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fs/cifs/connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,9 +438,9 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
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;
Expand Down

0 comments on commit 2a97468

Please sign in to comment.