aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc
diff options
context:
space:
mode:
Diffstat (limited to 'net/sunrpc')
-rw-r--r--net/sunrpc/auth.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c
index 436bf1b4b76c..a045a1253d49 100644
--- a/net/sunrpc/auth.c
+++ b/net/sunrpc/auth.c
@@ -228,19 +228,21 @@ static int
228rpcauth_prune_expired(struct list_head *free, int nr_to_scan) 228rpcauth_prune_expired(struct list_head *free, int nr_to_scan)
229{ 229{
230 spinlock_t *cache_lock; 230 spinlock_t *cache_lock;
231 struct rpc_cred *cred; 231 struct rpc_cred *cred, *next;
232 unsigned long expired = jiffies - RPC_AUTH_EXPIRY_MORATORIUM; 232 unsigned long expired = jiffies - RPC_AUTH_EXPIRY_MORATORIUM;
233 233
234 while (!list_empty(&cred_unused)) { 234 list_for_each_entry_safe(cred, next, &cred_unused, cr_lru) {
235 cred = list_entry(cred_unused.next, struct rpc_cred, cr_lru); 235
236 /* Enforce a 60 second garbage collection moratorium */
237 if (time_in_range(cred->cr_expire, expired, jiffies) &&
238 test_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags) != 0)
239 continue;
240
236 list_del_init(&cred->cr_lru); 241 list_del_init(&cred->cr_lru);
237 number_cred_unused--; 242 number_cred_unused--;
238 if (atomic_read(&cred->cr_count) != 0) 243 if (atomic_read(&cred->cr_count) != 0)
239 continue; 244 continue;
240 /* Enforce a 5 second garbage collection moratorium */ 245
241 if (time_in_range(cred->cr_expire, expired, jiffies) &&
242 test_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags) != 0)
243 continue;
244 cache_lock = &cred->cr_auth->au_credcache->lock; 246 cache_lock = &cred->cr_auth->au_credcache->lock;
245 spin_lock(cache_lock); 247 spin_lock(cache_lock);
246 if (atomic_read(&cred->cr_count) == 0) { 248 if (atomic_read(&cred->cr_count) == 0) {