Deleted Added
full compact
29c29
< __FBSDID("$FreeBSD: head/sys/rpc/clnt_rc.c 178112 2008-04-11 10:34:59Z dfr $");
---
> __FBSDID("$FreeBSD: head/sys/rpc/clnt_rc.c 180025 2008-06-26 10:21:54Z dfr $");
32a33
> #include <sys/limits.h>
47,48c48,49
< static enum clnt_stat clnt_reconnect_call(CLIENT *, rpcproc_t,
< xdrproc_t, void *, xdrproc_t, void *, struct timeval);
---
> static enum clnt_stat clnt_reconnect_call(CLIENT *, struct rpc_callextra *,
> rpcproc_t, xdrproc_t, void *, xdrproc_t, void *, struct timeval);
64a66
> struct mtx rc_lock;
72a75
> int rc_retries;
74a78
> int rc_connecting;
96a101
> mtx_init(&rc->rc_lock, "rc->rc_lock", NULL, MTX_DEF);
105c110
< rc->rc_retry.tv_sec = 15;
---
> rc->rc_retry.tv_sec = 3;
106a112
> rc->rc_retries = INT_MAX;
108a115
> rc->rc_connecting = FALSE;
110a118
> cl->cl_refs = 1;
123a132,133
> enum clnt_stat stat;
> int error;
125a136,159
> mtx_lock(&rc->rc_lock);
> again:
> if (rc->rc_connecting) {
> while (!rc->rc_client) {
> error = msleep(rc, &rc->rc_lock,
> rc->rc_intr ? PCATCH : 0, "rpcrecon", 0);
> if (error) {
> mtx_unlock(&rc->rc_lock);
> return (RPC_INTR);
> }
> }
> /*
> * If the other guy failed to connect, we might as
> * well have another go.
> */
> if (!rc->rc_client && !rc->rc_connecting)
> goto again;
> mtx_unlock(&rc->rc_lock);
> return (RPC_SUCCESS);
> } else {
> rc->rc_connecting = TRUE;
> }
> mtx_unlock(&rc->rc_lock);
>
128c162
< rpc_createerr.cf_stat = RPC_TLIERROR;
---
> stat = rpc_createerr.cf_stat = RPC_TLIERROR;
130c164
< return (RPC_TLIERROR);
---
> goto out;
142,143c176,179
< if (!rc->rc_client)
< return (rpc_createerr.cf_stat);
---
> if (!rc->rc_client) {
> stat = rpc_createerr.cf_stat;
> goto out;
> }
150a187
> stat = RPC_SUCCESS;
152c189,195
< return (RPC_SUCCESS);
---
> out:
> mtx_lock(&rc->rc_lock);
> rc->rc_connecting = FALSE;
> wakeup(rc);
> mtx_unlock(&rc->rc_lock);
>
> return (stat);
157c200,201
< CLIENT *cl, /* client handle */
---
> CLIENT *cl, /* client handle */
> struct rpc_callextra *ext, /* call metadata */
165a210
> CLIENT *client;
166a212
> int tries;
167a214
> tries = 0;
175c222,226
< stat = CLNT_CALL(rc->rc_client, proc, xargs, argsp,
---
> mtx_lock(&rc->rc_lock);
> CLNT_ACQUIRE(rc->rc_client);
> client = rc->rc_client;
> mtx_unlock(&rc->rc_lock);
> stat = CLNT_CALL_EXT(client, ext, proc, xargs, argsp,
177a229
> CLNT_RELEASE(client);
187c239
< && utimeout.tv_usec == 0))
---
> && utimeout.tv_usec == 0)) {
188a241
> }
195,196c248,265
< CLNT_DESTROY(rc->rc_client);
< rc->rc_client = NULL;
---
> tries++;
> if (tries >= rc->rc_retries)
> break;
>
> if (ext && ext->rc_feedback)
> ext->rc_feedback(FEEDBACK_RECONNECT, proc,
> ext->rc_feedback_arg);
>
> mtx_lock(&rc->rc_lock);
> /*
> * Make sure that someone else hasn't already
> * reconnected.
> */
> if (rc->rc_client == client) {
> CLNT_RELEASE(rc->rc_client);
> rc->rc_client = NULL;
> }
> mtx_unlock(&rc->rc_lock);
296a366,373
> case CLSET_RETRIES:
> rc->rc_retries = *(int *) info;
> break;
>
> case CLGET_RETRIES:
> *(int *) info = rc->rc_retries;
> break;
>