aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@citi.umich.edu>2009-09-15 18:07:35 -0400
committerJ. Bruce Fields <bfields@citi.umich.edu>2009-09-15 20:49:34 -0400
commit80fc015bdfe1f5b870c1e1ee02d78e709523fee7 (patch)
treef56fd466add111a4c6bcc29d127325e3e77b4669 /fs/nfsd
parent29ab23cc5d351658d01a4327d55e9106a73fd04f (diff)
nfsd4: use common rpc_cred for all callbacks
Callbacks are always made using the machine's identity, so we can use a single auth_generic credential shared among callbacks to all clients and let the rpc code take care of the rest. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'fs/nfsd')
-rw-r--r--fs/nfsd/nfs4callback.c33
-rw-r--r--fs/nfsd/nfs4state.c6
2 files changed, 11 insertions, 28 deletions
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index 4abb88264c72..128519769ea8 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -432,42 +432,29 @@ static const struct rpc_call_ops nfsd4_cb_probe_ops = {
432 .rpc_call_done = nfsd4_cb_probe_done, 432 .rpc_call_done = nfsd4_cb_probe_done,
433}; 433};
434 434
435static struct rpc_cred *lookup_cb_cred(struct nfs4_cb_conn *cb) 435static struct rpc_cred *callback_cred;
436
437int set_callback_cred(void)
436{ 438{
437 struct auth_cred acred = { 439 callback_cred = rpc_lookup_machine_cred();
438 .machine_cred = 1 440 if (!callback_cred)
439 }; 441 return -ENOMEM;
440 struct rpc_auth *auth = cb->cb_client->cl_auth; 442 return 0;
441
442 /*
443 * Note in the gss case this doesn't actually have to wait for a
444 * gss upcall (or any calls to the client); this just creates a
445 * non-uptodate cred which the rpc state machine will fill in with
446 * a refresh_upcall later.
447 */
448 return auth->au_ops->lookup_cred(auth, &acred, RPCAUTH_LOOKUP_NEW);
449} 443}
450 444
445
451void do_probe_callback(struct nfs4_client *clp) 446void do_probe_callback(struct nfs4_client *clp)
452{ 447{
453 struct nfs4_cb_conn *cb = &clp->cl_cb_conn; 448 struct nfs4_cb_conn *cb = &clp->cl_cb_conn;
454 struct rpc_message msg = { 449 struct rpc_message msg = {
455 .rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_NULL], 450 .rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_NULL],
456 .rpc_argp = clp, 451 .rpc_argp = clp,
452 .rpc_cred = callback_cred
457 }; 453 };
458 struct rpc_cred *cred;
459 int status; 454 int status;
460 455
461 cred = lookup_cb_cred(cb);
462 if (IS_ERR(cred)) {
463 status = PTR_ERR(cred);
464 goto out;
465 }
466 cb->cb_cred = cred;
467 msg.rpc_cred = cb->cb_cred;
468 status = rpc_call_async(cb->cb_client, &msg, RPC_TASK_SOFT, 456 status = rpc_call_async(cb->cb_client, &msg, RPC_TASK_SOFT,
469 &nfsd4_cb_probe_ops, (void *)clp); 457 &nfsd4_cb_probe_ops, (void *)clp);
470out:
471 if (status) { 458 if (status) {
472 warn_no_callback_path(clp, status); 459 warn_no_callback_path(clp, status);
473 put_nfs4_client(clp); 460 put_nfs4_client(clp);
@@ -550,7 +537,7 @@ nfsd4_cb_recall(struct nfs4_delegation *dp)
550 struct rpc_message msg = { 537 struct rpc_message msg = {
551 .rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_RECALL], 538 .rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_RECALL],
552 .rpc_argp = dp, 539 .rpc_argp = dp,
553 .rpc_cred = clp->cl_cb_conn.cb_cred 540 .rpc_cred = callback_cred
554 }; 541 };
555 int status; 542 int status;
556 543
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 11db40cb2f2b..0445192d660d 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -696,10 +696,6 @@ shutdown_callback_client(struct nfs4_client *clp)
696 clp->cl_cb_conn.cb_client = NULL; 696 clp->cl_cb_conn.cb_client = NULL;
697 rpc_shutdown_client(clnt); 697 rpc_shutdown_client(clnt);
698 } 698 }
699 if (clp->cl_cb_conn.cb_cred) {
700 put_rpccred(clp->cl_cb_conn.cb_cred);
701 clp->cl_cb_conn.cb_cred = NULL;
702 }
703} 699}
704 700
705static inline void 701static inline void
@@ -4020,7 +4016,7 @@ __nfs4_state_start(void)
4020 return -ENOMEM; 4016 return -ENOMEM;
4021 queue_delayed_work(laundry_wq, &laundromat_work, grace_time); 4017 queue_delayed_work(laundry_wq, &laundromat_work, grace_time);
4022 set_max_delegations(); 4018 set_max_delegations();
4023 return 0; 4019 return set_callback_cred();
4024} 4020}
4025 4021
4026int 4022int