Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Trond Myklebust and committed by
J. Bruce Fields
5d351754 886e3b7f

+16 -12
+2 -2
include/linux/sunrpc/auth.h
··· 111 111 void (*crdestroy)(struct rpc_cred *); 112 112 113 113 int (*crmatch)(struct auth_cred *, struct rpc_cred *, int); 114 - void (*crbind)(struct rpc_task *, struct rpc_cred *); 114 + void (*crbind)(struct rpc_task *, struct rpc_cred *, int); 115 115 __be32 * (*crmarshal)(struct rpc_task *, __be32 *); 116 116 int (*crrefresh)(struct rpc_task *); 117 117 __be32 * (*crvalidate)(struct rpc_task *, __be32 *); ··· 140 140 void rpcauth_init_cred(struct rpc_cred *, const struct auth_cred *, struct rpc_auth *, const struct rpc_credops *); 141 141 struct rpc_cred * rpcauth_lookupcred(struct rpc_auth *, int); 142 142 void rpcauth_bindcred(struct rpc_task *, struct rpc_cred *, int); 143 - void rpcauth_generic_bind_cred(struct rpc_task *, struct rpc_cred *); 143 + void rpcauth_generic_bind_cred(struct rpc_task *, struct rpc_cred *, int); 144 144 void put_rpccred(struct rpc_cred *); 145 145 void rpcauth_unbindcred(struct rpc_task *); 146 146 __be32 * rpcauth_marshcred(struct rpc_task *, __be32 *);
+12 -8
net/sunrpc/auth.c
··· 385 385 EXPORT_SYMBOL_GPL(rpcauth_init_cred); 386 386 387 387 void 388 - rpcauth_generic_bind_cred(struct rpc_task *task, struct rpc_cred *cred) 388 + rpcauth_generic_bind_cred(struct rpc_task *task, struct rpc_cred *cred, int lookupflags) 389 389 { 390 390 task->tk_msg.rpc_cred = get_rpccred(cred); 391 391 dprintk("RPC: %5u holding %s cred %p\n", task->tk_pid, ··· 394 394 EXPORT_SYMBOL_GPL(rpcauth_generic_bind_cred); 395 395 396 396 static void 397 - rpcauth_bind_root_cred(struct rpc_task *task) 397 + rpcauth_bind_root_cred(struct rpc_task *task, int lookupflags) 398 398 { 399 399 struct rpc_auth *auth = task->tk_client->cl_auth; 400 400 struct auth_cred acred = { ··· 405 405 406 406 dprintk("RPC: %5u looking up %s cred\n", 407 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 409 if (!IS_ERR(ret)) 410 410 task->tk_msg.rpc_cred = ret; 411 411 else ··· 413 413 } 414 414 415 415 static void 416 - rpcauth_bind_new_cred(struct rpc_task *task) 416 + rpcauth_bind_new_cred(struct rpc_task *task, int lookupflags) 417 417 { 418 418 struct rpc_auth *auth = task->tk_client->cl_auth; 419 419 struct rpc_cred *ret; 420 420 421 421 dprintk("RPC: %5u looking up %s cred\n", 422 422 task->tk_pid, auth->au_ops->au_name); 423 - ret = rpcauth_lookupcred(auth, 0); 423 + ret = rpcauth_lookupcred(auth, lookupflags); 424 424 if (!IS_ERR(ret)) 425 425 task->tk_msg.rpc_cred = ret; 426 426 else ··· 430 430 void 431 431 rpcauth_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 437 if (cred != NULL) 434 - cred->cr_ops->crbind(task, cred); 438 + cred->cr_ops->crbind(task, cred, lookupflags); 435 439 else if (flags & RPC_TASK_ROOTCREDS) 436 - rpcauth_bind_root_cred(task); 440 + rpcauth_bind_root_cred(task, lookupflags); 437 441 else 438 - rpcauth_bind_new_cred(task); 442 + rpcauth_bind_new_cred(task, lookupflags); 439 443 } 440 444 441 445 void
+2 -2
net/sunrpc/auth_generic.c
··· 55 55 EXPORT_SYMBOL_GPL(rpc_lookup_machine_cred); 56 56 57 57 static void 58 - generic_bind_cred(struct rpc_task *task, struct rpc_cred *cred) 58 + generic_bind_cred(struct rpc_task *task, struct rpc_cred *cred, int lookupflags) 59 59 { 60 60 struct rpc_auth *auth = task->tk_client->cl_auth; 61 61 struct auth_cred *acred = &container_of(cred, struct generic_cred, gc_base)->acred; 62 62 struct rpc_cred *ret; 63 63 64 - ret = auth->au_ops->lookup_cred(auth, acred, 0); 64 + ret = auth->au_ops->lookup_cred(auth, acred, lookupflags); 65 65 if (!IS_ERR(ret)) 66 66 task->tk_msg.rpc_cred = ret; 67 67 else