From fceb71c7cf419731a0e061ed6e09659cd149c9ff Mon Sep 17 00:00:00 2001
From: shadow <shadow>
Date: Thu, 6 Dec 2007 10:00:09 +0000
Subject: [PATCH] add support for build HEAD without vfs_intent patches. add
 sles10 support.

---
 lustre/include/lustre_mdc.h                    | 3 +++
 lustre/include/obd.h                           | 2 ++
 lustre/kernel_patches/series/2.6-sles10.series | 3 +--
 lustre/ldlm/ldlm_lock.c                        | 2 ++
 lustre/llite/dcache.c                          | 8 ++++----
 lustre/llite/llite_internal.h                  | 4 ++++
 lustre/llite/namei.c                           | 7 +++----
 lustre/lmv/lmv_intent.c                        | 3 +++
 8 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/lustre/include/lustre_mdc.h b/lustre/include/lustre_mdc.h
index 7b43f4febb..f025eadd10 100644
--- a/lustre/include/lustre_mdc.h
+++ b/lustre/include/lustre_mdc.h
@@ -21,6 +21,9 @@
 #   include <linux/posix_acl_xattr.h>
 #  endif
 # endif
+# ifndef HAVE_VFS_INTENT_PATCHES
+# include <linux/lustre_intent.h>
+# endif
 #endif
 #include <lustre_handles.h>
 #include <libcfs/kp30.h>
diff --git a/lustre/include/obd.h b/lustre/include/obd.h
index 64844a29f2..edad05bb9f 100644
--- a/lustre/include/obd.h
+++ b/lustre/include/obd.h
@@ -1266,6 +1266,8 @@ struct md_open_data {
         struct list_head          mod_replay_list;
 };
 
+struct lookup_intent;
+
 struct md_ops {
         int (*m_getstatus)(struct obd_export *, struct lu_fid *,
                            struct obd_capa **);
diff --git a/lustre/kernel_patches/series/2.6-sles10.series b/lustre/kernel_patches/series/2.6-sles10.series
index 00369209f0..90c0d31c05 100644
--- a/lustre/kernel_patches/series/2.6-sles10.series
+++ b/lustre/kernel_patches/series/2.6-sles10.series
@@ -1,6 +1,4 @@
 lustre_version.patch
-vfs_intent-2.6-sles10.patch
-vfs_races-2.6.18-vanilla.patch
 jbd-2.6.10-jcberr.patch
 export_symbols-2.6.12.patch 
 dev_read_only-2.6-fc5.patch 
@@ -10,6 +8,7 @@ sd_iostats-2.6-rhel5.patch
 export_symbol_numa-2.6-fc5.patch 
 blkdev_tunables-2.6-sles10.patch
 jbd-stats-2.6-sles10.patch
+i_filter_data.patch
 jbd-journal-chksum-2.6-sles10.patch
 proc-sleep-2.6.16-sles10.patch 
 export-nr_free_buffer_pages.patch 
diff --git a/lustre/ldlm/ldlm_lock.c b/lustre/ldlm/ldlm_lock.c
index c7ec85adb2..b42d6a583b 100644
--- a/lustre/ldlm/ldlm_lock.c
+++ b/lustre/ldlm/ldlm_lock.c
@@ -28,7 +28,9 @@
 
 #ifdef __KERNEL__
 # include <libcfs/libcfs.h>
+# ifndef HAVE_VFS_INTENT_PATCHES
 # include <linux/lustre_intent.h>
+# endif
 #else
 # include <liblustre.h>
 # include <libcfs/kp30.h>
diff --git a/lustre/llite/dcache.c b/lustre/llite/dcache.c
index 65100a73fd..1a16669297 100644
--- a/lustre/llite/dcache.c
+++ b/lustre/llite/dcache.c
@@ -520,7 +520,7 @@ out:
 #endif
         }
         RETURN(rc);
-        
+
         /*
          * This part is here to combat evil-evil race in real_lookup on 2.6
          * kernels.  The race details are: We enter do_lookup() looking for some
@@ -544,7 +544,7 @@ do_lookup:
                 ll_lookup_finish_locks(it, de);
                 it = &lookup_it;
         }
-        
+
         /* Do real lookup here. */
         op_data = ll_prep_md_op_data(NULL, parent, NULL, de->d_name.name,
                                      de->d_name.len, 0, (it->it_op & IT_CREAT ?
@@ -560,7 +560,7 @@ do_lookup:
                                                            DLM_REPLY_REC_OFF,
                                                            sizeof(*mdt_body));
                 struct lu_fid fid = {.f_seq = 0, .f_oid = 0, .f_ver = 0};
-                
+
                 if (de->d_inode)
                         fid = *ll_inode2fid(de->d_inode);
 
@@ -731,7 +731,7 @@ int ll_revalidate_nd(struct dentry *dentry, struct nameidata *nd)
                         ll_d2d(dentry)->lld_it = it;
                         it = NULL; /* avoid freeing */
                 }
-                        
+
 out_it:
                 if (it) {
                         ll_intent_release(it);
diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h
index 17da0f15e2..6d0c8c0fae 100644
--- a/lustre/llite/llite_internal.h
+++ b/lustre/llite/llite_internal.h
@@ -21,6 +21,10 @@
 #include <lustre_ver.h>
 #include <lustre_disk.h>  /* for s2sbi */
 
+#ifndef FMODE_EXEC
+#define FMODE_EXEC 0
+#endif
+
 #define LL_IT2STR(it) ((it) ? ldlm_it2str((it)->it_op) : "0")
 #define LUSTRE_FPRIVATE(file) ((file)->private_data)
 
diff --git a/lustre/llite/namei.c b/lustre/llite/namei.c
index c93bb3495f..e6e204af50 100644
--- a/lustre/llite/namei.c
+++ b/lustre/llite/namei.c
@@ -335,20 +335,19 @@ struct dentry *ll_find_alias(struct inode *inode, struct dentry *de)
                        de->d_parent, de->d_inode, atomic_read(&de->d_count));
                 return dentry;
         }
-        
+
         if (last_discon) {
                 CDEBUG(D_DENTRY, "Reuse disconnected dentry %p inode %p "
                         "refc %d\n", last_discon, last_discon->d_inode,
                         atomic_read(&last_discon->d_count));
-                __d_rehash(de, 0);
                 dget_locked(last_discon);
-                __d_move(last_discon, de);
                 spin_unlock(&dcache_lock);
                 d_rehash(de);
+                d_move(last_discon, de);
                 iput(inode);
                 return last_discon;
         }
-       
+
         ll_d_add(de, inode);
 
         spin_unlock(&dcache_lock);
diff --git a/lustre/lmv/lmv_intent.c b/lustre/lmv/lmv_intent.c
index 14f68b6b26..206cb11a27 100644
--- a/lustre/lmv/lmv_intent.c
+++ b/lustre/lmv/lmv_intent.c
@@ -32,6 +32,9 @@
 #include <asm/div64.h>
 #include <linux/seq_file.h>
 #include <linux/namei.h>
+# ifndef HAVE_VFS_INTENT_PATCHES
+# include <linux/lustre_intent.h>
+# endif
 #else
 #include <liblustre.h>
 #endif
-- 
GitLab