--- ./include/linux/sunrpc/auth.h.orig 2005-02-07 21:38:57.000000000 +0100 +++ ./include/linux/sunrpc/auth.h 2005-02-07 21:47:44.000000000 +0100 @@ -119,10 +119,7 @@ void rpcauth_destroy(struct rpc_auth *); struct rpc_cred * rpcauth_lookup_credcache(struct rpc_auth *, struct auth_cred *, int); struct rpc_cred * rpcauth_lookupcred(struct rpc_auth *, int); -struct rpc_cred * rpcauth_bindcred(struct rpc_task *); -void rpcauth_holdcred(struct rpc_task *); void put_rpccred(struct rpc_cred *); -void rpcauth_unbindcred(struct rpc_task *); u32 * rpcauth_marshcred(struct rpc_task *, u32 *); u32 * rpcauth_checkverf(struct rpc_task *, u32 *); int rpcauth_wrap_req(struct rpc_task *task, kxdrproc_t encode, void *rqstp, u32 *data, void *obj); --- ./net/sunrpc/auth.c.orig 2005-02-07 21:38:57.000000000 +0100 +++ ./net/sunrpc/auth.c 2005-02-07 21:47:44.000000000 +0100 @@ -268,37 +268,6 @@ return ret; } -struct rpc_cred * -rpcauth_bindcred(struct rpc_task *task) -{ - struct rpc_auth *auth = task->tk_auth; - struct auth_cred acred; - struct rpc_cred *ret; - - get_group_info(current->group_info); - acred.uid = current->fsuid; - acred.gid = current->fsgid; - acred.group_info = current->group_info; - - dprintk("RPC: %4d looking up %s cred\n", - task->tk_pid, task->tk_auth->au_ops->au_name); - task->tk_msg.rpc_cred = rpcauth_lookup_credcache(auth, &acred, task->tk_flags); - if (task->tk_msg.rpc_cred == 0) - task->tk_status = -ENOMEM; - ret = task->tk_msg.rpc_cred; - put_group_info(current->group_info); - return ret; -} - -void -rpcauth_holdcred(struct rpc_task *task) -{ - dprintk("RPC: %4d holding %s cred %p\n", - task->tk_pid, task->tk_auth->au_ops->au_name, task->tk_msg.rpc_cred); - if (task->tk_msg.rpc_cred) - get_rpccred(task->tk_msg.rpc_cred); -} - void put_rpccred(struct rpc_cred *cred) { @@ -314,19 +283,6 @@ spin_unlock(&rpc_credcache_lock); } -void -rpcauth_unbindcred(struct rpc_task *task) -{ - struct rpc_auth *auth = task->tk_auth; - struct rpc_cred *cred = task->tk_msg.rpc_cred; - - dprintk("RPC: %4d releasing %s cred %p\n", - task->tk_pid, auth->au_ops->au_name, cred); - - put_rpccred(cred); - task->tk_msg.rpc_cred = NULL; -} - u32 * rpcauth_marshcred(struct rpc_task *task, u32 *p) { --- ./net/sunrpc/clnt.c.orig 2005-02-07 21:38:57.000000000 +0100 +++ ./net/sunrpc/clnt.c 2005-02-07 21:47:44.000000000 +0100 @@ -425,11 +425,15 @@ { task->tk_msg = *msg; task->tk_flags |= flags; - /* Bind the user cred */ - if (task->tk_msg.rpc_cred != NULL) { - rpcauth_holdcred(task); - } else - rpcauth_bindcred(task); + + if (task->tk_msg.rpc_cred) { + /* we copied msg->rpc_cred, hold it */ + get_rpccred(task->tk_msg.rpc_cred); + } else { + task->tk_msg.rpc_cred = rpcauth_lookupcred(task->tk_auth, task->tk_flags); + if (task->tk_msg.rpc_cred == NULL) + task->tk_status = -ENOMEM; + } if (task->tk_status == 0) task->tk_action = call_start; --- ./net/sunrpc/sched.c.orig 2005-02-07 21:38:58.000000000 +0100 +++ ./net/sunrpc/sched.c 2005-02-07 21:47:44.000000000 +0100 @@ -851,8 +851,10 @@ /* Release resources */ if (task->tk_rqstp) xprt_release(task); - if (task->tk_msg.rpc_cred) - rpcauth_unbindcred(task); + if (task->tk_msg.rpc_cred) { + put_rpccred(task->tk_msg.rpc_cred); + task->tk_msg.rpc_cred = NULL; + } rpc_free(task); if (task->tk_client) { rpc_release_client(task->tk_client);