Whamcloud - gitweb
Branch b1_6
authoryangsheng <yangsheng>
Mon, 4 Feb 2008 02:44:15 +0000 (02:44 +0000)
committeryangsheng <yangsheng>
Mon, 4 Feb 2008 02:44:15 +0000 (02:44 +0000)
b=14714
i=yangsheng
i=scjody

Use d_move_locked & d_rehash_cond instead of __d_move & __d_rehash in kernel patches.

14 files changed:
lustre/autoconf/lustre-core.m4
lustre/include/linux/lustre_compat25.h
lustre/kernel_patches/patches/iopen-misc-2.6-fc3.patch
lustre/kernel_patches/patches/iopen-misc-2.6.12.patch
lustre/kernel_patches/patches/iopen-misc-2.6.18-vanilla.patch
lustre/kernel_patches/patches/vfs_races-2.6-fc3.patch
lustre/kernel_patches/patches/vfs_races-2.6-rhel4.patch
lustre/kernel_patches/patches/vfs_races-2.6-suse.patch
lustre/kernel_patches/patches/vfs_races-2.6.12.patch
lustre/kernel_patches/patches/vfs_races-2.6.18-vanilla.patch
lustre/llite/dcache.c
lustre/llite/llite_internal.h
lustre/llite/namei.c
lustre/llite/statahead.c

index 263ddf7..a495eb1 100644 (file)
@@ -1104,6 +1104,24 @@ AC_DEFINE(HAVE___D_REHASH, 1,
 ])
 ])
 
+AC_DEFUN([LC_EXPORT_D_MOVE_LOCKED],
+[LB_CHECK_SYMBOL_EXPORT([d_move_locked],
+[fs/dcache.c],[
+AC_DEFINE(HAVE_D_MOVE_LOCKED, 1,
+            [d_move_locked is exported by the kernel])
+],[
+])
+])
+
+AC_DEFUN([LC_EXPORT___D_MOVE],
+[LB_CHECK_SYMBOL_EXPORT([__d_move],
+[fs/dcache.c],[
+AC_DEFINE(HAVE___D_MOVE, 1,
+            [__d_move is exported by the kernel])
+],[
+])
+])
+
 # The actual symbol exported varies among architectures, so we need
 # to check many symbols (but only in the current architecture.)  No
 # matter what symbol is exported, the kernel #defines node_to_cpumask
@@ -1233,6 +1251,8 @@ AC_DEFUN([LC_PROG_LINUX],
           LC_EXPORT_TRUNCATE_COMPLETE
           LC_EXPORT_D_REHASH_COND
           LC_EXPORT___D_REHASH
+          LC_EXPORT_D_MOVE_LOCKED
+          LC_EXPORT___D_MOVE
           LC_EXPORT_NODE_TO_CPUMASK
 
           LC_STRUCT_KIOBUF
index 4ee81fb..2678bdc 100644 (file)
@@ -201,8 +201,14 @@ static inline int cleanup_group_info(void)
 
 #include <linux/proc_fs.h>
 
-#ifndef HAVE___D_REHASH
-#define __d_rehash(dentry, lock) d_rehash_cond(dentry, lock)
+#if !defined(HAVE_D_REHASH_COND) && defined(HAVE___D_REHASH)
+#define d_rehash_cond(dentry, lock) __d_rehash(dentry, lock)
+extern void __d_rehash(struct dentry *dentry, int lock);
+#endif
+
+#if !defined(HAVE_D_MOVE_LOCKED) && defined(HAVE___D_MOVE)
+#define d_move_locked(dentry, target) __d_move(dentry, target)
+extern void __d_move(struct dentry *dentry, struct dentry *target);
 #endif
 
 #ifdef HAVE_CAN_SLEEP_ARG
index 5dbefed..5fc42b5 100644 (file)
@@ -34,7 +34,7 @@ Index: linux-2.6.11/fs/dcache.c
   */
  
 -void d_move(struct dentry * dentry, struct dentry * target)
-+void __d_move(struct dentry * dentry, struct dentry * target)
++void d_move_locked(struct dentry * dentry, struct dentry * target)
  {
        struct hlist_head *list;
  
@@ -51,12 +51,12 @@ Index: linux-2.6.11/fs/dcache.c
        write_sequnlock(&rename_lock);
 +}
 +
-+EXPORT_SYMBOL(__d_move);
++EXPORT_SYMBOL(d_move_locked);
 +
 +void d_move(struct dentry *dentry, struct dentry *target)
 +{
 +      spin_lock(&dcache_lock);
-+      __d_move(dentry, target);
++      d_move_locked(dentry, target);
        spin_unlock(&dcache_lock);
  }
  
@@ -68,7 +68,7 @@ Index: linux-2.6.11/include/linux/dcache.h
   * This adds the entry to the hash queues.
   */
  extern void d_rehash(struct dentry *);
-+extern void __d_rehash(struct dentry *, int lock);
++extern void d_rehash_cond(struct dentry *, int lock);
  
  /**
   * d_add - add dentry to hash queues
@@ -76,7 +76,7 @@ Index: linux-2.6.11/include/linux/dcache.h
  
  /* used for rename() and baskets */
  extern void d_move(struct dentry *, struct dentry *);
-+extern void __d_move(struct dentry *, struct dentry *);
++extern void d_move_locked(struct dentry *, struct dentry *);
  
  /* appendix may either be NULL or be used for transname suffixes */
  extern struct dentry * d_lookup(struct dentry *, struct qstr *);
index c5d3c54..4819ed5 100644 (file)
@@ -64,7 +64,7 @@ Index: linux-2.6.16.46-0.14/fs/dcache.c
   */
  
 -void d_move(struct dentry * dentry, struct dentry * target)
-+void __d_move(struct dentry * dentry, struct dentry * target)
++void d_move_locked(struct dentry * dentry, struct dentry * target)
  {
        struct hlist_head *list;
  
@@ -81,12 +81,12 @@ Index: linux-2.6.16.46-0.14/fs/dcache.c
        write_sequnlock(&rename_lock);
 +}
 +
-+EXPORT_SYMBOL(__d_move);
++EXPORT_SYMBOL(d_move_locked);
 +
 +void d_move(struct dentry *dentry, struct dentry *target)
 +{
 +      spin_lock(&dcache_lock);
-+      __d_move(dentry, target);
++      d_move_locked(dentry, target);
        spin_unlock(&dcache_lock);
  }
  
@@ -106,7 +106,7 @@ Index: linux-2.6.16.46-0.14/include/linux/dcache.h
  
  /* used for rename() and baskets */
  extern void d_move(struct dentry *, struct dentry *);
-+extern void __d_move(struct dentry *, struct dentry *);
++extern void d_move_locked(struct dentry *, struct dentry *);
  
  /* appendix may either be NULL or be used for transname suffixes */
  extern struct dentry * d_lookup(struct dentry *, struct qstr *);
index 89927c3..e2d0e8a 100644 (file)
@@ -34,7 +34,7 @@ Index: linux-2.6/fs/dcache.c
   */
  
 -void d_move(struct dentry * dentry, struct dentry * target)
-+void __d_move(struct dentry * dentry, struct dentry * target)
++void d_move_locked(struct dentry * dentry, struct dentry * target)
  {
        struct hlist_head *list;
  
@@ -51,12 +51,12 @@ Index: linux-2.6/fs/dcache.c
        write_sequnlock(&rename_lock);
 +}
 +
-+EXPORT_SYMBOL(__d_move);
++EXPORT_SYMBOL(d_move_locked);
 +
 +void d_move(struct dentry *dentry, struct dentry *target)
 +{
 +      spin_lock(&dcache_lock);
-+      __d_move(dentry, target);
++      d_move_locked(dentry, target);
        spin_unlock(&dcache_lock);
  }
  
@@ -76,7 +76,7 @@ Index: linux-2.6/include/linux/dcache.h
  
  /* used for rename() and baskets */
  extern void d_move(struct dentry *, struct dentry *);
-+extern void __d_move(struct dentry *, struct dentry *);
++extern void d_move_locked(struct dentry *, struct dentry *);
  
  /* appendix may either be NULL or be used for transname suffixes */
  extern struct dentry * d_lookup(struct dentry *, struct qstr *);
index a0b643f..e0db838 100644 (file)
@@ -2,21 +2,12 @@ Index: linux-2.6.11/fs/dcache.c
 ===================================================================
 --- linux-2.6.11.orig/fs/dcache.c      2005-04-13 22:44:37.698760922 -0400
 +++ linux-2.6.11/fs/dcache.c   2005-04-13 22:44:50.482498026 -0400
-@@ -1183,7 +1183,7 @@
-       spin_unlock(&dcache_lock);
- }
--static void __d_rehash(struct dentry * entry, struct hlist_head *list)
-+static void __d_rehash_internal(struct dentry * entry, struct hlist_head *list)
- {
-       entry->d_flags &= ~DCACHE_UNHASHED;
 @@ -1197,15 +1197,24 @@
   * Adds a dentry to the hash according to its name.
   */
   
 -void d_rehash(struct dentry * entry)
-+void __d_rehash(struct dentry * entry, int lock)
++void d_rehash_cond(struct dentry * entry, int lock)
  {
        struct hlist_head *list = d_hash(entry->d_parent, entry->d_name.hash);
  
@@ -24,31 +15,21 @@ Index: linux-2.6.11/fs/dcache.c
 +      if (lock)
 +              spin_lock(&dcache_lock);
        spin_lock(&entry->d_lock);
--      __d_rehash(entry, list);
-+      __d_rehash_internal(entry, list);
+       __d_rehash(entry, list);
        spin_unlock(&entry->d_lock);
 -      spin_unlock(&dcache_lock);
 +      if (lock)
 +              spin_unlock(&dcache_lock);
 +}
 +
-+EXPORT_SYMBOL(__d_rehash);
++EXPORT_SYMBOL(d_rehash_cond);
 +
 +void d_rehash(struct dentry * entry)
 +{
-+      __d_rehash(entry, 1);
++      d_rehash_cond(entry, 1);
  }
  
  #define do_switch(x,y) do { \
-@@ -1308,7 +1317,7 @@
- already_unhashed:
-       list = d_hash(target->d_parent, target->d_name.hash);
--      __d_rehash(dentry, list);
-+      __d_rehash_internal(dentry, list);
-       /* Unhash the target: dput() will then get rid of it */
-       __d_drop(target);
 Index: linux-2.6.11/include/linux/dcache.h
 ===================================================================
 --- linux-2.6.11.orig/include/linux/dcache.h   2005-04-13 22:35:23.515178600 -0400
@@ -62,3 +43,11 @@ Index: linux-2.6.11/include/linux/dcache.h
  
  extern spinlock_t dcache_lock;
  
+@@ -254,6 +255,7 @@ extern int have_submounts(struct dentry 
+  * This adds the entry to the hash queues.
+  */
+ extern void d_rehash(struct dentry *);
++extern void d_rehash_cond(struct dentry *, int lock);
+ /**
+  * d_add - add dentry to hash queues
index 04ac6fe..61ee9da 100644 (file)
@@ -61,3 +61,11 @@ diff -urp RH_2_6_9_42_0_3.orig/include/linux/dcache.h RH_2_6_9_42_0_3/include/li
  
  extern spinlock_t dcache_lock;
  
+@@ -254,6 +255,7 @@ extern int have_submounts(struct dentry 
+  * This adds the entry to the hash queues.
+  */
+ extern void d_rehash(struct dentry *);
++extern void d_rehash_cond(struct dentry *, int lock);
+ /**
+  * d_add - add dentry to hash queues
index 1dfed66..756ac9e 100644 (file)
@@ -4,28 +4,26 @@
 
 --- linux-2.6.0-test1/fs/dcache.c~vfs_races_2.5.72_rev1        2003-07-24 15:52:47.000000000 +0400
 +++ linux-2.6.0-test1-alexey/fs/dcache.c       2003-09-13 16:21:16.000000000 +0400
-@@ -212,7 +212,14 @@ int d_invalidate(struct dentry * dentry)
+@@ -212,6 +212,13 @@ int d_invalidate(struct dentry * dentry)
                spin_unlock(&dcache_lock);
                return 0;
        }
--      /*
 +
-+        /* network invalidation by Lustre */
++      /* network invalidation by Lustre */
 +      if (dentry->d_flags & DCACHE_LUSTRE_INVALID) {
 +              spin_unlock(&dcache_lock);
 +              return 0;
 +      }
 +
-       /*
+       /*
         * Check whether to do a partial shrink_dcache
         * to get rid of unused child entries.
-        */
 @@ -1135,14 +1142,23 @@ void d_delete(struct dentry * dentry)
   * Adds a dentry to the hash according to its name.
   */
   
 -void d_rehash(struct dentry * entry)
-+void __d_rehash(struct dentry * entry, int lock)
++void d_rehash_cond(struct dentry * entry, int lock)
  {
        struct hlist_head *list = d_hash(entry->d_parent, entry->d_name.hash);
 -      spin_lock(&dcache_lock);
 +              spin_unlock(&dcache_lock);
 +}
 +
-+EXPORT_SYMBOL(__d_rehash);
++EXPORT_SYMBOL(d_rehash_cond);
 +
 +void d_rehash(struct dentry * entry)
 +{
-+      __d_rehash(entry, 1);
++      d_rehash_cond(entry, 1);
  }
  
  #define do_switch(x,y) do { \
  
  extern spinlock_t dcache_lock;
  
+@@ -254,6 +255,7 @@ extern int have_submounts(struct dentry 
+  * This adds the entry to the hash queues.
+  */
+ extern void d_rehash(struct dentry *);
++extern void d_rehash_cond(struct dentry *, int lock);
+ /**
+  * d_add - add dentry to hash queues
 
 _
index 011d87d..8666125 100644 (file)
@@ -59,3 +59,11 @@ Index: linux-2.6.7-vanilla/include/linux/dcache.h
  
  extern spinlock_t dcache_lock;
  
+@@ -254,6 +255,7 @@ extern int have_submounts(struct dentry 
+  * This adds the entry to the hash queues.
+  */
+ extern void d_rehash(struct dentry *);
++extern void d_rehash_cond(struct dentry *, int lock);
+ /**
+  * d_add - add dentry to hash queues
index 5898ff7..2d3fc7f 100644 (file)
@@ -58,3 +58,11 @@ Index: linux-2.6/include/linux/dcache.h
  
  #define DCACHE_INOTIFY_PARENT_WATCHED 0x0020 /* Parent inode is watched */
  
+@@ -254,6 +255,7 @@ extern int have_submounts(struct dentry 
+  * This adds the entry to the hash queues.
+  */
+ extern void d_rehash(struct dentry *);
++extern void d_rehash_cond(struct dentry *, int lock);
+ /**
+  * d_add - add dentry to hash queues
index 2c65e8c..81c09e4 100644 (file)
@@ -471,7 +471,7 @@ revalidate_finish:
         lock_dentry(de);
         __d_drop(de);
         unlock_dentry(de);
-        __d_rehash(de, 0);
+        d_rehash_cond(de, 0);
         spin_unlock(&dcache_lock);
 
  out:
index f6f6642..b8ea29c 100644 (file)
@@ -715,7 +715,6 @@ int ll_tree_unlock(struct ll_lock_tree *tree);
 #define    ll_s2sbi(sb)        (s2lsi(sb)->lsi_llsbi)
 
 #if  (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
-void __d_rehash(struct dentry * entry, int lock);
 static inline __u64 ll_ts2u64(struct timespec *time)
 {
         __u64 t = time->tv_sec;
index 905dfde..e11e89d 100644 (file)
@@ -365,7 +365,7 @@ static void ll_d_add(struct dentry *de, struct inode *inode)
                        de->d_name.len, de->d_name.name, de, de->d_hash.next);
                 LBUG();
         }
-        __d_rehash(de, 0);
+        d_rehash_cond(de, 0);
 }
 
 /* Search "inode"'s alias list for a dentry that has the same name and parent
@@ -416,7 +416,7 @@ static struct dentry *ll_find_alias(struct inode *inode, struct dentry *de)
                 dentry->d_flags &= ~DCACHE_LUSTRE_INVALID;
 #endif
                 unlock_dentry(dentry);
-                __d_rehash(dentry, 0); /* avoid taking dcache_lock inside */
+                d_rehash_cond(dentry, 0); /* avoid taking dcache_lock inside */
                 spin_unlock(&dcache_lock);
                 iput(inode);
                 CDEBUG(D_DENTRY, "alias dentry %.*s (%p) parent %p inode %p "
@@ -790,7 +790,7 @@ static int ll_create_it(struct inode *dir, struct dentry *dentry, int mode,
          * successful create. Hash it here. */
         spin_lock(&dcache_lock);
         if (d_unhashed(dentry))
-                __d_rehash(dentry, 0);
+                d_rehash_cond(dentry, 0);
         spin_unlock(&dcache_lock);
         RETURN(0);
 }
index c3f80d0..ad7ebdb 100644 (file)
@@ -244,7 +244,7 @@ static int ll_statahead_interpret(struct obd_export *exp,
                 dentry->d_flags &= ~DCACHE_LUSTRE_INVALID;
 #endif
                 unlock_dentry(dentry);
-                __d_rehash(dentry, 0);
+                d_rehash_cond(dentry, 0);
                 spin_unlock(&dcache_lock);
 
                 ll_lookup_finish_locks(it, dentry);