aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4callback.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfsd/nfs4callback.c')
-rw-r--r--fs/nfsd/nfs4callback.c33
1 files changed, 10 insertions, 23 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