diff options
author | J. Bruce Fields <bfields@citi.umich.edu> | 2009-02-23 13:45:27 -0500 |
---|---|---|
committer | J. Bruce Fields <bfields@citi.umich.edu> | 2009-04-29 16:44:47 -0400 |
commit | e1cab5a5896e142190cd66a8287099b52e5855a7 (patch) | |
tree | dbdf0c075a83b192a1e2e2d450cac65f720a4ec4 /fs | |
parent | 595947acaaef373445131471a78650003f5d8e7d (diff) |
nfsd4: set cb_client inside setup_callback_client
This is just a minor code simplification.
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfsd/nfs4callback.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c index 049f052a6eb3..4788d09d9bec 100644 --- a/fs/nfsd/nfs4callback.c +++ b/fs/nfsd/nfs4callback.c | |||
@@ -366,7 +366,7 @@ static int max_cb_time(void) | |||
366 | /* Reference counting, callback cleanup, etc., all look racy as heck. | 366 | /* Reference counting, callback cleanup, etc., all look racy as heck. |
367 | * And why is cb_set an atomic? */ | 367 | * And why is cb_set an atomic? */ |
368 | 368 | ||
369 | static struct rpc_clnt *setup_callback_client(struct nfs4_client *clp) | 369 | int setup_callback_client(struct nfs4_client *clp) |
370 | { | 370 | { |
371 | struct sockaddr_in addr; | 371 | struct sockaddr_in addr; |
372 | struct nfs4_callback *cb = &clp->cl_callback; | 372 | struct nfs4_callback *cb = &clp->cl_callback; |
@@ -389,7 +389,7 @@ static struct rpc_clnt *setup_callback_client(struct nfs4_client *clp) | |||
389 | struct rpc_clnt *client; | 389 | struct rpc_clnt *client; |
390 | 390 | ||
391 | if (!clp->cl_principal && (clp->cl_flavor >= RPC_AUTH_GSS_KRB5)) | 391 | if (!clp->cl_principal && (clp->cl_flavor >= RPC_AUTH_GSS_KRB5)) |
392 | return ERR_PTR(-EINVAL); | 392 | return -EINVAL; |
393 | 393 | ||
394 | /* Initialize address */ | 394 | /* Initialize address */ |
395 | memset(&addr, 0, sizeof(addr)); | 395 | memset(&addr, 0, sizeof(addr)); |
@@ -399,10 +399,13 @@ static struct rpc_clnt *setup_callback_client(struct nfs4_client *clp) | |||
399 | 399 | ||
400 | /* Create RPC client */ | 400 | /* Create RPC client */ |
401 | client = rpc_create(&args); | 401 | client = rpc_create(&args); |
402 | if (IS_ERR(client)) | 402 | if (IS_ERR(client)) { |
403 | dprintk("NFSD: couldn't create callback client: %ld\n", | 403 | dprintk("NFSD: couldn't create callback client: %ld\n", |
404 | PTR_ERR(client)); | 404 | PTR_ERR(client)); |
405 | return client; | 405 | return PTR_ERR(client); |
406 | } | ||
407 | cb->cb_client = client; | ||
408 | return 0; | ||
406 | 409 | ||
407 | } | 410 | } |
408 | 411 | ||
@@ -414,28 +417,23 @@ static int do_probe_callback(void *data) | |||
414 | .rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_NULL], | 417 | .rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_NULL], |
415 | .rpc_argp = clp, | 418 | .rpc_argp = clp, |
416 | }; | 419 | }; |
417 | struct rpc_clnt *client; | ||
418 | int status; | 420 | int status; |
419 | 421 | ||
420 | client = setup_callback_client(clp); | 422 | status = setup_callback_client(clp); |
421 | if (IS_ERR(client)) { | 423 | if (status) |
422 | status = PTR_ERR(client); | ||
423 | dprintk("NFSD: couldn't create callback client: %d\n", | ||
424 | status); | ||
425 | goto out_err; | 424 | goto out_err; |
426 | } | ||
427 | 425 | ||
428 | status = rpc_call_sync(client, &msg, RPC_TASK_SOFT); | 426 | status = rpc_call_sync(cb->cb_client, &msg, RPC_TASK_SOFT); |
429 | 427 | ||
430 | if (status) | 428 | if (status) |
431 | goto out_release_client; | 429 | goto out_release_client; |
432 | 430 | ||
433 | cb->cb_client = client; | ||
434 | atomic_set(&cb->cb_set, 1); | 431 | atomic_set(&cb->cb_set, 1); |
435 | put_nfs4_client(clp); | 432 | put_nfs4_client(clp); |
436 | return 0; | 433 | return 0; |
437 | out_release_client: | 434 | out_release_client: |
438 | rpc_shutdown_client(client); | 435 | rpc_shutdown_client(cb->cb_client); |
436 | cb->cb_client = NULL; | ||
439 | out_err: | 437 | out_err: |
440 | dprintk("NFSD: warning: no callback path to client %.*s: error %d\n", | 438 | dprintk("NFSD: warning: no callback path to client %.*s: error %d\n", |
441 | (int)clp->cl_name.len, clp->cl_name.data, status); | 439 | (int)clp->cl_name.len, clp->cl_name.data, status); |