aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/auth.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2009-09-15 13:32:13 -0400
committerJ. Bruce Fields <bfields@citi.umich.edu>2009-09-15 20:49:33 -0400
commit5d351754fcf58d1a604aa7cf95c2805e8a098ad9 (patch)
tree814bccfcfbb841ec0b2be76bbfbe1b8b6b355ff1 /net/sunrpc/auth.c
parent886e3b7fe6054230c89ae078a09565ed183ecc73 (diff)
SUNRPC: Defer the auth_gss upcall when the RPC call is asynchronous
Otherwise, the upcall is going to be synchronous, which may not be what the caller wants... Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'net/sunrpc/auth.c')
-rw-r--r--net/sunrpc/auth.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c
index 0c431c277af5..54a4e042f104 100644
--- a/net/sunrpc/auth.c
+++ b/net/sunrpc/auth.c
@@ -385,7 +385,7 @@ rpcauth_init_cred(struct rpc_cred *cred, const struct auth_cred *acred,
385EXPORT_SYMBOL_GPL(rpcauth_init_cred); 385EXPORT_SYMBOL_GPL(rpcauth_init_cred);
386 386
387void 387void
388rpcauth_generic_bind_cred(struct rpc_task *task, struct rpc_cred *cred) 388rpcauth_generic_bind_cred(struct rpc_task *task, struct rpc_cred *cred, int lookupflags)
389{ 389{
390 task->tk_msg.rpc_cred = get_rpccred(cred); 390 task->tk_msg.rpc_cred = get_rpccred(cred);
391 dprintk("RPC: %5u holding %s cred %p\n", task->tk_pid, 391 dprintk("RPC: %5u holding %s cred %p\n", task->tk_pid,
@@ -394,7 +394,7 @@ rpcauth_generic_bind_cred(struct rpc_task *task, struct rpc_cred *cred)
394EXPORT_SYMBOL_GPL(rpcauth_generic_bind_cred); 394EXPORT_SYMBOL_GPL(rpcauth_generic_bind_cred);
395 395
396static void 396static void
397rpcauth_bind_root_cred(struct rpc_task *task) 397rpcauth_bind_root_cred(struct rpc_task *task, int lookupflags)
398{ 398{
399 struct rpc_auth *auth = task->tk_client->cl_auth; 399 struct rpc_auth *auth = task->tk_client->cl_auth;
400 struct auth_cred acred = { 400 struct auth_cred acred = {
@@ -405,7 +405,7 @@ rpcauth_bind_root_cred(struct rpc_task *task)
405 405
406 dprintk("RPC: %5u looking up %s cred\n", 406 dprintk("RPC: %5u looking up %s cred\n",
407 task->tk_pid, task->tk_client->cl_auth->au_ops->au_name); 407 task->tk_pid, task->tk_client->cl_auth->au_ops->au_name);
408 ret = auth->au_ops->lookup_cred(auth, &acred, 0); 408 ret = auth->au_ops->lookup_cred(auth, &acred, lookupflags);
409 if (!IS_ERR(ret)) 409 if (!IS_ERR(ret))
410 task->tk_msg.rpc_cred = ret; 410 task->tk_msg.rpc_cred = ret;
411 else 411 else
@@ -413,14 +413,14 @@ rpcauth_bind_root_cred(struct rpc_task *task)
413} 413}
414 414
415static void 415static void
416rpcauth_bind_new_cred(struct rpc_task *task) 416rpcauth_bind_new_cred(struct rpc_task *task, int lookupflags)
417{ 417{
418 struct rpc_auth *auth = task->tk_client->cl_auth; 418 struct rpc_auth *auth = task->tk_client->cl_auth;
419 struct rpc_cred *ret; 419 struct rpc_cred *ret;
420 420
421 dprintk("RPC: %5u looking up %s cred\n", 421 dprintk("RPC: %5u looking up %s cred\n",
422 task->tk_pid, auth->au_ops->au_name); 422 task->tk_pid, auth->au_ops->au_name);
423 ret = rpcauth_lookupcred(auth, 0); 423 ret = rpcauth_lookupcred(auth, lookupflags);
424 if (!IS_ERR(ret)) 424 if (!IS_ERR(ret))
425 task->tk_msg.rpc_cred = ret; 425 task->tk_msg.rpc_cred = ret;
426 else 426 else
@@ -430,12 +430,16 @@ rpcauth_bind_new_cred(struct rpc_task *task)
430void 430void
431rpcauth_bindcred(struct rpc_task *task, struct rpc_cred *cred, int flags) 431rpcauth_bindcred(struct rpc_task *task, struct rpc_cred *cred, int flags)
432{ 432{
433 int lookupflags = 0;
434
435 if (flags & RPC_TASK_ASYNC)
436 lookupflags |= RPCAUTH_LOOKUP_NEW;
433 if (cred != NULL) 437 if (cred != NULL)
434 cred->cr_ops->crbind(task, cred); 438 cred->cr_ops->crbind(task, cred, lookupflags);
435 else if (flags & RPC_TASK_ROOTCREDS) 439 else if (flags & RPC_TASK_ROOTCREDS)
436 rpcauth_bind_root_cred(task); 440 rpcauth_bind_root_cred(task, lookupflags);
437 else 441 else
438 rpcauth_bind_new_cred(task); 442 rpcauth_bind_new_cred(task, lookupflags);
439} 443}
440 444
441void 445void