summaryrefslogtreecommitdiffstats
path: root/net/sunrpc/auth.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2001-01-31 22:22:27 +0000
committerRalf Baechle <ralf@linux-mips.org>2001-01-31 22:22:27 +0000
commit825423e4c4f18289df2393951cfd2a7a31fc0464 (patch)
tree4ad80e981c3d9effa910d2247d118d254f9a5d09 /net/sunrpc/auth.c
parentc4693dc4856ab907a5c02187a8d398861bebfc7e (diff)
Merge with Linux 2.4.1.
Diffstat (limited to 'net/sunrpc/auth.c')
-rw-r--r--net/sunrpc/auth.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c
index a295ecaf7..a6af993c8 100644
--- a/net/sunrpc/auth.c
+++ b/net/sunrpc/auth.c
@@ -267,22 +267,26 @@ 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) {
+ spin_lock(&rpc_credcache_lock);
task->tk_msg.rpc_cred->cr_count++;
task->tk_msg.rpc_cred->cr_expire = jiffies + task->tk_auth->au_expire;
+ spin_unlock(&rpc_credcache_lock);
}
}
void
rpcauth_releasecred(struct rpc_auth *auth, struct rpc_cred *cred)
{
+ spin_lock(&rpc_credcache_lock);
if (cred != NULL && cred->cr_count > 0) {
- cred->cr_count--;
- if (cred->cr_flags & RPCAUTH_CRED_DEAD) {
+ if (!--cred->cr_count && (cred->cr_flags & RPCAUTH_CRED_DEAD)) {
+ spin_unlock(&rpc_credcache_lock);
rpcauth_remove_credcache(auth, cred);
- if (!cred->cr_count)
- rpcauth_crdestroy(auth, cred);
+ rpcauth_crdestroy(auth, cred);
+ return;
}
}
+ spin_unlock(&rpc_credcache_lock);
}
void
@@ -335,13 +339,19 @@ rpcauth_invalcred(struct rpc_task *task)
{
dprintk("RPC: %4d invalidating %s cred %p\n",
task->tk_pid, task->tk_auth->au_ops->au_name, task->tk_msg.rpc_cred);
+ spin_lock(&rpc_credcache_lock);
if (task->tk_msg.rpc_cred)
task->tk_msg.rpc_cred->cr_flags &= ~RPCAUTH_CRED_UPTODATE;
+ spin_unlock(&rpc_credcache_lock);
}
int
rpcauth_uptodatecred(struct rpc_task *task)
{
- return !(task->tk_msg.rpc_cred) ||
+ int retval;
+ spin_lock(&rpc_credcache_lock);
+ retval = !(task->tk_msg.rpc_cred) ||
(task->tk_msg.rpc_cred->cr_flags & RPCAUTH_CRED_UPTODATE);
+ spin_unlock(&rpc_credcache_lock);
+ return retval;
}