Linux Headquarters
[ Register ]
[ About us ] [ Home Page ]

Advertisement
[ Kernel ] [ Documentation ] [ Links ] [ Books ]

Advertisement

Kernel v2.4.1 /net/sunrpc/auth.c

Filename:/net/sunrpc/auth.c
Lines Added:15
Lines Deleted:5
Also changed in: (Previous) 2.4.1-pre12  2.4.1-pre11  2.4.0-test10  2.2.1-ac3  2.2.1-ac4  2.2.1-ac5 
(Following) 2.4.1-ac9  2.4.1-ac10  2.4.1-ac11  2.4.1-ac12  2.4.1-ac13  2.4.1-ac14 

Location
[  2.4.1
  [  net
    [  sunrpc
       o  auth.c

Patch

diff -u --recursive --new-file v2.4.0/linux/net/sunrpc/auth.c linux/net/sunrpc/auth.c
--- v2.4.0/linux/net/sunrpc/auth.c   Fri Oct 13 12:11:26 2000
+++ linux/net/sunrpc/auth.c   Tue Jan 23 15:22:24 2001
@@ -267,22 +267,26 @@
    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 @@
 {
    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;
 }


Comments: webmaster (at) linuxhq.com.
Advertising: banners (at) linuxhq.com.
Compilation ©1998-2008 Linux Headquarters, Inc.