Missed deallocating an array in the _exit() function
[linux-2.6.git] / linux-2.6-590-GC-dcookies.patch
index 8ea0060..47bcf18 100644 (file)
@@ -1,6 +1,35 @@
-diff -Nurb --exclude='*.cmd' --exclude='*.orig' --exclude='*.swp' --exclude=tags --exclude='*.patch' --exclude='*.diff' --exclude='*.svn*' linux-2.6.22-580/fs/dcookies.c linux-2.6.22-590/fs/dcookies.c
---- linux-2.6.22-580/fs/dcookies.c     2007-07-08 19:32:17.000000000 -0400
-+++ linux-2.6.22-590/fs/dcookies.c     2009-03-16 20:57:32.000000000 -0400
+--- linux-chopstix/include/linux/dcookies.h.orig       2009-03-05 08:45:29.000000000 -0500
++++ linux-chopstix/include/linux/dcookies.h    2009-03-12 13:43:53.000000000 -0400
+@@ -45,6 +45,27 @@
+ int get_dcookie(struct dentry * dentry, struct vfsmount * vfsmnt,
+       unsigned long * cookie);
++
++/**
++ * dcookie_swap - switch to the next dcookie epoch
++ *
++ * Deactivate the current dcookie hash table and activate
++ * the next one
++ *
++ * Returns 0 on success
++ */
++
++int dcookie_swap(void);
++
++/**
++ * dcookie_garbage_collect - clear the hash table next in line
++ *
++ * Clear the hash table to be activated in the next epoch.
++ *
++ * Returns 0 on success
++ */
++
++int dcookie_garbage_colect(void);
+ #else
+ 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-04-06 11:04:30.000000000 -0400
 @@ -38,14 +38,19 @@
  static LIST_HEAD(dcookie_users);
  static DEFINE_MUTEX(dcookie_mutex);
@@ -8,7 +37,7 @@ diff -Nurb --exclude='*.cmd' --exclude='*.orig' --exclude='*.swp' --exclude=tags
 -static struct list_head *dcookie_hashtable __read_mostly;
 +static struct list_head *dcookie_hashtable[3] __read_mostly;
  static size_t hash_size __read_mostly;
-+unsigned int current_hash = 0, old_hash = -1;
++unsigned int current_hash = 1, old_hash = 0;
  
  static inline int is_live(void)
  {
@@ -35,7 +64,7 @@ diff -Nurb --exclude='*.cmd' --exclude='*.orig' --exclude='*.swp' --exclude=tags
                }
        }
  
-+    if (!found && (old_hash!=-1)) {
++    if (!found) {
 +        list = dcookie_hashtable[old_hash] + dcookie_hash(dcookie);
 +
 +        list_for_each(pos, list) {
@@ -156,7 +185,7 @@ diff -Nurb --exclude='*.cmd' --exclude='*.orig' --exclude='*.swp' --exclude=tags
  
  static void dcookie_exit(void)
  {
-@@ -269,7 +346,14 @@
+@@ -269,7 +346,21 @@
        size_t i;
  
        for (i = 0; i < hash_size; ++i) {
@@ -169,53 +198,30 @@ diff -Nurb --exclude='*.cmd' --exclude='*.orig' --exclude='*.swp' --exclude=tags
 +              }
 +
 +        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);
-diff -Nurb --exclude='*.cmd' --exclude='*.orig' --exclude='*.swp' --exclude=tags --exclude='*.patch' --exclude='*.diff' --exclude='*.svn*' linux-2.6.22-580/include/linux/dcookies.h linux-2.6.22-590/include/linux/dcookies.h
---- linux-2.6.22-580/include/linux/dcookies.h  2007-07-08 19:32:17.000000000 -0400
-+++ linux-2.6.22-590/include/linux/dcookies.h  2009-03-16 20:57:32.000000000 -0400
-@@ -45,6 +45,27 @@
- int get_dcookie(struct dentry * dentry, struct vfsmount * vfsmnt,
-       unsigned long * cookie);
-+
-+/**
-+ * dcookie_swap - switch to the next dcookie epoch
-+ *
-+ * Deactivate the current dcookie hash table and activate
-+ * the next one
-+ *
-+ * Returns 0 on success
-+ */
-+
-+int dcookie_swap(void);
-+
-+/**
-+ * dcookie_garbage_collect - clear the hash table next in line
-+ *
-+ * Clear the hash table to be activated in the next epoch.
-+ *
-+ * Returns 0 on success
-+ */
-+
-+int dcookie_garbage_colect(void);
- #else
- static inline struct dcookie_user * dcookie_register(void)