aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfsd/nfs4callback.c26
-rw-r--r--fs/nfsd/nfs4state.c4
-rw-r--r--include/linux/nfsd/state.h1
3 files changed, 31 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
418static 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
418static int do_probe_callback(void *data) 434static 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);
453out:
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;
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 7e1fcc3aade4..b205c7d7bc6a 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -643,6 +643,10 @@ shutdown_callback_client(struct nfs4_client *clp)
643 clp->cl_callback.cb_client = NULL; 643 clp->cl_callback.cb_client = NULL;
644 rpc_shutdown_client(clnt); 644 rpc_shutdown_client(clnt);
645 } 645 }
646 if (clp->cl_callback.cb_cred) {
647 put_rpccred(clp->cl_callback.cb_cred);
648 clp->cl_callback.cb_cred = NULL;
649 }
646} 650}
647 651
648static inline void 652static inline void
diff --git a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h
index 4d61c873feed..8d882a3eb4b9 100644
--- a/include/linux/nfsd/state.h
+++ b/include/linux/nfsd/state.h
@@ -97,6 +97,7 @@ struct nfs4_callback {
97 /* RPC client info */ 97 /* RPC client info */
98 atomic_t cb_set; /* successful CB_NULL call */ 98 atomic_t cb_set; /* successful CB_NULL call */
99 struct rpc_clnt * cb_client; 99 struct rpc_clnt * cb_client;
100 struct rpc_cred * cb_cred;
100}; 101};
101 102
102/* Maximum number of slots per session. 128 is useful for long haul TCP */ 103/* Maximum number of slots per session. 128 is useful for long haul TCP */