diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2008-04-14 18:13:37 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2008-04-19 16:55:02 -0400 |
commit | d2b831416365e8b1f27809b62d5e4260883956cc (patch) | |
tree | f812eddfe29aed2d821b1d7f6d1fd9a64074a2d2 /net | |
parent | a2b2bb8822c78806930bbb4d4c5bb3ae69648fd0 (diff) | |
download | kernel_samsung_aries-d2b831416365e8b1f27809b62d5e4260883956cc.zip kernel_samsung_aries-d2b831416365e8b1f27809b62d5e4260883956cc.tar.gz kernel_samsung_aries-d2b831416365e8b1f27809b62d5e4260883956cc.tar.bz2 |
SUNRPC: Protect creds against early garbage collection
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/sunrpc/auth.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c index 0632cd0..6bfea9e 100644 --- a/net/sunrpc/auth.c +++ b/net/sunrpc/auth.c @@ -220,6 +220,9 @@ rpcauth_destroy_credcache(struct rpc_auth *auth) } EXPORT_SYMBOL_GPL(rpcauth_destroy_credcache); + +#define RPC_AUTH_EXPIRY_MORATORIUM (60 * HZ) + /* * Remove stale credentials. Avoid sleeping inside the loop. */ @@ -228,6 +231,7 @@ rpcauth_prune_expired(struct list_head *free, int nr_to_scan) { spinlock_t *cache_lock; struct rpc_cred *cred; + unsigned long expired = jiffies - RPC_AUTH_EXPIRY_MORATORIUM; while (!list_empty(&cred_unused)) { cred = list_entry(cred_unused.next, struct rpc_cred, cr_lru); @@ -235,6 +239,10 @@ rpcauth_prune_expired(struct list_head *free, int nr_to_scan) 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) { |