summaryrefslogtreecommitdiff
path: root/net/sunrpc/cache.c
diff options
context:
space:
mode:
authorTrond Myklebust <trondmy@gmail.com>2020-01-06 13:40:34 -0500
committerJ. Bruce Fields <bfields@redhat.com>2020-01-22 16:25:41 -0500
commit1d82163714c16ebe09c7a8c9cd3cef7abcc16208 (patch)
tree162e26f77dc3c72ef1e10c6a5799916b7fe74188 /net/sunrpc/cache.c
parent1b28d756b2eaee03e838390465754e431389e483 (diff)
sunrpc: Fix potential leaks in sunrpc_cache_unhash()
When we unhash the cache entry, we need to handle any pending upcalls by calling cache_fresh_unlocked(). Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'net/sunrpc/cache.c')
-rw-r--r--net/sunrpc/cache.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index f740cb51802a..7ede1e52fd81 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -1888,7 +1888,9 @@ void sunrpc_cache_unhash(struct cache_detail *cd, struct cache_head *h)
if (!hlist_unhashed(&h->cache_list)){
hlist_del_init_rcu(&h->cache_list);
cd->entries--;
+ set_bit(CACHE_CLEANED, &h->flags);
spin_unlock(&cd->hash_lock);
+ cache_fresh_unlocked(h, cd);
cache_put(h, cd);
} else
spin_unlock(&cd->hash_lock);