]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/sunrpc/cache.c
[PATCH] knfsd: fix race that can disable NFS server
[linux-2.6-omap-h63xx.git] / net / sunrpc / cache.c
index 7026b0866b7b0d50b0003b15bb14fde24a569a65..00cb388ece032cec8aeba948bb97c0e653eede5e 100644 (file)
@@ -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++;