Skip to content

Commit

Permalink
sunrpc: Don't schedule an upcall on a replaced cache entry.
Browse files Browse the repository at this point in the history
When a cache entry is replaced, the "expiry_time" get set to
zero by a call to "cache_fresh_locked(..., 0)" at the end of
"sunrpc_cache_update".

This low expiry time makes cache_check() think that the 'refresh_age'
is negative, so the 'age' is comparatively large and a refresh is
triggered.
However refreshing a replaced entry it pointless, it cannot achieve
anything useful.

So teach cache_check to ignore a low refresh_age when expiry_time
is zero.

Reported-by: Bodo Stroesser <bstroesser@ts.fujitsu.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
  • Loading branch information
NeilBrown authored and J. Bruce Fields committed Jul 1, 2013
1 parent 7715cde commit 0bebc63
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/sunrpc/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ int cache_check(struct cache_detail *detail,
if (rqstp == NULL) {
if (rv == -EAGAIN)
rv = -ENOENT;
} else if (rv == -EAGAIN || age > refresh_age/2) {
} else if (rv == -EAGAIN ||
(h->expiry_time != 0 && age > refresh_age/2)) {
dprintk("RPC: Want update, refage=%ld, age=%ld\n",
refresh_age, age);
if (!test_and_set_bit(CACHE_PENDING, &h->flags)) {
Expand Down

0 comments on commit 0bebc63

Please sign in to comment.