]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
SUNRPC: Fix a bug in rpcauth_lookup_credcache()
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Wed, 12 Mar 2008 18:40:14 +0000 (14:40 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Fri, 14 Mar 2008 17:42:29 +0000 (13:42 -0400)
The hash bucket is for some reason always being set to zero.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
include/linux/sunrpc/auth.h
net/sunrpc/auth.c

index 7a69ca3bebaf8cc33fcd1542d7a8e900774f50aa..84d5f3a05b16abc1d769a8ebad3d28af3be02f7e 100644 (file)
@@ -59,8 +59,8 @@ struct rpc_cred {
 /*
  * Client authentication handle
  */
-#define RPC_CREDCACHE_NR       8
-#define RPC_CREDCACHE_MASK     (RPC_CREDCACHE_NR - 1)
+#define RPC_CREDCACHE_HASHBITS 4
+#define RPC_CREDCACHE_NR       (1 << RPC_CREDCACHE_HASHBITS)
 struct rpc_cred_cache {
        struct hlist_head       hashtable[RPC_CREDCACHE_NR];
        spinlock_t              lock;
index eca941ce298b6465507c2f672dc5bf44350fffe6..b38f6ee2f5e22499d91a8f7e9d436b78077b9184 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/errno.h>
+#include <linux/hash.h>
 #include <linux/sunrpc/clnt.h>
 #include <linux/spinlock.h>
 
@@ -280,7 +281,9 @@ rpcauth_lookup_credcache(struct rpc_auth *auth, struct auth_cred * acred,
        struct hlist_node *pos;
        struct rpc_cred *cred = NULL,
                        *entry, *new;
-       int             nr = 0;
+       unsigned int nr;
+
+       nr = hash_long(acred->uid, RPC_CREDCACHE_HASHBITS);
 
        if (!(flags & RPCAUTH_LOOKUP_ROOTCREDS))
                nr = acred->uid & RPC_CREDCACHE_MASK;