Missed deallocating an array in the _exit() function
authorSapan Bhatia <sapanb@cs.princeton.edu>
Mon, 6 Apr 2009 15:00:50 +0000 (15:00 +0000)
committerSapan Bhatia <sapanb@cs.princeton.edu>
Mon, 6 Apr 2009 15:00:50 +0000 (15:00 +0000)
linux-2.6-590-GC-dcookies.patch

index c7d1409..47bcf18 100644 (file)
@@ -29,7 +29,7 @@
  
  static inline struct dcookie_user * dcookie_register(void)
 --- linux-chopstix/fs/dcookies.c.orig  2009-03-05 08:46:09.000000000 -0500
-+++ linux-chopstix/fs/dcookies.c       2009-03-16 15:18:40.000000000 -0400
++++ linux-chopstix/fs/dcookies.c       2009-04-06 11:04:30.000000000 -0400
 @@ -38,14 +38,19 @@
  static LIST_HEAD(dcookie_users);
  static DEFINE_MUTEX(dcookie_mutex);
@@ -97,7 +97,7 @@
        if (!dcs)
                return NULL;
  
-@@ -210,9 +228,18 @@
+@@ -210,10 +228,19 @@
        if (!dcookie_cache)
                goto out;
  
 +    
 +    dcookie_hashtable[1] = kmalloc(PAGE_SIZE, GFP_KERNEL);
 +      if (!dcookie_hashtable[1])
-+              goto out_kmem;
-+
+               goto out_kmem;
 +    dcookie_hashtable[2] = kmalloc(PAGE_SIZE, GFP_KERNEL);
 +      if (!dcookie_hashtable[0])
-               goto out_kmem;
++              goto out_kmem;
 +    
++
        err = 0;
  
+       /*
 @@ -235,7 +262,24 @@
        hash_size = 1UL << hash_bits;
  
  
  static void dcookie_exit(void)
  {
-@@ -269,7 +346,14 @@
+@@ -269,7 +346,21 @@
        size_t i;
  
        for (i = 0; i < hash_size; ++i) {
 +              }
 +
 +        list = dcookie_hashtable[1] + i;
++              list_for_each_safe(pos, pos2, list) {
++                      dcs = list_entry(pos, struct dcookie_struct, hash_list);
++                      list_del(&dcs->hash_list);
++                      free_dcookie(dcs);
++              }
++
++        list = dcookie_hashtable[2] + i;
                list_for_each_safe(pos, pos2, list) {
                        dcs = list_entry(pos, struct dcookie_struct, hash_list);
                        list_del(&dcs->hash_list);
-@@ -277,7 +361,8 @@
+@@ -277,7 +368,9 @@
                }
        }
  
 -      kfree(dcookie_hashtable);
 +      kfree(dcookie_hashtable[0]);
 +      kfree(dcookie_hashtable[1]);
++      kfree(dcookie_hashtable[2]);
        kmem_cache_destroy(dcookie_cache);
  }
  
-@@ -327,3 +412,5 @@
+@@ -327,3 +420,5 @@
  EXPORT_SYMBOL_GPL(dcookie_register);
  EXPORT_SYMBOL_GPL(dcookie_unregister);
  EXPORT_SYMBOL_GPL(get_dcookie);
 +EXPORT_SYMBOL_GPL(dcookie_garbage_collect);
++EXPORT_SYMBOL_GPL(dcookie_swap);