Commit b07e2e98 authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] kNFSd: TCP nfsd connection hangs when partial record header is received

Below patch resolves a hang where a TCP nfsd connection will hang even
though new data is received on the socket. We've seen this a few times in
our lab, but it usually happened every few weeks.

If a short record header is received, the SK_BUSY flag is never cleared,
and even though new data arrives, it will not be handled. This in turn
leads to hangs of particular clients (while others will continue to work
without problem).

I also changed the return code for that condition to be the same as for a
(regular) short read.
parent bb37b84a
...@@ -886,8 +886,12 @@ svc_tcp_recvfrom(struct svc_rqst *rqstp) ...@@ -886,8 +886,12 @@ svc_tcp_recvfrom(struct svc_rqst *rqstp)
goto error; goto error;
svsk->sk_tcplen += len; svsk->sk_tcplen += len;
if (len < want) if (len < want) {
return 0; dprintk("svc: short recvfrom while reading record length (%d of %lu)\n",
len, want);
svc_sock_received(svsk);
return -EAGAIN; /* record header not complete */
}
svsk->sk_reclen = ntohl(svsk->sk_reclen); svsk->sk_reclen = ntohl(svsk->sk_reclen);
if (!(svsk->sk_reclen & 0x80000000)) { if (!(svsk->sk_reclen & 0x80000000)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment