2002-04-10 05:52:10

by minoura makoto

[permalink] [raw]
Subject: [PATCH] fix for bad TCP reclen


The attached patch for linux-2.5.7 fixes the bug in kNFSd that
it ignores short read/EAGAIN while reading the RPC over TCP recordmarks.

It sometimes fell into "bad TCP reclen 0x????????" storm, especially
in some abnormal conditions (server reboots etc).

--
MINOURA Makoto <[email protected]>
Engineering Dept., VA Linux Systems Japan

--- net/sunrpc/svcsock.c.orig Tue Mar 19 05:37:05 2002
+++ net/sunrpc/svcsock.c Fri Mar 29 17:47:24 2002
@@ -781,10 +781,18 @@
unsigned long want = 4 - svsk->sk_tcplen;
struct iovec iov;

+ len = svc_recv_available(svsk);
+ if (len == -EAGAIN || (len >= 0 && len < want)) {
+ dprintk("short TCP recmark read %d\n", svsk->sk_tcplen);
+ goto error;
+ }
+
iov.iov_base = ((char *) &svsk->sk_reclen) + svsk->sk_tcplen;
iov.iov_len = want;
- if ((len = svc_recvfrom(rqstp, &iov, 1, want)) < 0)
+ len = svc_recvfrom(rqstp, &iov, 1, want);
+ if (len < 0)
goto error;
+
svsk->sk_tcplen += len;

svsk->sk_reclen = ntohl(svsk->sk_reclen);

_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs