Set SO_SNDTIMEO in the client side krpc when CLSET_TIMEOUT is done.
During testing of the pNFS client, it was observed that an RPC could get stuck in sosend() for a very long time if the network connection to a DS had failed. This is fixed by setting SO_SNDTIMEO on the TCP socket. This is only done when CLSET_TIMEOUT is done and this is not done by any use of the krpc currently in the source tree, so there should be no effect on extant uses. A future patch will use CLSET_TIMEOUT for TCP connections to DSs. Reviewed by: kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D16293
This commit is contained in:
parent
c721d4192e
commit
1a59bccc42
@ -174,10 +174,26 @@ clnt_reconnect_connect(CLIENT *cl)
|
||||
newclient = clnt_dg_create(so,
|
||||
(struct sockaddr *) &rc->rc_addr, rc->rc_prog, rc->rc_vers,
|
||||
rc->rc_sendsz, rc->rc_recvsz);
|
||||
else
|
||||
else {
|
||||
/*
|
||||
* I do not believe a timeout of less than 1sec would make
|
||||
* sense here since short delays can occur when a server is
|
||||
* temporarily overloaded.
|
||||
*/
|
||||
if (rc->rc_timeout.tv_sec > 0 && rc->rc_timeout.tv_usec >= 0) {
|
||||
error = so_setsockopt(so, SOL_SOCKET, SO_SNDTIMEO,
|
||||
&rc->rc_timeout, sizeof(struct timeval));
|
||||
if (error != 0) {
|
||||
stat = rpc_createerr.cf_stat = RPC_CANTSEND;
|
||||
rpc_createerr.cf_error.re_errno = error;
|
||||
td->td_ucred = oldcred;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
newclient = clnt_vc_create(so,
|
||||
(struct sockaddr *) &rc->rc_addr, rc->rc_prog, rc->rc_vers,
|
||||
rc->rc_sendsz, rc->rc_recvsz, rc->rc_intr);
|
||||
}
|
||||
td->td_ucred = oldcred;
|
||||
|
||||
if (!newclient) {
|
||||
|
Loading…
Reference in New Issue
Block a user