X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=net%2Fsunrpc%2Fcache.c;h=00cb388ece032cec8aeba948bb97c0e653eede5e;hb=1a047060a99f274a7c52cfea8159e4142a14b8a7;hp=3ac4193a78edf2c0fcff4ae5257b50163c2a937f;hpb=95d465fd750897ab32462a6702fbfe1b122cbbc0;p=linux-2.6-omap-h63xx.git diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index 3ac4193a78e..00cb388ece0 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c @@ -71,7 +71,12 @@ struct cache_head *sunrpc_cache_lookup(struct cache_detail *detail, new = detail->alloc(); if (!new) return NULL; + /* must fully initialise 'new', else + * we might get lose if we need to + * cache_put it soon. + */ cache_init(new); + detail->init(new, key); write_lock(&detail->hash_lock); @@ -85,7 +90,6 @@ struct cache_head *sunrpc_cache_lookup(struct cache_detail *detail, return tmp; } } - detail->init(new, key); new->next = *head; *head = new; detail->entries++; @@ -159,6 +163,7 @@ struct cache_head *sunrpc_cache_update(struct cache_detail *detail, detail->update(tmp, new); tmp->next = *head; *head = tmp; + detail->entries++; cache_get(tmp); is_new = cache_fresh_locked(tmp, new->expiry_time); cache_fresh_locked(old, 0);