diff options
author | J. Bruce Fields <bfields@citi.umich.edu> | 2009-02-24 00:42:10 -0500 |
---|---|---|
committer | J. Bruce Fields <bfields@citi.umich.edu> | 2009-04-29 16:45:03 -0400 |
commit | 3cef9ab266a932899e756f7e1ea7a988a97bf3b2 (patch) | |
tree | a1fff617c936214a9e95bdec760904a28859126b /fs/nfsd/nfs4callback.c | |
parent | ecdd03b7914c91ef849e49c4d466c87f4981b5cd (diff) |
nfsd4: lookup up callback cred only once
Lookup the callback cred once and then use it for all subsequent
callbacks.
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'fs/nfsd/nfs4callback.c')
-rw-r--r-- | fs/nfsd/nfs4callback.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c index 711c6282151f..cc10ed35ac81 100644 --- a/fs/nfsd/nfs4callback.c +++ b/fs/nfsd/nfs4callback.c | |||
@@ -415,6 +415,22 @@ static void warn_no_callback_path(struct nfs4_client *clp, int reason) | |||
415 | (int)clp->cl_name.len, clp->cl_name.data, reason); | 415 | (int)clp->cl_name.len, clp->cl_name.data, reason); |
416 | } | 416 | } |
417 | 417 | ||
418 | static struct rpc_cred *lookup_cb_cred(struct nfs4_callback *cb) | ||
419 | { | ||
420 | struct auth_cred acred = { | ||
421 | .machine_cred = 1 | ||
422 | }; | ||
423 | |||
424 | /* | ||
425 | * Note in the gss case this doesn't actually have to wait for a | ||
426 | * gss upcall (or any calls to the client); this just creates a | ||
427 | * non-uptodate cred which the rpc state machine will fill in with | ||
428 | * a refresh_upcall later. | ||
429 | */ | ||
430 | return rpcauth_lookup_credcache(cb->cb_client->cl_auth, &acred, | ||
431 | RPCAUTH_LOOKUP_NEW); | ||
432 | } | ||
433 | |||
418 | static int do_probe_callback(void *data) | 434 | static int do_probe_callback(void *data) |
419 | { | 435 | { |
420 | struct nfs4_client *clp = data; | 436 | struct nfs4_client *clp = data; |
@@ -423,9 +439,18 @@ static int do_probe_callback(void *data) | |||
423 | .rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_NULL], | 439 | .rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_NULL], |
424 | .rpc_argp = clp, | 440 | .rpc_argp = clp, |
425 | }; | 441 | }; |
442 | struct rpc_cred *cred; | ||
426 | int status; | 443 | int status; |
427 | 444 | ||
445 | cred = lookup_cb_cred(cb); | ||
446 | if (IS_ERR(cred)) { | ||
447 | status = PTR_ERR(cred); | ||
448 | goto out; | ||
449 | } | ||
450 | cb->cb_cred = cred; | ||
451 | msg.rpc_cred = cb->cb_cred; | ||
428 | status = rpc_call_sync(cb->cb_client, &msg, RPC_TASK_SOFT); | 452 | status = rpc_call_sync(cb->cb_client, &msg, RPC_TASK_SOFT); |
453 | out: | ||
429 | if (status) | 454 | if (status) |
430 | warn_no_callback_path(clp, status); | 455 | warn_no_callback_path(clp, status); |
431 | else | 456 | else |
@@ -475,6 +500,7 @@ nfsd4_cb_recall(struct nfs4_delegation *dp) | |||
475 | struct rpc_message msg = { | 500 | struct rpc_message msg = { |
476 | .rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_RECALL], | 501 | .rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_RECALL], |
477 | .rpc_argp = cbr, | 502 | .rpc_argp = cbr, |
503 | .rpc_cred = clp->cl_callback.cb_cred | ||
478 | }; | 504 | }; |
479 | int retries = 1; | 505 | int retries = 1; |
480 | int status = 0; | 506 | int status = 0; |