Skip to contentSkip to conversation

kNFSd - 3 of 4 - TCP nfsd connection hangs when partial record header is received

PATCH New NeilBrown 1 participant 1 message Jun 18, 2003

Subsystems (3)
lore
Share & tools
lore

NeilBrown

author
#0 lore raw

PATCH 1/1 kNFSd - 3 of 4 - TCP nfsd connection hangs when partial record header is received

From: Olof Johansson <[email protected]>

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.

net/sunrpc/svcsock.c renamed from net/sunrpc/svcsock.c~current~ +6 -2
diff ./net/sunrpc/svcsock.c~current~ ./net/sunrpc/svcsock.c
@@ -816,8 +816,12 @@ svc_tcp_recvfrom(struct svc_rqst *rqstp)
 		if ((len = svc_recvfrom(rqstp, &iov, 1, want)) < 0)
 			goto error;
 		svsk->sk_tcplen += len;
-		if (len < want)
-			return 0;
+		if (len < want) {
+			dprintk("svc: short recvfrom while reading record length (%d of %d)\n",
+			        len, want);
+			svc_sock_received(svsk);
+			return -EAGAIN; /* record header not complete */
+		}
 
 		svsk->sk_reclen = ntohl(svsk->sk_reclen);
 		if (!(svsk->sk_reclen & 0x80000000)) {

-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner. Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission! INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs