Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 34789
b: refs/heads/master
c: ae5c794
h: refs/heads/master
i:
  34787: 58f8590
v: v3
  • Loading branch information
Chuck Lever authored and Trond Myklebust committed Sep 23, 2006
1 parent fc3c0c0 commit fc0f1e4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 40 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 41877d207c46f050b709f452703ade20c3b4a096
refs/heads/master: ae5c79476f36512d1100e162606bb5691f2cce5a
66 changes: 27 additions & 39 deletions trunk/fs/nfsd/nfs4callback.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,16 +375,28 @@ nfsd4_probe_callback(struct nfs4_client *clp)
{
struct sockaddr_in addr;
struct nfs4_callback *cb = &clp->cl_callback;
struct rpc_timeout timeparms;
struct rpc_xprt * xprt;
struct rpc_timeout timeparms = {
.to_initval = (NFSD_LEASE_TIME/4) * HZ,
.to_retries = 5,
.to_maxval = (NFSD_LEASE_TIME/2) * HZ,
.to_exponential = 1,
};
struct rpc_program * program = &cb->cb_program;
struct rpc_stat * stat = &cb->cb_stat;
struct rpc_clnt * clnt;
struct rpc_create_args args = {
.protocol = IPPROTO_TCP,
.address = (struct sockaddr *)&addr,
.addrsize = sizeof(addr),
.timeout = &timeparms,
.servername = clp->cl_name.data,
.program = program,
.version = nfs_cb_version[1]->number,
.authflavor = RPC_AUTH_UNIX, /* XXX: need AUTH_GSS... */
.flags = (RPC_CLNT_CREATE_NOPING),
};
struct rpc_message msg = {
.rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_NULL],
.rpc_argp = clp,
};
char hostname[32];
int status;

if (atomic_read(&cb->cb_set))
Expand All @@ -396,59 +408,35 @@ nfsd4_probe_callback(struct nfs4_client *clp)
addr.sin_port = htons(cb->cb_port);
addr.sin_addr.s_addr = htonl(cb->cb_addr);

/* Initialize timeout */
timeparms.to_initval = (NFSD_LEASE_TIME/4) * HZ;
timeparms.to_retries = 0;
timeparms.to_maxval = (NFSD_LEASE_TIME/2) * HZ;
timeparms.to_exponential = 1;

/* Create RPC transport */
xprt = xprt_create_proto(IPPROTO_TCP, &addr, &timeparms);
if (IS_ERR(xprt)) {
dprintk("NFSD: couldn't create callback transport!\n");
goto out_err;
}

/* Initialize rpc_program */
program->name = "nfs4_cb";
program->number = cb->cb_prog;
program->nrvers = ARRAY_SIZE(nfs_cb_version);
program->version = nfs_cb_version;
program->stats = stat;
program->stats = &cb->cb_stat;

/* Initialize rpc_stat */
memset(stat, 0, sizeof(struct rpc_stat));
stat->program = program;

/* Create RPC client
*
* XXX AUTH_UNIX only - need AUTH_GSS....
*/
sprintf(hostname, "%u.%u.%u.%u", NIPQUAD(addr.sin_addr.s_addr));
clnt = rpc_new_client(xprt, hostname, program, 1, RPC_AUTH_UNIX);
if (IS_ERR(clnt)) {
memset(program->stats, 0, sizeof(cb->cb_stat));
program->stats->program = program;

/* Create RPC client */
cb->cb_client = rpc_create(&args);
if (!cb->cb_client) {
dprintk("NFSD: couldn't create callback client\n");
goto out_err;
}
clnt->cl_intr = 0;
clnt->cl_softrtry = 1;

/* Kick rpciod, put the call on the wire. */

if (rpciod_up() != 0) {
dprintk("nfsd: couldn't start rpciod for callbacks!\n");
if (rpciod_up() != 0)
goto out_clnt;
}

cb->cb_client = clnt;

/* the task holds a reference to the nfs4_client struct */
atomic_inc(&clp->cl_count);

msg.rpc_cred = nfsd4_lookupcred(clp,0);
if (IS_ERR(msg.rpc_cred))
goto out_rpciod;
status = rpc_call_async(clnt, &msg, RPC_TASK_ASYNC, &nfs4_cb_null_ops, NULL);
status = rpc_call_async(cb->cb_client, &msg, RPC_TASK_ASYNC, &nfs4_cb_null_ops, NULL);
put_rpccred(msg.rpc_cred);

if (status != 0) {
Expand All @@ -462,7 +450,7 @@ nfsd4_probe_callback(struct nfs4_client *clp)
rpciod_down();
cb->cb_client = NULL;
out_clnt:
rpc_shutdown_client(clnt);
rpc_shutdown_client(cb->cb_client);
out_err:
dprintk("NFSD: warning: no callback path to client %.*s\n",
(int)clp->cl_name.len, clp->cl_name.data);
Expand Down

0 comments on commit fc0f1e4

Please sign in to comment.