diff options
Diffstat (limited to 'net/sunrpc')
-rw-r--r-- | net/sunrpc/auth.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c index 0667a36aee78..c40856f589f0 100644 --- a/net/sunrpc/auth.c +++ b/net/sunrpc/auth.c | |||
@@ -236,10 +236,13 @@ rpcauth_prune_expired(struct list_head *free, int nr_to_scan) | |||
236 | 236 | ||
237 | list_for_each_entry_safe(cred, next, &cred_unused, cr_lru) { | 237 | list_for_each_entry_safe(cred, next, &cred_unused, cr_lru) { |
238 | 238 | ||
239 | /* Enforce a 60 second garbage collection moratorium */ | 239 | /* |
240 | * Enforce a 60 second garbage collection moratorium | ||
241 | * Note that the cred_unused list must be time-ordered. | ||
242 | */ | ||
240 | if (time_in_range(cred->cr_expire, expired, jiffies) && | 243 | if (time_in_range(cred->cr_expire, expired, jiffies) && |
241 | test_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags) != 0) | 244 | test_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags) != 0) |
242 | continue; | 245 | return 0; |
243 | 246 | ||
244 | list_del_init(&cred->cr_lru); | 247 | list_del_init(&cred->cr_lru); |
245 | number_cred_unused--; | 248 | number_cred_unused--; |
@@ -258,7 +261,7 @@ rpcauth_prune_expired(struct list_head *free, int nr_to_scan) | |||
258 | if (nr_to_scan == 0) | 261 | if (nr_to_scan == 0) |
259 | break; | 262 | break; |
260 | } | 263 | } |
261 | return nr_to_scan; | 264 | return (number_cred_unused / 100) * sysctl_vfs_cache_pressure; |
262 | } | 265 | } |
263 | 266 | ||
264 | /* | 267 | /* |
@@ -275,8 +278,7 @@ rpcauth_cache_shrinker(int nr_to_scan, gfp_t gfp_mask) | |||
275 | if (list_empty(&cred_unused)) | 278 | if (list_empty(&cred_unused)) |
276 | return 0; | 279 | return 0; |
277 | spin_lock(&rpc_credcache_lock); | 280 | spin_lock(&rpc_credcache_lock); |
278 | nr_to_scan = rpcauth_prune_expired(&free, nr_to_scan); | 281 | res = rpcauth_prune_expired(&free, nr_to_scan); |
279 | res = (number_cred_unused / 100) * sysctl_vfs_cache_pressure; | ||
280 | spin_unlock(&rpc_credcache_lock); | 282 | spin_unlock(&rpc_credcache_lock); |
281 | rpcauth_destroy_credlist(&free); | 283 | rpcauth_destroy_credlist(&free); |
282 | return res; | 284 | return res; |