patch-2.4.0-test1 linux/fs/nfsd/nfscache.c

Next file: linux/fs/nfsd/nfsfh.c
Previous file: linux/fs/nfs/write.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.99-pre9/linux/fs/nfsd/nfscache.c linux/fs/nfsd/nfscache.c
@@ -68,7 +68,7 @@
 	i = HASHSIZE * sizeof (struct nfscache_head);
 	hash_list = kmalloc (i, GFP_KERNEL);
 	if (!hash_list) {
-		kfree (nfscache);
+		free_pages ((unsigned long)nfscache, order);
 		nfscache = NULL;
 		printk (KERN_ERR "nfsd: cannot allocate %d bytes for hash list\n", i);
 		return;
@@ -98,6 +98,8 @@
 nfsd_cache_shutdown(void)
 {
 	struct svc_cacherep	*rp;
+	size_t			i;
+	unsigned long		order;
 
 	if (!cache_initialized)
 		return;
@@ -110,7 +112,10 @@
 	cache_initialized = 0;
 	cache_disabled = 1;
 
-	kfree (nfscache);
+	i = CACHESIZE * sizeof (struct svc_cacherep);
+	for (order = 0; (PAGE_SIZE << order) < i; order++)
+		;
+	free_pages ((unsigned long)nfscache, order);
 	nfscache = NULL;
 	kfree (hash_list);
 	hash_list = NULL;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)