])
])
+AC_DEFUN([LC_EXPORT_D_REHASH_COND],
+[LB_CHECK_SYMBOL_EXPORT([d_rehash_cond],
+[fs/dcache.c],[
+AC_DEFINE(HAVE_D_REHASH_COND, 1,
+ [d_rehash_cond is exported by the kernel])
+],[
+])
+])
+
+AC_DEFUN([LC_EXPORT___D_REHASH],
+[LB_CHECK_SYMBOL_EXPORT([__d_rehash],
+[fs/dcache.c],[
+AC_DEFINE(HAVE___D_REHASH, 1,
+ [__d_rehash is exported by the kernel])
+],[
+])
+])
+
+#
+# LC_VFS_INTENT_PATCHES
+#
+# check if the kernel has the VFS intent patches
+AC_DEFUN([LC_VFS_INTENT_PATCHES],
+[AC_MSG_CHECKING([if the kernel has the VFS intent patches])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+ #include <linux/namei.h>
+],[
+ struct nameidata nd;
+ struct lookup_intent *it;
+
+ it = &nd.intent;
+ intent_init(it, IT_OPEN);
+ it->d.lustre.it_disposition = 0;
+ it->d.lustre.it_data = NULL;
+],[
+ AC_MSG_RESULT([yes])
+ AC_DEFINE(HAVE_VFS_INTENT_PATCHES, 1, [VFS intent patches are applied])
+],[
+ AC_MSG_RESULT([no])
+])
+])
#
# LC_PROG_LINUX
LC_TASK_PPTR
# RHEL4 pachess
LC_EXPORT_TRUNCATE_COMPLETE
+LC_EXPORT_D_REHASH_COND
+LC_EXPORT___D_REHASH
LC_STRUCT_KIOBUF
LC_FUNC_COND_RESCHED
LC_COOKIE_FOLLOW_LINK
LC_FUNC_RCU
+# does the kernel have VFS intent patches?
+LC_VFS_INTENT_PATCHES
+
# 2.6.15
LC_INODE_I_MUTEX
#include <linux/proc_fs.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11)
+#ifndef HAVE___D_REHASH
#define __d_rehash(dentry, lock) d_rehash_cond(dentry, lock)
#endif
#include <linux/lustre_version.h>
-#ifndef LUSTRE_KERNEL_VERSION
+#ifndef HAVE_VFS_INTENT_PATCHES
#define IT_OPEN (1)
#define IT_CREAT (1<<1)
#define IT_READDIR (1<<2)
# include <linux/posix_acl_xattr.h>
# endif
# endif
-# ifndef LUSTRE_KERNEL_VERSION
+# ifndef HAVE_VFS_INTENT_PATCHES
# include <linux/lustre_intent.h>
# endif
#endif
#define LUSTRE_PATCHLESS_COMPAT_H
#include <linux/lustre_version.h>
-#ifndef LUSTRE_KERNEL_VERSION
#include <linux/fs.h>
#ifndef HAVE_TRUNCATE_COMPLETE_PAGE
ll_remove_from_page_cache(page);
page_cache_release(page); /* pagecache ref */
}
-#endif
+#endif /* HAVE_TRUNCATE_COMPLETE_PAGE */
+#if !defined(HAVE_D_REHASH_COND) && !defined(HAVE___D_REHASH)
/* megahack */
static inline void d_rehash_cond(struct dentry * entry, int lock)
{
}
#define __d_rehash(dentry, lock) d_rehash_cond(dentry, lock)
-
-#define LUSTRE_PATCHLESS
+#endif /* !HAVE_D_REHASH_COND && !HAVE___D_REHASH*/
#ifndef ATTR_FROM_OPEN
#define ATTR_FROM_OPEN 0
#define ATTR_RAW 0
#endif
-#endif /* LUSTRE_KERNEL_VERSION */
-
#endif
--- /dev/null
+Index: linux-2.6.18.8/arch/i386/kernel/smpboot.c
+===================================================================
+--- linux-2.6.18.8.orig/arch/i386/kernel/smpboot.c 2007-06-05 13:20:25.000000000 +0200
++++ linux-2.6.18.8/arch/i386/kernel/smpboot.c 2007-06-05 13:20:33.000000000 +0200
+@@ -607,6 +607,7 @@ extern struct {
+ /* which logical CPUs are on which nodes */
+ cpumask_t node_2_cpu_mask[MAX_NUMNODES] __read_mostly =
+ { [0 ... MAX_NUMNODES-1] = CPU_MASK_NONE };
++EXPORT_SYMBOL(node_2_cpu_mask);
+ /* which node each logical CPU is on */
+ int cpu_2_node[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = 0 };
+ EXPORT_SYMBOL(cpu_2_node);
+Index: linux-2.6.18.8/arch/ia64/kernel/numa.c
+===================================================================
+--- linux-2.6.18.8.orig/arch/ia64/kernel/numa.c 2007-06-05 13:21:04.000000000 +0200
++++ linux-2.6.18.8/arch/ia64/kernel/numa.c 2007-06-05 13:21:28.000000000 +0200
+@@ -28,6 +28,7 @@ u16 cpu_to_node_map[NR_CPUS] __cacheline
+ EXPORT_SYMBOL(cpu_to_node_map);
+
+ cpumask_t node_to_cpu_mask[MAX_NUMNODES] __cacheline_aligned;
++EXPORT_SYMBOL(node_to_cpu_mask);
+
+ void __cpuinit map_cpu_to_node(int cpu, int nid)
+ {
--- /dev/null
+Index: linux-2.6.18.8/include/linux/fs.h
+===================================================================
+--- linux-2.6.18.8.orig/include/linux/fs.h 2007-06-05 12:55:19.000000000 +0200
++++ linux-2.6.18.8/include/linux/fs.h 2007-06-05 12:55:44.000000000 +0200
+@@ -533,6 +533,7 @@ struct inode {
+ struct block_device *i_bdev;
+ struct cdev *i_cdev;
+ int i_cindex;
++ void *i_filterdata;
+
+ __u32 i_generation;
+
+++ /dev/null
-Index: linux-2.6/fs/inode.c
-===================================================================
---- linux-2.6.orig/fs/inode.c 2006-08-31 11:17:39.000000000 +0800
-+++ linux-2.6/fs/inode.c 2006-08-31 11:23:48.000000000 +0800
-@@ -234,6 +234,7 @@ void __iget(struct inode * inode)
- inodes_stat.nr_unused--;
- }
-
-+EXPORT_SYMBOL(__iget);
- /**
- * clear_inode - clear an inode
- * @inode: inode to clear
-Index: linux-2.6/fs/open.c
-===================================================================
---- linux-2.6.orig/fs/open.c 2006-08-31 11:17:39.000000000 +0800
-+++ linux-2.6/fs/open.c 2006-08-31 11:59:09.000000000 +0800
-@@ -226,11 +226,12 @@ static long do_sys_truncate(const char _
- struct inode * inode;
- int error;
-
-+ intent_init(&nd.intent.open, IT_GETATTR);
- error = -EINVAL;
- if (length < 0) /* sorry, but loff_t says... */
- goto out;
-
-- error = user_path_walk(path, &nd);
-+ error = user_path_walk_it(path, &nd);
- if (error)
- goto out;
- inode = nd.dentry->d_inode;
-@@ -495,6 +496,7 @@ asmlinkage long sys_faccessat(int dfd, c
- int old_fsuid, old_fsgid;
- kernel_cap_t old_cap;
- int res;
-+ intent_init(&nd.intent.open, IT_GETATTR);
-
- if (mode & ~S_IRWXO) /* where's F_OK, X_OK, W_OK, R_OK? */
- return -EINVAL;
-@@ -519,7 +521,7 @@ asmlinkage long sys_faccessat(int dfd, c
- else
- current->cap_effective = current->cap_permitted;
-
-- res = __user_walk_fd(dfd, filename, LOOKUP_FOLLOW|LOOKUP_ACCESS, &nd);
-+ res = __user_walk_fd_it(dfd, filename, LOOKUP_FOLLOW|LOOKUP_ACCESS, &nd);
- if (!res) {
- res = vfs_permission(&nd, mode);
- /* SuS v2 requires we report a read only fs too */
-@@ -545,8 +547,9 @@ asmlinkage long sys_chdir(const char __u
- {
- struct nameidata nd;
- int error;
-+ intent_init(&nd.intent.open, IT_GETATTR);
-
-- error = __user_walk(filename, LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &nd);
-+ error = __user_walk_it(filename, LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &nd);
- if (error)
- goto out;
-
-@@ -596,8 +599,9 @@ asmlinkage long sys_chroot(const char __
- {
- struct nameidata nd;
- int error;
-+ intent_init(&nd.intent.open, IT_GETATTR);
-
-- error = __user_walk(filename, LOOKUP_FOLLOW | LOOKUP_DIRECTORY | LOOKUP_NOALT, &nd);
-+ error = __user_walk_it(filename, LOOKUP_FOLLOW | LOOKUP_DIRECTORY | LOOKUP_NOALT, &nd);
- if (error)
- goto out;
-
-@@ -823,6 +827,7 @@ static struct file *__dentry_open(struct
- error = open(inode, f);
- if (error)
- goto cleanup_all;
-+ intent_release(f->f_it);
- }
-
- f->f_flags &= ~(O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC);
-@@ -849,6 +854,7 @@ cleanup_all:
- f->f_dentry = NULL;
- f->f_vfsmnt = NULL;
- cleanup_file:
-+ intent_release(f->f_it);
- put_filp(f);
- dput(dentry);
- mntput(mnt);
-@@ -874,6 +880,7 @@ static struct file *do_filp_open(int dfd
- {
- int namei_flags, error;
- struct nameidata nd;
-+ intent_init(&nd.intent.open, IT_OPEN);
-
- namei_flags = flags;
- if ((namei_flags+1) & O_ACCMODE)
-@@ -944,6 +951,7 @@ struct file *nameidata_to_filp(struct na
-
- /* Pick up the filp from the open intent */
- filp = nd->intent.open.file;
-+ filp->f_it = &nd->intent.open;
- /* Has the filesystem initialised the file for us? */
- if (filp->f_dentry == NULL)
- filp = __dentry_open(nd->dentry, nd->mnt, flags, filp, NULL);
-Index: linux-2.6/fs/nfsctl.c
-===================================================================
---- linux-2.6.orig/fs/nfsctl.c 2006-08-31 11:17:39.000000000 +0800
-+++ linux-2.6/fs/nfsctl.c 2006-08-31 11:23:48.000000000 +0800
-@@ -25,6 +25,7 @@ static struct file *do_open(char *name,
- struct nameidata nd;
- int error;
-
-+ intent_init(&nd.intent.open, IT_OPEN);
- nd.mnt = do_kern_mount("nfsd", 0, "nfsd", NULL);
-
- if (IS_ERR(nd.mnt))
-Index: linux-2.6/fs/namei.c
-===================================================================
---- linux-2.6.orig/fs/namei.c 2006-08-31 11:17:39.000000000 +0800
-+++ linux-2.6/fs/namei.c 2006-08-31 11:59:09.000000000 +0800
-@@ -344,8 +344,19 @@ int deny_write_access(struct file * file
- return 0;
- }
-
-+void intent_release(struct lookup_intent *it)
-+{
-+ if (!it)
-+ return;
-+ if (it->it_magic != INTENT_MAGIC)
-+ return;
-+ if (it->it_op_release)
-+ it->it_op_release(it);
-+}
-+
- void path_release(struct nameidata *nd)
- {
-+ intent_release(&nd->intent);
- dput(nd->dentry);
- mntput(nd->mnt);
- }
-@@ -447,8 +458,12 @@ static struct dentry * real_lookup(struc
- {
- struct dentry * result;
- struct inode *dir = parent->d_inode;
-+ int counter = 0;
-
- mutex_lock(&dir->i_mutex);
-+again:
-+ counter++;
-+
- /*
- * First re-do the cached lookup just in case it was created
- * while we waited for the directory semaphore..
-@@ -482,13 +497,16 @@ static struct dentry * real_lookup(struc
- * Uhhuh! Nasty case: the cache was re-populated while
- * we waited on the semaphore. Need to revalidate.
- */
-- mutex_unlock(&dir->i_mutex);
- if (result->d_op && result->d_op->d_revalidate) {
- if (!result->d_op->d_revalidate(result, nd) && !d_invalidate(result)) {
- dput(result);
-- result = ERR_PTR(-ENOENT);
-+ if (counter > 10)
-+ result = ERR_PTR(-ESTALE);
-+ if (!IS_ERR(result))
-+ goto again;
- }
- }
-+ mutex_unlock(&dir->i_mutex);
- return result;
- }
-
-@@ -516,7 +534,9 @@ walk_init_root(const char *name, struct
- static __always_inline int __vfs_follow_link(struct nameidata *nd, const char *link)
- {
- int res = 0;
-+ struct lookup_intent it = nd->intent.open;
- char *name;
-+
- if (IS_ERR(link))
- goto fail;
-
-@@ -526,6 +546,10 @@ static __always_inline int __vfs_follow_
- /* weird __emul_prefix() stuff did it */
- goto out;
- }
-+ intent_init(&nd->intent.open, it.it_op);
-+ nd->intent.open.it_flags = it.it_flags;
-+ nd->intent.open.it_create_mode = it.it_create_mode;
-+ nd->intent.open.file = it.file;
- res = link_path_walk(link, nd);
- out:
- if (nd->depth || res || nd->last_type!=LAST_NORM)
-@@ -778,6 +802,33 @@ fail:
- return PTR_ERR(dentry);
- }
-
-+static int revalidate_special(struct nameidata *nd)
-+{
-+ struct dentry *dentry = nd->dentry;
-+ int err, counter = 0;
-+
-+ revalidate_again:
-+ if (!dentry->d_op || !dentry->d_op->d_revalidate)
-+ return 0;
-+ if (!dentry->d_op->d_revalidate(dentry, nd)) {
-+ struct dentry *new;
-+ if ((err = permission(dentry->d_parent->d_inode, MAY_EXEC, nd)))
-+ return err;
-+ new = real_lookup(dentry->d_parent, &dentry->d_name, nd);
-+ if (IS_ERR(new))
-+ return PTR_ERR(new);
-+ d_invalidate(dentry);
-+ dput(dentry);
-+ nd->dentry = dentry = new;
-+ counter++;
-+ if (counter < 10)
-+ goto revalidate_again;
-+ printk("excessive revalidate_it loops\n");
-+ return -ESTALE;
-+ }
-+ return 0;
-+}
-+
- /*
- * Name resolution.
- * This is the basic name resolution function, turning a pathname into
-@@ -874,7 +925,11 @@ static fastcall int __link_path_walk(con
- goto out_dput;
-
- if (inode->i_op->follow_link) {
-+ int save_flags = nd->flags;
-+ nd->flags |= LOOKUP_LINK_NOTLAST;
- err = do_follow_link(&next, nd);
-+ if (!(save_flags & LOOKUP_LINK_NOTLAST))
-+ nd->flags &= ~LOOKUP_LINK_NOTLAST;
- if (err)
- goto return_err;
- err = -ENOENT;
-@@ -909,6 +964,23 @@ last_component:
- inode = nd->dentry->d_inode;
- /* fallthrough */
- case 1:
-+ nd->flags |= LOOKUP_LAST;
-+ err = revalidate_special(nd);
-+ nd->flags &= ~LOOKUP_LAST;
-+ if (!nd->dentry->d_inode)
-+ err = -ENOENT;
-+ if (err) {
-+ path_release(nd);
-+ goto return_err;
-+ }
-+ if (lookup_flags & LOOKUP_DIRECTORY) {
-+ err = -ENOTDIR;
-+ if(!nd->dentry->d_inode->i_op ||
-+ !nd->dentry->d_inode->i_op->lookup) {
-+ path_release(nd);
-+ goto return_err;
-+ }
-+ }
- goto return_reval;
- }
- if (nd->dentry->d_op && nd->dentry->d_op->d_hash) {
-@@ -916,7 +988,9 @@ last_component:
- if (err < 0)
- break;
- }
-+ nd->flags |= LOOKUP_LAST;
- err = do_lookup(nd, &this, &next);
-+ nd->flags &= ~LOOKUP_LAST;
- if (err)
- break;
- inode = next.dentry->d_inode;
-@@ -1268,7 +1342,7 @@ static struct dentry *lookup_hash(struct
- }
-
- /* SMP-safe */
--struct dentry * lookup_one_len(const char * name, struct dentry * base, int len)
-+struct dentry * lookup_one_len_it(const char * name, struct dentry * base, int len, struct nameidata *nd)
- {
- unsigned long hash;
- struct qstr this;
-@@ -1288,11 +1362,17 @@ struct dentry * lookup_one_len(const cha
- }
- this.hash = end_name_hash(hash);
-
-- return __lookup_hash(&this, base, NULL);
-+ return __lookup_hash(&this, base, nd);
- access:
- return ERR_PTR(-EACCES);
- }
-
-+struct dentry * lookup_one_len(const char * name, struct dentry * base, int len)
-+{
-+ return lookup_one_len_it(name, base, len, NULL);
-+}
-+
-+
- /*
- * namei()
- *
-@@ -1304,8 +1384,9 @@ access:
- * that namei follows links, while lnamei does not.
- * SMP-safe
- */
--int fastcall __user_walk_fd(int dfd, const char __user *name, unsigned flags,
-- struct nameidata *nd)
-+
-+int fastcall __user_walk_fd_it(int dfd, const char __user *name, unsigned flags,
-+ struct nameidata *nd)
- {
- char *tmp = getname(name);
- int err = PTR_ERR(tmp);
-@@ -1317,9 +1398,22 @@ int fastcall __user_walk_fd(int dfd, con
- return err;
- }
-
-+int fastcall __user_walk_fd(int dfd, const char __user *name, unsigned flags,
-+ struct nameidata *nd)
-+{
-+ intent_init(&nd->intent.open, IT_LOOKUP);
-+ return __user_walk_fd_it(dfd, name, flags, nd);
-+}
-+
-+int fastcall __user_walk_it(const char __user *name, unsigned flags, struct nameidata *nd)
-+{
-+ return __user_walk_fd_it(AT_FDCWD, name, flags, nd);
-+}
-+
- int fastcall __user_walk(const char __user *name, unsigned flags, struct nameidata *nd)
- {
-- return __user_walk_fd(AT_FDCWD, name, flags, nd);
-+ intent_init(&nd->intent.open, IT_LOOKUP);
-+ return __user_walk_it(name, flags, nd);
- }
-
- /*
-@@ -1600,6 +1694,8 @@ int open_namei(int dfd, const char *path
- if (flag & O_APPEND)
- acc_mode |= MAY_APPEND;
-
-+ nd->intent.open.it_flags = flag;
-+ nd->intent.open.it_create_mode = mode;
- /*
- * The simplest case - just a plain lookup.
- */
-@@ -1614,6 +1710,7 @@ int open_namei(int dfd, const char *path
- /*
- * Create - we need to know the parent.
- */
-+ nd->intent.open.it_op |= IT_CREAT;
- error = path_lookup_create(dfd,pathname,LOOKUP_PARENT,nd,flag,mode);
- if (error)
- return error;
-@@ -1630,7 +1727,9 @@ int open_namei(int dfd, const char *path
- dir = nd->dentry;
- nd->flags &= ~LOOKUP_PARENT;
- mutex_lock(&dir->d_inode->i_mutex);
-+ nd->flags |= LOOKUP_LAST;
- path.dentry = lookup_hash(nd);
-+ nd->flags &= ~LOOKUP_LAST;
- path.mnt = nd->mnt;
-
- do_last:
-@@ -1746,7 +1845,9 @@ do_link:
- }
- dir = nd->dentry;
- mutex_lock(&dir->d_inode->i_mutex);
-+ nd->flags |= LOOKUP_LAST;
- path.dentry = lookup_hash(nd);
-+ nd->flags &= ~LOOKUP_LAST;
- path.mnt = nd->mnt;
- __putname(nd->last.name);
- goto do_last;
-@@ -2260,6 +2361,9 @@ asmlinkage long sys_linkat(int olddfd, c
- int error;
- char * to;
-
-+ intent_init(&nd.intent.open, IT_LOOKUP);
-+ intent_init(&old_nd.intent.open, IT_LOOKUP);
-+
- if ((flags & ~AT_SYMLINK_FOLLOW) != 0)
- return -EINVAL;
-
-@@ -2267,7 +2371,7 @@ asmlinkage long sys_linkat(int olddfd, c
- if (IS_ERR(to))
- return PTR_ERR(to);
-
-- error = __user_walk_fd(olddfd, oldname,
-+ error = __user_walk_fd_it(olddfd, oldname,
- flags & AT_SYMLINK_FOLLOW ? LOOKUP_FOLLOW : 0,
- &old_nd);
- if (error)
-Index: linux-2.6/fs/stat.c
-===================================================================
---- linux-2.6.orig/fs/stat.c 2006-08-31 11:17:39.000000000 +0800
-+++ linux-2.6/fs/stat.c 2006-08-31 11:23:48.000000000 +0800
-@@ -37,7 +37,7 @@ void generic_fillattr(struct inode *inod
-
- EXPORT_SYMBOL(generic_fillattr);
-
--int vfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
-+int vfs_getattr_it(struct vfsmount *mnt, struct dentry *dentry, struct lookup_intent *it, struct kstat *stat)
- {
- struct inode *inode = dentry->d_inode;
- int retval;
-@@ -46,6 +46,8 @@ int vfs_getattr(struct vfsmount *mnt, st
- if (retval)
- return retval;
-
-+ if (inode->i_op->getattr_it)
-+ return inode->i_op->getattr_it(mnt, dentry, it, stat);
- if (inode->i_op->getattr)
- return inode->i_op->getattr(mnt, dentry, stat);
-
-@@ -60,6 +62,11 @@ int vfs_getattr(struct vfsmount *mnt, st
- return 0;
- }
-
-+int vfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
-+{
-+ return vfs_getattr_it(mnt, dentry, NULL, stat);
-+}
-+
- EXPORT_SYMBOL(vfs_getattr);
-
- int vfs_stat_fd(int dfd, char __user *name, struct kstat *stat)
-@@ -67,9 +74,10 @@ int vfs_stat_fd(int dfd, char __user *na
- struct nameidata nd;
- int error;
-
-- error = __user_walk_fd(dfd, name, LOOKUP_FOLLOW, &nd);
-+ intent_init(&nd.intent.open, IT_GETATTR);
-+ error = __user_walk_fd_it(dfd, name, LOOKUP_FOLLOW, &nd);
- if (!error) {
-- error = vfs_getattr(nd.mnt, nd.dentry, stat);
-+ error = vfs_getattr_it(nd.mnt, nd.dentry, &nd.intent.open, stat);
- path_release(&nd);
- }
- return error;
-@@ -87,9 +95,10 @@ int vfs_lstat_fd(int dfd, char __user *n
- struct nameidata nd;
- int error;
-
-- error = __user_walk_fd(dfd, name, 0, &nd);
-+ intent_init(&nd.intent.open, IT_GETATTR);
-+ error = __user_walk_fd_it(dfd, name, 0, &nd);
- if (!error) {
-- error = vfs_getattr(nd.mnt, nd.dentry, stat);
-+ error = vfs_getattr_it(nd.mnt, nd.dentry, &nd.intent.open, stat);
- path_release(&nd);
- }
- return error;
-@@ -106,9 +115,12 @@ int vfs_fstat(unsigned int fd, struct ks
- {
- struct file *f = fget(fd);
- int error = -EBADF;
-+ struct nameidata nd;
-+ intent_init(&nd.intent.open, IT_GETATTR);
-
- if (f) {
-- error = vfs_getattr(f->f_vfsmnt, f->f_dentry, stat);
-+ error = vfs_getattr_it(f->f_vfsmnt, f->f_dentry, &nd.intent.open, stat);
-+ intent_release(&nd.intent.open);
- fput(f);
- }
- return error;
-Index: linux-2.6/fs/namespace.c
-===================================================================
---- linux-2.6.orig/fs/namespace.c 2006-08-31 11:17:39.000000000 +0800
-+++ linux-2.6/fs/namespace.c 2006-08-31 11:59:07.000000000 +0800
-@@ -73,6 +73,7 @@ struct vfsmount *alloc_vfsmnt(const char
- INIT_LIST_HEAD(&mnt->mnt_share);
- INIT_LIST_HEAD(&mnt->mnt_slave_list);
- INIT_LIST_HEAD(&mnt->mnt_slave);
-+ INIT_LIST_HEAD(&mnt->mnt_lustre_list);
- if (name) {
- int size = strlen(name) + 1;
- char *newname = kmalloc(size, GFP_KERNEL);
-@@ -162,6 +163,7 @@ static void __touch_namespace(struct nam
-
- static void detach_mnt(struct vfsmount *mnt, struct nameidata *old_nd)
- {
-+ memset(old_nd, 0, sizeof(*old_nd));
- old_nd->dentry = mnt->mnt_mountpoint;
- old_nd->mnt = mnt->mnt_parent;
- mnt->mnt_parent = mnt;
-@@ -280,6 +282,9 @@ static inline void __mntput(struct vfsmo
- {
- struct super_block *sb = mnt->mnt_sb;
- dput(mnt->mnt_root);
-+ spin_lock(&dcache_lock);
-+ list_del(&mnt->mnt_lustre_list);
-+ spin_unlock(&dcache_lock);
- free_vfsmnt(mnt);
- deactivate_super(sb);
- }
-@@ -582,6 +587,8 @@ static int do_umount(struct vfsmount *mn
- */
-
- lock_kernel();
-+ if (sb->s_op->umount_lustre)
-+ sb->s_op->umount_lustre(sb);
- if (sb->s_op->umount_begin)
- sb->s_op->umount_begin(mnt, flags);
- unlock_kernel();
-@@ -914,6 +921,7 @@ static int do_loopback(struct nameidata
- return err;
- if (!old_name || !*old_name)
- return -EINVAL;
-+ intent_init(&old_nd.intent.open, IT_LOOKUP);
- err = path_lookup(old_name, LOOKUP_FOLLOW, &old_nd);
- if (err)
- return err;
-@@ -999,6 +1007,7 @@ static int do_move_mount(struct nameidat
- return -EPERM;
- if (!old_name || !*old_name)
- return -EINVAL;
-+ intent_init(&old_nd.intent.open, IT_LOOKUP);
- err = path_lookup(old_name, LOOKUP_FOLLOW, &old_nd);
- if (err)
- return err;
-@@ -1388,6 +1397,7 @@ long do_mount(char *dev_name, char *dir_
- int retval = 0;
- int mnt_flags = 0;
-
-+ intent_init(&nd.intent.open, IT_LOOKUP);
- /* Discard magic */
- if ((flags & MS_MGC_MSK) == MS_MGC_VAL)
- flags &= ~MS_MGC_MSK;
-Index: linux-2.6/fs/exec.c
-===================================================================
---- linux-2.6.orig/fs/exec.c 2006-08-31 11:17:39.000000000 +0800
-+++ linux-2.6/fs/exec.c 2006-08-31 11:59:09.000000000 +0800
-@@ -127,6 +127,7 @@ asmlinkage long sys_uselib(const char __
- struct nameidata nd;
- int error;
-
-+ intent_init(&nd.intent.open, IT_OPEN);
- error = __user_path_lookup_open(library, LOOKUP_FOLLOW, &nd, FMODE_READ|FMODE_EXEC);
- if (error)
- goto out;
-@@ -477,6 +478,7 @@ struct file *open_exec(const char *name)
- int err;
- struct file *file;
-
-+ intent_init(&nd.intent.open, IT_OPEN);
- err = path_lookup_open(AT_FDCWD, name, LOOKUP_FOLLOW, &nd, FMODE_READ|FMODE_EXEC);
- file = ERR_PTR(err);
-
-Index: linux-2.6/include/linux/dcache.h
-===================================================================
---- linux-2.6.orig/include/linux/dcache.h 2006-08-31 11:17:39.000000000 +0800
-+++ linux-2.6/include/linux/dcache.h 2006-08-31 12:00:07.000000000 +0800
-@@ -36,6 +36,9 @@ struct qstr {
- const unsigned char *name;
- };
-
-+struct inode;
-+#include <linux/namei.h>
-+
- struct dentry_stat_t {
- int nr_dentry;
- int nr_unused;
-Index: linux-2.6/include/linux/fs.h
-===================================================================
---- linux-2.6.orig/include/linux/fs.h 2006-08-31 11:17:39.000000000 +0800
-+++ linux-2.6/include/linux/fs.h 2006-08-31 11:59:09.000000000 +0800
-@@ -280,6 +280,8 @@ typedef void (dio_iodone_t)(struct kiocb
- #define ATTR_KILL_SUID 2048
- #define ATTR_KILL_SGID 4096
- #define ATTR_FILE 8192
-+#define ATTR_RAW 16384 /* file system, not vfs will massage attrs */
-+#define ATTR_FROM_OPEN 32768 /* called from open path, ie O_TRUNC */
-
- /*
- * This is the Inode Attributes structure, used for notify_change(). It
-@@ -533,6 +535,7 @@ struct inode {
- struct block_device *i_bdev;
- struct cdev *i_cdev;
- int i_cindex;
-+ void *i_filterdata;
-
- __u32 i_generation;
-
-@@ -700,6 +703,7 @@ struct file {
- spinlock_t f_ep_lock;
- #endif /* #ifdef CONFIG_EPOLL */
- struct address_space *f_mapping;
-+ struct lookup_intent *f_it;
- };
- extern spinlock_t files_lock;
- #define file_list_lock() spin_lock(&files_lock);
-@@ -1100,7 +1104,9 @@ struct inode_operations {
- void (*truncate) (struct inode *);
- int (*permission) (struct inode *, int, struct nameidata *);
- int (*setattr) (struct dentry *, struct iattr *);
-+ int (*setattr_raw) (struct inode *, struct iattr *);
- int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *);
-+ int (*getattr_it) (struct vfsmount *, struct dentry *, struct lookup_intent *, struct kstat *);
- int (*setxattr) (struct dentry *, const char *,const void *,size_t,int);
- ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
- ssize_t (*listxattr) (struct dentry *, char *, size_t);
-@@ -1141,6 +1147,7 @@ struct super_operations {
- int (*remount_fs) (struct super_block *, int *, char *);
- void (*clear_inode) (struct inode *);
- void (*umount_begin) (struct vfsmount *, int);
-+ void (*umount_lustre) (struct super_block *);
-
- int (*show_options)(struct seq_file *, struct vfsmount *);
- int (*show_stats)(struct seq_file *, struct vfsmount *);
-@@ -1363,6 +1370,7 @@ extern int may_umount_tree(struct vfsmou
- extern int may_umount(struct vfsmount *);
- extern void umount_tree(struct vfsmount *, int, struct list_head *);
- extern void release_mounts(struct list_head *);
-+struct vfsmount *do_kern_mount(const char *type, int flags, const char *name, void *data);
- extern long do_mount(char *, char *, char *, unsigned long, void *);
- extern struct vfsmount *copy_tree(struct vfsmount *, struct dentry *, int);
- extern void mnt_set_mountpoint(struct vfsmount *, struct dentry *,
-@@ -1424,6 +1432,7 @@ extern long do_sys_open(int fdf, const c
- int mode);
- extern struct file *filp_open(const char *, int, int);
- extern struct file * dentry_open(struct dentry *, struct vfsmount *, int);
-+extern struct file * dentry_open_it(struct dentry *, struct vfsmount *, int, struct lookup_intent *);
- extern int filp_close(struct file *, fl_owner_t id);
- extern char * getname(const char __user *);
-
-Index: linux-2.6/include/linux/namei.h
-===================================================================
---- linux-2.6.orig/include/linux/namei.h 2006-08-31 11:17:39.000000000 +0800
-+++ linux-2.6/include/linux/namei.h 2006-08-31 11:23:48.000000000 +0800
-@@ -5,10 +5,39 @@
-
- struct vfsmount;
-
-+#define IT_OPEN (1)
-+#define IT_CREAT (1<<1)
-+#define IT_READDIR (1<<2)
-+#define IT_GETATTR (1<<3)
-+#define IT_LOOKUP (1<<4)
-+#define IT_UNLINK (1<<5)
-+#define IT_TRUNC (1<<6)
-+#define IT_GETXATTR (1<<7)
-+
-+struct lustre_intent_data {
-+ int it_disposition;
-+ int it_status;
-+ __u64 it_lock_handle;
-+ void *it_data;
-+ int it_lock_mode;
-+};
-+
-+#define INTENT_MAGIC 0x19620323
-+
-+#define it_flags flags
-+#define it_create_mode create_mode
-+#define lookup_intent open_intent
-+
- struct open_intent {
-- int flags;
-- int create_mode;
-- struct file *file;
-+ int it_magic;
-+ void (*it_op_release)(struct open_intent *);
-+ int it_op;
-+ int flags;
-+ int create_mode;
-+ struct file *file;
-+ union {
-+ struct lustre_intent_data lustre;
-+ } d;
- };
-
- enum { MAX_NESTED_LINKS = 8 };
-@@ -28,6 +57,13 @@ struct nameidata {
- } intent;
- };
-
-+static inline void intent_init(struct lookup_intent *it, int op)
-+{
-+ memset(it, 0, sizeof(*it));
-+ it->it_magic = INTENT_MAGIC;
-+ it->it_op = op;
-+}
-+
- /*
- * Type of the last component on LOOKUP_PARENT
- */
-@@ -48,6 +84,8 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LA
- #define LOOKUP_PARENT 16
- #define LOOKUP_NOALT 32
- #define LOOKUP_REVAL 64
-+#define LOOKUP_LAST (0x1000)
-+#define LOOKUP_LINK_NOTLAST (0x2000)
- /*
- * Intent data
- */
-@@ -57,10 +95,19 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LA
-
- extern int FASTCALL(__user_walk(const char __user *, unsigned, struct nameidata *));
- extern int FASTCALL(__user_walk_fd(int dfd, const char __user *, unsigned, struct nameidata *));
-+extern int FASTCALL(__user_walk_fd_it(int dfd, const char __user *, unsigned, struct nameidata *));
- #define user_path_walk(name,nd) \
- __user_walk_fd(AT_FDCWD, name, LOOKUP_FOLLOW, nd)
- #define user_path_walk_link(name,nd) \
- __user_walk_fd(AT_FDCWD, name, 0, nd)
-+
-+extern int FASTCALL(__user_walk_it(const char __user *name, unsigned flags, struct nameidata *nd));
-+#define user_path_walk_it(name,nd) \
-+ __user_walk_it(name, LOOKUP_FOLLOW, nd)
-+#define user_path_walk_link_it(name,nd) \
-+ __user_walk_it(name, 0, nd)
-+extern void intent_release(struct lookup_intent *);
-+
- extern int FASTCALL(path_lookup(const char *, unsigned, struct nameidata *));
- extern int FASTCALL(path_walk(const char *, struct nameidata *));
- extern int FASTCALL(link_path_walk(const char *, struct nameidata *));
-Index: linux-2.6/include/linux/mount.h
-===================================================================
---- linux-2.6.orig/include/linux/mount.h 2006-08-31 11:17:40.000000000 +0800
-+++ linux-2.6/include/linux/mount.h 2006-08-31 11:23:48.000000000 +0800
-@@ -53,6 +53,8 @@ struct vfsmount {
- struct list_head mnt_slave; /* slave list entry */
- struct vfsmount *mnt_master; /* slave is on master->mnt_slave_list */
- struct namespace *mnt_namespace; /* containing namespace */
-+ struct list_head mnt_lustre_list; /* GNS mount list */
-+ unsigned long mnt_last_used; /* for GNS auto-umount (jiffies) */
- int mnt_pinned;
- };
-
+++ /dev/null
-Index: linux-2.6/net/unix/af_unix.c
-===================================================================
---- linux-2.6.orig/net/unix/af_unix.c 2006-07-15 21:01:06.000000000 +0800
-+++ linux-2.6/net/unix/af_unix.c 2006-07-15 21:01:13.000000000 +0800
-@@ -706,6 +706,7 @@ static struct sock *unix_find_other(stru
- int err = 0;
-
- if (sunname->sun_path[0]) {
-+ intent_init(&nd.intent, IT_LOOKUP);
- err = path_lookup(sunname->sun_path, LOOKUP_FOLLOW, &nd);
- if (err)
- goto fail;
-Index: linux-2.6/fs/open.c
-===================================================================
---- linux-2.6.orig/fs/open.c 2006-07-15 21:01:10.000000000 +0800
-+++ linux-2.6/fs/open.c 2006-07-15 21:01:31.000000000 +0800
-@@ -198,9 +198,10 @@ out:
- }
-
- int do_truncate(struct dentry *dentry, loff_t length, unsigned int time_attrs,
-- struct file *filp)
-+ struct file *filp, int called_from_open)
- {
- int err;
-+ struct inode_operations *op = dentry->d_inode->i_op;
- struct iattr newattrs;
-
- /* Not pretty: "inode->i_size" shouldn't really be signed. But it is. */
-@@ -215,7 +216,17 @@ int do_truncate(struct dentry *dentry, l
- }
-
- mutex_lock(&dentry->d_inode->i_mutex);
-- err = notify_change(dentry, &newattrs);
-+ if (called_from_open)
-+ newattrs.ia_valid |= ATTR_FROM_OPEN;
-+ if (op->setattr_raw) {
-+ newattrs.ia_valid |= ATTR_RAW;
-+ newattrs.ia_ctime = CURRENT_TIME;
-+ down_write(&dentry->d_inode->i_alloc_sem);
-+ err = op->setattr_raw(dentry->d_inode, &newattrs);
-+ up_write(&dentry->d_inode->i_alloc_sem);
-+ } else
-+ err = notify_change(dentry, &newattrs);
-+
- mutex_unlock(&dentry->d_inode->i_mutex);
- return err;
- }
-@@ -270,7 +281,7 @@ static long do_sys_truncate(const char _
- error = locks_verify_truncate(inode, NULL, length);
- if (!error) {
- DQUOT_INIT(inode);
-- error = do_truncate(nd.dentry, length, 0, NULL);
-+ error = do_truncate(nd.dentry, length, 0, NULL, 0);
- }
- put_write_access(inode);
-
-@@ -322,7 +333,7 @@ static long do_sys_ftruncate(unsigned in
-
- error = locks_verify_truncate(inode, file, length);
- if (!error)
-- error = do_truncate(dentry, length, ATTR_MTIME|ATTR_CTIME, file);
-+ error = do_truncate(dentry, length, ATTR_MTIME|ATTR_CTIME, file, 0);
- out_putf:
- fput(file);
- out:
-@@ -407,9 +418,20 @@ asmlinkage long sys_utime(char __user *
- (error = vfs_permission(&nd, MAY_WRITE)) != 0)
- goto dput_and_out;
- }
-- mutex_lock(&inode->i_mutex);
-- error = notify_change(nd.dentry, &newattrs);
-- mutex_unlock(&inode->i_mutex);
-+ if (inode->i_op->setattr_raw) {
-+ struct inode_operations *op = nd.dentry->d_inode->i_op;
-+
-+ newattrs.ia_valid |= ATTR_RAW;
-+ error = op->setattr_raw(inode, &newattrs);
-+ /* the file system wants to use normal vfs path now */
-+ if (error != -EOPNOTSUPP)
-+ goto dput_and_out;
-+ } else {
-+ mutex_lock(&inode->i_mutex);
-+ error = notify_change(nd.dentry, &newattrs);
-+ mutex_unlock(&inode->i_mutex);
-+ }
-+
- dput_and_out:
- path_release(&nd);
- out:
-@@ -621,38 +643,53 @@ out:
- return error;
- }
-
--asmlinkage long sys_fchmod(unsigned int fd, mode_t mode)
-+int chmod_common(struct dentry *dentry, mode_t mode)
- {
-- struct inode * inode;
-- struct dentry * dentry;
-- struct file * file;
-- int err = -EBADF;
-+ struct inode * inode = dentry->d_inode;
- struct iattr newattrs;
--
-- file = fget(fd);
-- if (!file)
-+ int error = -EROFS;
-+
-+ if (IS_RDONLY(inode))
- goto out;
-
-- dentry = file->f_dentry;
-- inode = dentry->d_inode;
-+ if (inode->i_op->setattr_raw) {
-+ struct inode_operations *op = dentry->d_inode->i_op;
-
-- audit_inode(NULL, inode);
-+ newattrs.ia_mode = mode;
-+ newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
-+ newattrs.ia_valid |= ATTR_RAW;
-+ error = op->setattr_raw(inode, &newattrs);
-+ /* the file system wants to use normal vfs path now */
-+ if (error != -EOPNOTSUPP)
-+ goto out;
-+ }
-
-- err = -EROFS;
-- if (IS_RDONLY(inode))
-- goto out_putf;
-- err = -EPERM;
-+ error = -EPERM;
- if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
-- goto out_putf;
-+ goto out;
-+
- mutex_lock(&inode->i_mutex);
- if (mode == (mode_t) -1)
- mode = inode->i_mode;
- newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
- newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
-- err = notify_change(dentry, &newattrs);
-+ error = notify_change(dentry, &newattrs);
- mutex_unlock(&inode->i_mutex);
-+out:
-+ return error;
-+}
-
--out_putf:
-+
-+asmlinkage long sys_fchmod(unsigned int fd, mode_t mode)
-+{
-+ struct file * file;
-+ int err = -EBADF;
-+
-+ file = fget(fd);
-+ if (!file)
-+ goto out;
-+
-+ err = chmod_common(file->f_dentry, mode);
- fput(file);
- out:
- return err;
-@@ -662,32 +699,12 @@ asmlinkage long sys_fchmodat(int dfd, co
- mode_t mode)
- {
- struct nameidata nd;
-- struct inode * inode;
- int error;
-- struct iattr newattrs;
-
- error = __user_walk_fd(dfd, filename, LOOKUP_FOLLOW, &nd);
- if (error)
- goto out;
-- inode = nd.dentry->d_inode;
--
-- error = -EROFS;
-- if (IS_RDONLY(inode))
-- goto dput_and_out;
--
-- error = -EPERM;
-- if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
-- goto dput_and_out;
--
-- mutex_lock(&inode->i_mutex);
-- if (mode == (mode_t) -1)
-- mode = inode->i_mode;
-- newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
-- newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
-- error = notify_change(nd.dentry, &newattrs);
-- mutex_unlock(&inode->i_mutex);
--
--dput_and_out:
-+ error = chmod_common(nd.dentry, mode);
- path_release(&nd);
- out:
- return error;
-@@ -713,6 +730,18 @@ static int chown_common(struct dentry *
- if (IS_RDONLY(inode))
- goto out;
- error = -EPERM;
-+ if (inode->i_op->setattr_raw) {
-+ struct inode_operations *op = dentry->d_inode->i_op;
-+
-+ newattrs.ia_uid = user;
-+ newattrs.ia_gid = group;
-+ newattrs.ia_valid = ATTR_UID | ATTR_GID | ATTR_CTIME;
-+ newattrs.ia_valid |= ATTR_RAW;
-+ error = op->setattr_raw(inode, &newattrs);
-+ /* the file system wants to use normal vfs path now */
-+ if (error != -EOPNOTSUPP)
-+ return error;
-+ }
- if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
- goto out;
- newattrs.ia_valid = ATTR_CTIME;
-Index: linux-2.6/fs/namei.c
-===================================================================
---- linux-2.6.orig/fs/namei.c 2006-07-15 21:01:10.000000000 +0800
-+++ linux-2.6/fs/namei.c 2006-07-15 21:01:13.000000000 +0800
-@@ -1642,7 +1642,7 @@ int may_open(struct nameidata *nd, int a
- if (!error) {
- DQUOT_INIT(inode);
-
-- error = do_truncate(dentry, 0, ATTR_MTIME|ATTR_CTIME, NULL);
-+ error = do_truncate(dentry, 0, ATTR_MTIME|ATTR_CTIME, NULL, 1);
- }
- put_write_access(inode);
- if (error)
-@@ -1916,6 +1916,7 @@ asmlinkage long sys_mknodat(int dfd, con
- char * tmp;
- struct dentry * dentry;
- struct nameidata nd;
-+ intent_init(&nd.intent, IT_LOOKUP);
-
- if (S_ISDIR(mode))
- return -EPERM;
-@@ -1926,6 +1927,15 @@ asmlinkage long sys_mknodat(int dfd, con
- error = do_path_lookup(dfd, tmp, LOOKUP_PARENT, &nd);
- if (error)
- goto out;
-+
-+ if (nd.dentry->d_inode->i_op->mknod_raw) {
-+ struct inode_operations *op = nd.dentry->d_inode->i_op;
-+ error = op->mknod_raw(&nd, mode, dev);
-+ /* the file system wants to use normal vfs path now */
-+ if (error != -EOPNOTSUPP)
-+ goto out2;
-+ }
-+
- dentry = lookup_create(&nd, 0);
- error = PTR_ERR(dentry);
-
-@@ -1952,6 +1962,7 @@ asmlinkage long sys_mknodat(int dfd, con
- dput(dentry);
- }
- mutex_unlock(&nd.dentry->d_inode->i_mutex);
-+out2:
- path_release(&nd);
- out:
- putname(tmp);
-@@ -1997,9 +2008,18 @@ asmlinkage long sys_mkdirat(int dfd, con
- struct dentry *dentry;
- struct nameidata nd;
-
-+ intent_init(&nd.intent, IT_LOOKUP);
- error = do_path_lookup(dfd, tmp, LOOKUP_PARENT, &nd);
- if (error)
- goto out;
-+ if (nd.dentry->d_inode->i_op->mkdir_raw) {
-+ struct inode_operations *op = nd.dentry->d_inode->i_op;
-+ error = op->mkdir_raw(&nd, mode);
-+ /* the file system wants to use normal vfs path now */
-+ if (error != -EOPNOTSUPP)
-+ goto out2;
-+ }
-+
- dentry = lookup_create(&nd, 1);
- error = PTR_ERR(dentry);
- if (!IS_ERR(dentry)) {
-@@ -2009,6 +2029,7 @@ asmlinkage long sys_mkdirat(int dfd, con
- dput(dentry);
- }
- mutex_unlock(&nd.dentry->d_inode->i_mutex);
-+out2:
- path_release(&nd);
- out:
- putname(tmp);
-@@ -2089,6 +2110,7 @@ static long do_rmdir(int dfd, const char
- char * name;
- struct dentry *dentry;
- struct nameidata nd;
-+ intent_init(&nd.intent, IT_LOOKUP);
-
- name = getname(pathname);
- if(IS_ERR(name))
-@@ -2109,6 +2131,14 @@ static long do_rmdir(int dfd, const char
- error = -EBUSY;
- goto exit1;
- }
-+ if (nd.dentry->d_inode->i_op->rmdir_raw) {
-+ struct inode_operations *op = nd.dentry->d_inode->i_op;
-+
-+ error = op->rmdir_raw(&nd);
-+ /* the file system wants to use normal vfs path now */
-+ if (error != -EOPNOTSUPP)
-+ goto exit1;
-+ }
- mutex_lock_nested(&nd.dentry->d_inode->i_mutex, I_MUTEX_PARENT);
- dentry = lookup_hash(&nd);
- error = PTR_ERR(dentry);
-@@ -2172,6 +2202,7 @@ static long do_unlinkat(int dfd, const c
- struct dentry *dentry;
- struct nameidata nd;
- struct inode *inode = NULL;
-+ intent_init(&nd.intent, IT_LOOKUP);
-
- name = getname(pathname);
- if(IS_ERR(name))
-@@ -2183,6 +2214,13 @@ static long do_unlinkat(int dfd, const c
- error = -EISDIR;
- if (nd.last_type != LAST_NORM)
- goto exit1;
-+ if (nd.dentry->d_inode->i_op->unlink_raw) {
-+ struct inode_operations *op = nd.dentry->d_inode->i_op;
-+ error = op->unlink_raw(&nd);
-+ /* the file system wants to use normal vfs path now */
-+ if (error != -EOPNOTSUPP)
-+ goto exit1;
-+ }
- mutex_lock_nested(&nd.dentry->d_inode->i_mutex, I_MUTEX_PARENT);
- dentry = lookup_hash(&nd);
- error = PTR_ERR(dentry);
-@@ -2265,9 +2303,17 @@ asmlinkage long sys_symlinkat(const char
- struct dentry *dentry;
- struct nameidata nd;
-
-+ intent_init(&nd.intent, IT_LOOKUP);
- error = do_path_lookup(newdfd, to, LOOKUP_PARENT, &nd);
- if (error)
- goto out;
-+ if (nd.dentry->d_inode->i_op->symlink_raw) {
-+ struct inode_operations *op = nd.dentry->d_inode->i_op;
-+ error = op->symlink_raw(&nd, from);
-+ /* the file system wants to use normal vfs path now */
-+ if (error != -EOPNOTSUPP)
-+ goto out2;
-+ }
- dentry = lookup_create(&nd, 0);
- error = PTR_ERR(dentry);
- if (!IS_ERR(dentry)) {
-@@ -2275,6 +2321,7 @@ asmlinkage long sys_symlinkat(const char
- dput(dentry);
- }
- mutex_unlock(&nd.dentry->d_inode->i_mutex);
-+out2:
- path_release(&nd);
- out:
- putname(to);
-@@ -2365,6 +2412,13 @@ asmlinkage long sys_linkat(int olddfd, c
- error = -EXDEV;
- if (old_nd.mnt != nd.mnt)
- goto out_release;
-+ if (nd.dentry->d_inode->i_op->link_raw) {
-+ struct inode_operations *op = nd.dentry->d_inode->i_op;
-+ error = op->link_raw(&old_nd, &nd);
-+ /* the file system wants to use normal vfs path now */
-+ if (error != -EOPNOTSUPP)
-+ goto out_release;
-+ }
- new_dentry = lookup_create(&nd, 0);
- error = PTR_ERR(new_dentry);
- if (!IS_ERR(new_dentry)) {
-@@ -2541,6 +2595,8 @@ static int do_rename(int olddfd, const c
- struct dentry * old_dentry, *new_dentry;
- struct dentry * trap;
- struct nameidata oldnd, newnd;
-+ intent_init(&oldnd.intent, IT_LOOKUP);
-+ intent_init(&newnd.intent, IT_LOOKUP);
-
- error = do_path_lookup(olddfd, oldname, LOOKUP_PARENT, &oldnd);
- if (error)
-@@ -2563,6 +2619,13 @@ static int do_rename(int olddfd, const c
- if (newnd.last_type != LAST_NORM)
- goto exit2;
-
-+ if (old_dir->d_inode->i_op->rename_raw) {
-+ error = old_dir->d_inode->i_op->rename_raw(&oldnd, &newnd);
-+ /* the file system wants to use normal vfs path now */
-+ if (error != -EOPNOTSUPP)
-+ goto exit2;
-+ }
-+
- trap = lock_rename(new_dir, old_dir);
-
- old_dentry = lookup_hash(&oldnd);
-@@ -2594,8 +2657,7 @@ static int do_rename(int olddfd, const c
- if (new_dentry == trap)
- goto exit5;
-
-- error = vfs_rename(old_dir->d_inode, old_dentry,
-- new_dir->d_inode, new_dentry);
-+ error = vfs_rename(old_dir->d_inode, old_dentry, new_dir->d_inode, new_dentry);
- exit5:
- dput(new_dentry);
- exit4:
-Index: linux-2.6/fs/exec.c
-===================================================================
---- linux-2.6.orig/fs/exec.c 2006-07-15 21:01:10.000000000 +0800
-+++ linux-2.6/fs/exec.c 2006-07-15 21:01:13.000000000 +0800
-@@ -1533,7 +1533,7 @@ int do_coredump(long signr, int exit_cod
- goto close_fail;
- if (!file->f_op->write)
- goto close_fail;
-- if (do_truncate(file->f_dentry, 0, 0, file) != 0)
-+ if (do_truncate(file->f_dentry, 0, 0, file, 0) != 0)
- goto close_fail;
-
- retval = binfmt->core_dump(signr, regs, file);
-Index: linux-2.6/include/linux/fs.h
-===================================================================
---- linux-2.6.orig/include/linux/fs.h 2006-07-15 21:01:10.000000000 +0800
-+++ linux-2.6/include/linux/fs.h 2006-07-15 21:01:13.000000000 +0800
-@@ -1090,13 +1090,20 @@ struct inode_operations {
- int (*create) (struct inode *,struct dentry *,int, struct nameidata *);
- struct dentry * (*lookup) (struct inode *,struct dentry *, struct nameidata *);
- int (*link) (struct dentry *,struct inode *,struct dentry *);
-+ int (*link_raw) (struct nameidata *,struct nameidata *);
- int (*unlink) (struct inode *,struct dentry *);
-+ int (*unlink_raw) (struct nameidata *);
- int (*symlink) (struct inode *,struct dentry *,const char *);
-+ int (*symlink_raw) (struct nameidata *,const char *);
- int (*mkdir) (struct inode *,struct dentry *,int);
-+ int (*mkdir_raw) (struct nameidata *,int);
- int (*rmdir) (struct inode *,struct dentry *);
-+ int (*rmdir_raw) (struct nameidata *);
- int (*mknod) (struct inode *,struct dentry *,int,dev_t);
-+ int (*mknod_raw) (struct nameidata *,int,dev_t);
- int (*rename) (struct inode *, struct dentry *,
- struct inode *, struct dentry *);
-+ int (*rename_raw) (struct nameidata *, struct nameidata *);
- int (*readlink) (struct dentry *, char __user *,int);
- void * (*follow_link) (struct dentry *, struct nameidata *);
- void (*put_link) (struct dentry *, struct nameidata *, void *);
-@@ -1426,7 +1433,7 @@ static inline int break_lease(struct ino
- /* fs/open.c */
-
- extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs,
-- struct file *filp);
-+ struct file *filp, int called_from_open);
- extern long do_sys_open(int fdf, const char __user *filename, int flags,
- int mode);
- extern struct file *filp_open(const char *, int, int);
lustre_version.patch
-vfs_intent-2.6.18-vanilla.patch
-vfs_nointent-2.6.18-vanilla.patch
vfs_races-2.6.18-vanilla.patch
+i_filter_data.patch
jbd-jcberr-2.6.18-vanilla.patch
iopen-misc-2.6.18-vanilla.patch
export-truncate-2.6.18-vanilla.patch
export_symbols-2.6.18-vanilla.patch
dev_read_only-2.6.18-vanilla.patch
export-2.6.18-vanilla.patch
-lookup_bdev_init_intent-2.6.18-vanilla.patch
8kstack-2.6.12.patch
-remove-suid-2.6-suse.patch
export-show_task-2.6.18-vanilla.patch
sd_iostats-2.6-rhel4.patch
-export_symbol_numa-2.6-fc5.patch
-export-do_kern_mount.patch
+export_symbol_numa-2.6.18.patch
-SERIES VERSION COMMENT
+SERIES VERSION COMMENT
SUPPORTED KERNELS:
-2.6-suse SLES9 before SP1 already in SLES9 SP1 kernel
-2.6-suse-newer SLES9: 2.6.5-7.282 extra patches for SLES9 after SP1
-2.6-rhel4 RHEL4: 2.6.9-55.EL
-2.6-sles10 SLES10: 2.6.16.46-0.14
+2.6-suse SLES9 before SP1 already in SLES9 SP1 kernel
+2.6-suse-newer SLES9: 2.6.5-7.282 extra patches for SLES9 after SP1
+2.6-rhel4 RHEL4: 2.6.9-55.EL
+2.6-sles10 SLES10: 2.6.16.46-0.14
+2.6.18-vanilla.series kernel.org: 2.6.18.8
CLIENT SUPPORT FOR UNPATCHED KERNELS:
kernel.org 2.6.16-2.6.19
EXIT;
return;
}
-#ifndef LUSTRE_KERNEL_VERSION
+#ifndef HAVE_VFS_INTENT_PATCHES
if (lld->lld_it) {
ll_intent_release(lld->lld_it);
OBD_FREE(lld->lld_it, sizeof(*lld->lld_it));
EXIT;
}
-#ifdef LUSTRE_KERNEL_VERSION
+#ifdef DCACHE_LUSTRE_INVALID
/* Compare if two dentries are the same. Don't match if the existing dentry
* is marked DCACHE_LUSTRE_INVALID. Returns 1 if different, 0 if the same.
*
ENTRY;
ll_intent_drop_lock(it);
-#ifdef LUSTRE_KERNEL_VERSION
+#ifdef HAVE_VFS_INTENT_PATCHES
it->it_magic = 0;
it->it_op_release = 0;
#endif
RETURN (0);
}
-#ifdef LUSTRE_KERNEL_VERSION
+#ifdef DCACHE_LUSTRE_INVALID
if (!(dentry->d_flags & DCACHE_LUSTRE_INVALID)) {
#else
if (!d_unhashed(dentry)) {
/* actually we don't unhash the dentry, rather just
* mark it inaccessible for to __d_lookup(). otherwise
* sys_getcwd() could return -ENOENT -bzzz */
-#ifdef LUSTRE_KERNEL_VERSION
+#ifdef DCACHE_LUSTRE_INVALID
dentry->d_flags |= DCACHE_LUSTRE_INVALID;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
__d_drop(dentry);
void ll_frob_intent(struct lookup_intent **itp, struct lookup_intent *deft)
{
struct lookup_intent *it = *itp;
-#if defined(LUSTRE_KERNEL_VERSION)&&(LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
+#if defined(HAVE_VFS_INTENT_PATCHES)&&(LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
if (it) {
LASSERTF(it->it_magic == INTENT_MAGIC, "bad intent magic: %x\n",
it->it_magic);
if (!it || it->it_op == IT_GETXATTR)
it = *itp = deft;
-#ifdef LUSTRE_KERNEL_VERSION
+#ifdef HAVE_VFS_INTENT_PATCHES
it->it_op_release = ll_intent_release;
#endif
}
if (it && (it->it_op & IT_CREAT))
RETURN(0);
-#ifdef LUSTRE_KERNEL_VERSION
+#ifdef DCACHE_LUSTRE_INVALID
if (de->d_flags & DCACHE_LUSTRE_INVALID)
RETURN(0);
#endif
if (req != NULL && !it_disposition(it, DISP_ENQ_COMPLETE))
ptlrpc_req_finished(req);
if (rc == 0) {
-#ifdef LUSTRE_KERNEL_VERSION
+#ifdef DCACHE_LUSTRE_INVALID
ll_unhash_aliases(de->d_inode);
/* done in ll_unhash_aliases()
dentry->d_flags |= DCACHE_LUSTRE_INVALID; */
de->d_name.name, de, de->d_parent, de->d_inode,
atomic_read(&de->d_count));
ll_lookup_finish_locks(it, de);
-#ifdef LUSTRE_KERNEL_VERSION
+#ifdef DCACHE_LUSTRE_INVALID
lock_dentry(de);
de->d_flags &= ~DCACHE_LUSTRE_INVALID;
unlock_dentry(de);
}
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
-#ifdef LUSTRE_KERNEL_VERSION
+#ifdef HAVE_VFS_INTENT_PATCHES
static int ll_revalidate_nd(struct dentry *dentry, struct nameidata *nd)
{
int rc;
#endif
.d_release = ll_release,
.d_delete = ll_ddelete,
-#ifdef LUSTRE_KERNEL_VERSION
+#ifdef DCACHE_LUSTRE_INVALID
.d_compare = ll_dcompare,
#endif
#if 0
if (inode->i_sb->s_root == file->f_dentry)
RETURN(0);
-#ifdef LUSTRE_KERNEL_VERSION
+#ifdef HAVE_VFS_INTENT_PATCHES
it = file->f_it;
#else
it = file->private_data; /* XXX: compat macro */
};
struct inode_operations ll_file_inode_operations = {
-#ifdef LUSTRE_KERNEL_VERSION
+#ifdef HAVE_VFS_INTENT_PATCHES
.setattr_raw = ll_setattr_raw,
#endif
.setattr = ll_setattr,
#define LL_IT2STR(it) ((it) ? ldlm_it2str((it)->it_op) : "0")
#define LUSTRE_FPRIVATE(file) ((file)->private_data)
-#ifdef LUSTRE_KERNEL_VERSION
+#ifdef HAVE_VFS_INTENT_PATCHES
static inline struct lookup_intent *ll_nd2it(struct nameidata *nd)
{
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
int lld_mnt_count;
struct obd_client_handle lld_cwd_och;
struct obd_client_handle lld_mnt_och;
-#ifndef LUSTRE_KERNEL_VERSION
+#ifndef HAVE_VFS_INTENT_PATCHES
struct lookup_intent *lld_it;
#endif
};
int ll_prepare_mdc_op_data(struct mdc_op_data *,
struct inode *i1, struct inode *i2,
const char *name, int namelen, int mode, void *data);
-#ifndef LUSTRE_KERNEL_VERSION
+#ifndef HAVE_VFS_INTENT_PATCHES
struct lookup_intent *ll_convert_intent(struct open_intent *oit,
int lookup_flags);
#endif
}
static struct dentry_operations ll_d_root_ops = {
-#ifdef LUSTRE_KERNEL_VERSION
+#ifdef DCACHE_LUSTRE_INVALID
.d_compare = ll_dcompare,
#endif
};
dget_locked(dentry);
lock_dentry(dentry);
__d_drop(dentry);
-#ifdef LUSTRE_KERNEL_VERSION
+#ifdef DCACHE_LUSTRE_INVALID
dentry->d_flags &= ~DCACHE_LUSTRE_INVALID;
#endif
unlock_dentry(dentry);
}
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
-#ifdef LUSTRE_KERNEL_VERSION
+#ifdef HAVE_VFS_INTENT_PATCHES
static struct dentry *ll_lookup_nd(struct inode *parent, struct dentry *dentry,
struct nameidata *nd)
{
}
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
-#ifndef LUSTRE_KERNEL_VERSION
+#ifndef HAVE_VFS_INTENT_PATCHES
static int ll_create_nd(struct inode *dir, struct dentry *dentry, int mode, struct nameidata *nd)
{
struct lookup_intent *it = ll_d2d(dentry)->lld_it;
return(err);
}
-#ifdef LUSTRE_KERNEL_VERSION
+#ifdef HAVE_VFS_INTENT_PATCHES
static int ll_mknod_raw(struct nameidata *nd, int mode, dev_t rdev)
{
return ll_mknod_generic(nd->dentry->d_inode, &nd->last, mode,rdev,NULL);
#endif
struct inode_operations ll_dir_inode_operations = {
-#ifdef LUSTRE_KERNEL_VERSION
+#ifdef HAVE_VFS_INTENT_PATCHES
.link_raw = ll_link_raw,
.unlink_raw = ll_unlink_raw,
.symlink_raw = ll_symlink_raw,
};
struct inode_operations ll_special_inode_operations = {
-#ifdef LUSTRE_KERNEL_VERSION
+#ifdef HAVE_VFS_INTENT_PATCHES
.setattr_raw = ll_setattr_raw,
#endif
.setattr = ll_setattr,
{
struct inode *inode = dentry->d_inode;
struct ll_inode_info *lli = ll_i2info(inode);
-#ifdef LUSTRE_KERNEL_VERSION
+#ifdef HAVE_VFS_INTENT_PATCHES
struct lookup_intent *it = ll_nd2it(nd);
#endif
struct ptlrpc_request *request;
char *symname;
ENTRY;
-#ifdef LUSTRE_KERNEL_VERSION
+#ifdef HAVE_VFS_INTENT_PATCHES
if (it != NULL) {
int op = it->it_op;
int mode = it->it_create_mode;
struct inode_operations ll_fast_symlink_inode_operations = {
.readlink = ll_readlink,
.setattr = ll_setattr,
-#ifdef LUSTRE_KERNEL_VERSION
+#ifdef HAVE_VFS_INTENT_PATCHES
.setattr_raw = ll_setattr_raw,
#endif
.follow_link = ll_follow_link,