From 04e5789ef565b1a6cbbd6aba6d9ef6789cead2cd Mon Sep 17 00:00:00 2001 From: Trond Myklebust Date: Tue, 28 Oct 2008 15:21:41 -0400 Subject: [PATCH] --- yaml --- r: 118137 b: refs/heads/master c: eac0d18d44705f8a1b72cccec3a453e1a43eb20a h: refs/heads/master i: 118135: ad9c8c4614dc799f9c8074ef524d00093a15d12d v: v3 --- [refs] | 2 +- trunk/net/sunrpc/auth.c | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/[refs] b/[refs] index 6f642bf208c4..84c557fc2041 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: ae05f269400533cbb32bfba131ab528d78dffd16 +refs/heads/master: eac0d18d44705f8a1b72cccec3a453e1a43eb20a diff --git a/trunk/net/sunrpc/auth.c b/trunk/net/sunrpc/auth.c index 436bf1b4b76c..a045a1253d49 100644 --- a/trunk/net/sunrpc/auth.c +++ b/trunk/net/sunrpc/auth.c @@ -228,19 +228,21 @@ static int rpcauth_prune_expired(struct list_head *free, int nr_to_scan) { spinlock_t *cache_lock; - struct rpc_cred *cred; + struct rpc_cred *cred, *next; unsigned long expired = jiffies - RPC_AUTH_EXPIRY_MORATORIUM; - while (!list_empty(&cred_unused)) { - cred = list_entry(cred_unused.next, struct rpc_cred, cr_lru); + list_for_each_entry_safe(cred, next, &cred_unused, cr_lru) { + + /* Enforce a 60 second garbage collection moratorium */ + if (time_in_range(cred->cr_expire, expired, jiffies) && + test_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags) != 0) + continue; + list_del_init(&cred->cr_lru); number_cred_unused--; if (atomic_read(&cred->cr_count) != 0) continue; - /* Enforce a 5 second garbage collection moratorium */ - if (time_in_range(cred->cr_expire, expired, jiffies) && - test_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags) != 0) - continue; + cache_lock = &cred->cr_auth->au_credcache->lock; spin_lock(cache_lock); if (atomic_read(&cred->cr_count) == 0) {