patch-2.3.22 linux/net/sunrpc/auth.c
Next file: linux/net/sunrpc/sched.c
Previous file: linux/net/sched/Config.in
Back to the patch index
Back to the overall index
- Lines: 94
- Date:
Fri Oct 15 08:45:36 1999
- Orig file:
v2.3.21/linux/net/sunrpc/auth.c
- Orig date:
Tue Jun 1 23:25:48 1999
diff -u --recursive --new-file v2.3.21/linux/net/sunrpc/auth.c linux/net/sunrpc/auth.c
@@ -15,6 +15,7 @@
#include <linux/errno.h>
#include <linux/socket.h>
#include <linux/sunrpc/clnt.h>
+#include <linux/spinlock.h>
#ifdef RPC_DEBUG
# define RPCDBG_FACILITY RPCDBG_AUTH
@@ -71,6 +72,8 @@
auth->au_ops->destroy(auth);
}
+spinlock_t rpc_credcache_lock = SPIN_LOCK_UNLOCKED;
+
/*
* Initialize RPC credential cache
*/
@@ -94,6 +97,7 @@
if (!(destroy = auth->au_ops->crdestroy))
destroy = (void (*)(struct rpc_cred *)) rpc_free;
+ spin_lock(&rpc_credcache_lock);
for (i = 0; i < RPC_CREDCACHE_NR; i++) {
q = &auth->au_credcache[i];
while ((cred = *q) != NULL) {
@@ -101,6 +105,7 @@
destroy(cred);
}
}
+ spin_unlock(&rpc_credcache_lock);
}
/*
@@ -113,6 +118,7 @@
int i, safe = 0;
dprintk("RPC: gc'ing RPC credentials for auth %p\n", auth);
+ spin_lock(&rpc_credcache_lock);
for (i = 0; i < RPC_CREDCACHE_NR; i++) {
q = &auth->au_credcache[i];
while ((cred = *q) != NULL) {
@@ -129,6 +135,7 @@
q = &cred->cr_next;
}
}
+ spin_unlock(&rpc_credcache_lock);
while ((cred = free) != NULL) {
free = cred->cr_next;
rpc_free(cred);
@@ -145,10 +152,12 @@
int nr;
nr = (cred->cr_uid % RPC_CREDCACHE_NR);
+ spin_lock(&rpc_credcache_lock);
cred->cr_next = auth->au_credcache[nr];
auth->au_credcache[nr] = cred;
cred->cr_expire = jiffies + auth->au_expire;
cred->cr_count++;
+ spin_unlock(&rpc_credcache_lock);
}
/*
@@ -166,6 +175,7 @@
if (time_before(auth->au_nextgc, jiffies))
rpcauth_gc_credcache(auth);
+ spin_lock(&rpc_credcache_lock);
q = &auth->au_credcache[nr];
while ((cred = *q) != NULL) {
if (auth->au_ops->crmatch(task, cred)) {
@@ -174,6 +184,7 @@
}
q = &cred->cr_next;
}
+ spin_unlock(&rpc_credcache_lock);
if (!cred)
cred = auth->au_ops->crcreate(task);
@@ -194,6 +205,7 @@
int nr;
nr = (cred->cr_uid % RPC_CREDCACHE_NR);
+ spin_lock(&rpc_credcache_lock);
q = &auth->au_credcache[nr];
while ((cr = *q) != NULL) {
if (cred == cr) {
@@ -202,6 +214,7 @@
}
q = &cred->cr_next;
}
+ spin_unlock(&rpc_credcache_lock);
}
struct rpc_cred *
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)