Commit e091bcb6 authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] kNFSd: Fix problems when releasing cache item.

When releasing a cache item we always release anything
that is part of the key, but we ONLY release the content
is if it is valid.  i.e. if CACHE_VALID but not CACHE_NEGATIVE.
parent 64dc183f
...@@ -70,7 +70,8 @@ void expkey_put(struct cache_head *item, struct cache_detail *cd) ...@@ -70,7 +70,8 @@ void expkey_put(struct cache_head *item, struct cache_detail *cd)
{ {
if (cache_put(item, cd)) { if (cache_put(item, cd)) {
struct svc_expkey *key = container_of(item, struct svc_expkey, h); struct svc_expkey *key = container_of(item, struct svc_expkey, h);
if (key->ek_export) if (test_bit(CACHE_VALID, &item->flags) &&
!test_bit(CACHE_NEGATIVE, &item->flags))
exp_put(key->ek_export); exp_put(key->ek_export);
auth_domain_put(key->ek_client); auth_domain_put(key->ek_client);
kfree(key); kfree(key);
......
...@@ -90,6 +90,8 @@ void ip_map_put(struct cache_head *item, struct cache_detail *cd) ...@@ -90,6 +90,8 @@ void ip_map_put(struct cache_head *item, struct cache_detail *cd)
{ {
struct ip_map *im = container_of(item, struct ip_map,h); struct ip_map *im = container_of(item, struct ip_map,h);
if (cache_put(item, cd)) { if (cache_put(item, cd)) {
if (test_bit(CACHE_VALID, &item->flags) &&
!test_bit(CACHE_NEGATIVE, &item->flags))
auth_domain_put(&im->m_client->h); auth_domain_put(&im->m_client->h);
kfree(im); kfree(im);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment