Skip to contentSkip to conversation

Stop recvfrom errors from killing nfsd

PATCH New Olaf Kirch 1 participant 1 message Sep 21, 2004

Subsystems (3)
lore
Share & tools
lore

Olaf Kirch

author
#0 lore raw

PATCH 1/1 Stop recvfrom errors from killing nfsd

Hi,

I just looked into a customer report about nfsd processes terminating because svc_recv() returned -107.

This is caused by svc_tcp_recvfrom propagating errors such as ENOTCONN and ECONNRESET up to svc_recv, which is not equipped to deal with this. svc_recv expects the return value from svsk->sk_recvfrom to be either positive (a packet length), 0 (accept call or incomplete record), or -EAGAIN (no data). Any other error codes are treated just like a packet length.

The original code in svc_tcp_recvfrom would always kill the socket when it got an unexpected error, and return EAGAIN. This was changed some time between 2.4.18 and 2.4.21 - I don't know for what reasons.

The patch below reverts that change.

Alternatively, we could add special case treatment for certain error codes; e.g. propagating EINTR up to nfsd while making ECONNRESET and ENOTCONN simply kill the connection.

Cheers,
Olaf

Signature · 3 lines
Olaf Kirch     |  The Hardware Gods hate me.
[email protected]   |
---------------+ 

From: Olaf Kirch <[email protected]>

svc_recv is not equipped to deal with error codes other than EAGAIN, and will propagate anything else (such as ECONNRESET) up to nfsd, causing it to exit.

net/sunrpc/svcsock.c +1 -1
Index: 2.4.21/net/sunrpc/svcsock.c
===================================================================
@@ -894,7 +894,7 @@ svc_tcp_recvfrom(struct svc_rqst *rqstp)
 	} else {
 		printk(KERN_NOTICE "%s: recvfrom returned errno %d\n",
 					svsk->sk_server->sv_name, -len);
-		svc_sock_received(svsk);
+		goto err_delete;
 	}
 
 	return len;