[PATCH v2 03/11] nfs: skip over stale rpc packets
Uwe Kleine-König
u.kleine-koenig at pengutronix.de
Fri Feb 7 16:28:05 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>
---
Notes:
Changed in v2:
- use
if (rpc_id - ntohl(rpc.id) == 1)
instead of
if (ntohl(rpc.id) < rpc_id)
to drop at most a single stale reply and handle overflow properly
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 6582bae7db31..76d8c0595db4 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 (rpc_id - ntohl(rpc.id) == 1)
+ /* 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