diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2008-10-28 15:21:41 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2008-10-28 15:21:41 -0400 |
commit | eac0d18d44705f8a1b72cccec3a453e1a43eb20a (patch) | |
tree | b727174dba608adc5c4cbfaea9e19b2c6ac1cf26 /net/sunrpc | |
parent | ae05f269400533cbb32bfba131ab528d78dffd16 (diff) |
SUNRPC: Fix rpcauth_prune_expired
We need to make sure that we don't remove creds from the cred_unused list
if they are still under the moratorium, or else they will never get
garbage collected.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc')
-rw-r--r-- | net/sunrpc/auth.c | 16 |
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 | |||
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) { |