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/auth.c | |
| parent | ae05f269400533cbb32bfba131ab528d78dffd16 (diff) | |
| download | olio-linux-3.10-eac0d18d44705f8a1b72cccec3a453e1a43eb20a.tar.xz olio-linux-3.10-eac0d18d44705f8a1b72cccec3a453e1a43eb20a.zip  | |
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/auth.c')
| -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 436bf1b4b76..a045a1253d4 100644 --- a/net/sunrpc/auth.c +++ b/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) {  |