[PATCH 2/9] nfs: skip over stale rpc packets

Uwe Kleine-König u.kleine-koenig at pengutronix.de
Thu Feb 6 11:40:47 EST 2014


When a former transaction was aborted by hitting Ctrl-C the old reply might
still hang in the ethernet controller making all further transactions fail.

So just skip over old replies.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
---
An alternative would be to drain the ethernet queue before a new request is
sent. Don't know how that works and I don't see much benefit, so I didn't
try to find out :-)
---
 fs/nfs.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/nfs.c b/fs/nfs.c
index 717326435189..e9a6eede06bd 100644
--- a/fs/nfs.c
+++ b/fs/nfs.c
@@ -275,8 +275,13 @@ static int rpc_check_reply(unsigned char *pkt, int rpc_prog, unsigned long rpc_i
 
 	memcpy(&rpc, pkt, sizeof(rpc));
 
-	if (ntohl(rpc.id) != rpc_id)
+	if (ntohl(rpc.id) != rpc_id) {
+		if (ntohl(rpc.id) < rpc_id)
+			/* stale packet, wait a bit longer */
+			return 0;
+
 		return -EINVAL;
+	}
 
 	if (rpc.rstatus  ||
 	    rpc.verifier ||
-- 
1.8.5.2




More information about the barebox mailing list