aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/sunrpc/auth.h4
-rw-r--r--net/sunrpc/auth.c5
2 files changed, 6 insertions, 3 deletions
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h
index 7a69ca3bebaf..84d5f3a05b16 100644
--- a/include/linux/sunrpc/auth.h
+++ b/include/linux/sunrpc/auth.h
@@ -59,8 +59,8 @@ struct rpc_cred {
59/* 59/*
60 * Client authentication handle 60 * Client authentication handle
61 */ 61 */
62#define RPC_CREDCACHE_NR 8 62#define RPC_CREDCACHE_HASHBITS 4
63#define RPC_CREDCACHE_MASK (RPC_CREDCACHE_NR - 1) 63#define RPC_CREDCACHE_NR (1 << RPC_CREDCACHE_HASHBITS)
64struct rpc_cred_cache { 64struct rpc_cred_cache {
65 struct hlist_head hashtable[RPC_CREDCACHE_NR]; 65 struct hlist_head hashtable[RPC_CREDCACHE_NR];
66 spinlock_t lock; 66 spinlock_t lock;
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c
index eca941ce298b..b38f6ee2f5e2 100644
--- a/net/sunrpc/auth.c
+++ b/net/sunrpc/auth.c
@@ -11,6 +11,7 @@
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/slab.h> 12#include <linux/slab.h>
13#include <linux/errno.h> 13#include <linux/errno.h>
14#include <linux/hash.h>
14#include <linux/sunrpc/clnt.h> 15#include <linux/sunrpc/clnt.h>
15#include <linux/spinlock.h> 16#include <linux/spinlock.h>
16 17
@@ -280,7 +281,9 @@ rpcauth_lookup_credcache(struct rpc_auth *auth, struct auth_cred * acred,
280 struct hlist_node *pos; 281 struct hlist_node *pos;
281 struct rpc_cred *cred = NULL, 282 struct rpc_cred *cred = NULL,
282 *entry, *new; 283 *entry, *new;
283 int nr = 0; 284 unsigned int nr;
285
286 nr = hash_long(acred->uid, RPC_CREDCACHE_HASHBITS);
284 287
285 if (!(flags & RPCAUTH_LOOKUP_ROOTCREDS)) 288 if (!(flags & RPCAUTH_LOOKUP_ROOTCREDS))
286 nr = acred->uid & RPC_CREDCACHE_MASK; 289 nr = acred->uid & RPC_CREDCACHE_MASK;