diff options
Diffstat (limited to 'net/sunrpc/auth.c')
-rw-r--r-- | net/sunrpc/auth.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c index 436bf1b4b76c..cb216b2df666 100644 --- a/net/sunrpc/auth.c +++ b/net/sunrpc/auth.c | |||
@@ -228,19 +228,21 @@ static int | |||
228 | rpcauth_prune_expired(struct list_head *free, int nr_to_scan) | 228 | rpcauth_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) { |
@@ -453,7 +455,7 @@ need_lock: | |||
453 | } | 455 | } |
454 | if (test_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags) == 0) | 456 | if (test_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags) == 0) |
455 | rpcauth_unhash_cred(cred); | 457 | rpcauth_unhash_cred(cred); |
456 | else if (test_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags) != 0) { | 458 | if (test_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags) != 0) { |
457 | cred->cr_expire = jiffies; | 459 | cred->cr_expire = jiffies; |
458 | list_add_tail(&cred->cr_lru, &cred_unused); | 460 | list_add_tail(&cred->cr_lru, &cred_unused); |
459 | number_cred_unused++; | 461 | number_cred_unused++; |