Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 206407
b: refs/heads/master
c: 988664a
h: refs/heads/master
i:
  206405: 7b19500
  206403: 601e630
  206399: 38c7e9f
v: v3
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed Aug 4, 2010
1 parent 5d4a34a commit fdd4c50
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5d8d9a4d9ff74c55901642b4e2ac5124830ddafe
refs/heads/master: 988664a0f6bbfc356e6ce55f7a87b8594050012f
1 change: 1 addition & 0 deletions trunk/include/linux/sunrpc/auth.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ struct rpc_cred {
#define RPC_CREDCACHE_NR (1 << RPC_CREDCACHE_HASHBITS)
struct rpc_cred_cache {
struct hlist_head hashtable[RPC_CREDCACHE_NR];
unsigned int hashbits;
spinlock_t lock;
};

Expand Down
10 changes: 7 additions & 3 deletions trunk/net/sunrpc/auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,15 @@ int
rpcauth_init_credcache(struct rpc_auth *auth)
{
struct rpc_cred_cache *new;
unsigned int hashsize;
int i;

new = kmalloc(sizeof(*new), GFP_KERNEL);
if (!new)
return -ENOMEM;
for (i = 0; i < RPC_CREDCACHE_NR; i++)
new->hashbits = RPC_CREDCACHE_HASHBITS;
hashsize = 1U << new->hashbits;
for (i = 0; i < hashsize; i++)
INIT_HLIST_HEAD(&new->hashtable[i]);
spin_lock_init(&new->lock);
auth->au_credcache = new;
Expand Down Expand Up @@ -183,11 +186,12 @@ rpcauth_clear_credcache(struct rpc_cred_cache *cache)
LIST_HEAD(free);
struct hlist_head *head;
struct rpc_cred *cred;
unsigned int hashsize = 1U << cache->hashbits;
int i;

spin_lock(&rpc_credcache_lock);
spin_lock(&cache->lock);
for (i = 0; i < RPC_CREDCACHE_NR; i++) {
for (i = 0; i < hashsize; i++) {
head = &cache->hashtable[i];
while (!hlist_empty(head)) {
cred = hlist_entry(head->first, struct rpc_cred, cr_hash);
Expand Down Expand Up @@ -297,7 +301,7 @@ rpcauth_lookup_credcache(struct rpc_auth *auth, struct auth_cred * acred,
*entry, *new;
unsigned int nr;

nr = hash_long(acred->uid, RPC_CREDCACHE_HASHBITS);
nr = hash_long(acred->uid, cache->hashbits);

rcu_read_lock();
hlist_for_each_entry_rcu(entry, pos, &cache->hashtable[nr], cr_hash) {
Expand Down

0 comments on commit fdd4c50

Please sign in to comment.