-diff -urNp linux-2.6.16.21-0.8.orig/fs/9p/vfs_inode.c linux-2.6.16.21-0.8/fs/9p/vfs_inode.c
---- linux-2.6.16.21-0.8.orig/fs/9p/vfs_inode.c 2006-10-04 02:18:10.000000000 +0300
-+++ linux-2.6.16.21-0.8/fs/9p/vfs_inode.c 2007-01-29 18:20:42.000000000 +0200
+Index: LINUX-SRC-TREE/fs/9p/vfs_inode.c
+===================================================================
+--- LINUX-SRC-TREE.orig/fs/9p/vfs_inode.c
++++ LINUX-SRC-TREE/fs/9p/vfs_inode.c
@@ -469,7 +469,7 @@ v9fs_vfs_create(struct inode *dir, struc
perm = unixmode2p9mode(v9ses, mode);
else
flags = O_RDWR;
-diff -urNp linux-2.6.16.21-0.8.orig/fs/cifs/dir.c linux-2.6.16.21-0.8/fs/cifs/dir.c
---- linux-2.6.16.21-0.8.orig/fs/cifs/dir.c 2006-10-04 02:18:10.000000000 +0300
-+++ linux-2.6.16.21-0.8/fs/cifs/dir.c 2007-01-29 18:20:42.000000000 +0200
-@@ -147,7 +147,7 @@ cifs_create(struct inode *inode, struct
- }
+Index: LINUX-SRC-TREE/fs/cifs/dir.c
+===================================================================
+--- LINUX-SRC-TREE.orig/fs/cifs/dir.c
++++ LINUX-SRC-TREE/fs/cifs/dir.c
+@@ -157,11 +157,7 @@ cifs_create(struct inode *inode, struct
+ #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)
if(nd && (nd->flags & LOOKUP_OPEN)) {
+-#if LINUX_VERSION_CODE == KERNEL_VERSION(2,6,5) /* SUSE included Lustre patch */
+ int oflags = nd->intent.it_flags;
+-#else
- int oflags = nd->intent.open.flags;
-+ int oflags = nd->intent.flags;
+-#endif
desiredAccess = 0;
if (oflags & FMODE_READ)
-diff -urNp linux-2.6.16.21-0.8.orig/fs/exec.c linux-2.6.16.21-0.8/fs/exec.c
---- linux-2.6.16.21-0.8.orig/fs/exec.c 2006-10-04 02:18:10.000000000 +0300
-+++ linux-2.6.16.21-0.8/fs/exec.c 2007-01-29 18:20:42.000000000 +0200
-@@ -128,7 +128,9 @@ asmlinkage long sys_uselib(const char __
+Index: LINUX-SRC-TREE/fs/exec.c
+===================================================================
+--- LINUX-SRC-TREE.orig/fs/exec.c
++++ LINUX-SRC-TREE/fs/exec.c
+@@ -129,7 +129,9 @@ asmlinkage long sys_uselib(const char __
struct nameidata nd;
int error;
if (error)
goto out;
-@@ -478,7 +480,9 @@ struct file *open_exec(const char *name)
+@@ -481,7 +483,9 @@ struct file *open_exec(const char *name)
int err;
struct file *file;
file = ERR_PTR(err);
if (!err) {
-@@ -1520,7 +1524,7 @@ int do_coredump(long signr, int exit_cod
+@@ -1543,7 +1547,7 @@ int do_coredump(long signr, int exit_cod
goto close_fail;
if (!file->f_op->write)
goto close_fail;
goto close_fail;
retval = binfmt->core_dump(signr, regs, file);
-diff -urNp linux-2.6.16.21-0.8.orig/fs/fuse/dir.c linux-2.6.16.21-0.8/fs/fuse/dir.c
---- linux-2.6.16.21-0.8.orig/fs/fuse/dir.c 2006-10-04 02:18:11.000000000 +0300
-+++ linux-2.6.16.21-0.8/fs/fuse/dir.c 2007-01-29 18:20:42.000000000 +0200
+Index: LINUX-SRC-TREE/fs/fuse/dir.c
+===================================================================
+--- LINUX-SRC-TREE.orig/fs/fuse/dir.c
++++ LINUX-SRC-TREE/fs/fuse/dir.c
@@ -242,7 +242,7 @@ static int fuse_create_open(struct inode
struct fuse_entry_out outentry;
struct fuse_file *ff;
err = -ENOSYS;
if (fc->no_create)
-diff -urNp linux-2.6.16.21-0.8.orig/fs/inode.c linux-2.6.16.21-0.8/fs/inode.c
---- linux-2.6.16.21-0.8.orig/fs/inode.c 2006-10-04 02:18:11.000000000 +0300
-+++ linux-2.6.16.21-0.8/fs/inode.c 2007-01-29 18:20:42.000000000 +0200
+Index: LINUX-SRC-TREE/fs/inode.c
+===================================================================
+--- LINUX-SRC-TREE.orig/fs/inode.c
++++ LINUX-SRC-TREE/fs/inode.c
@@ -236,6 +236,7 @@ void __iget(struct inode * inode)
inodes_stat.nr_unused--;
}
/**
* clear_inode - clear an inode
* @inode: inode to clear
-diff -urNp linux-2.6.16.21-0.8.orig/fs/namei.c linux-2.6.16.21-0.8/fs/namei.c
---- linux-2.6.16.21-0.8.orig/fs/namei.c 2006-10-04 02:18:11.000000000 +0300
-+++ linux-2.6.16.21-0.8/fs/namei.c 2007-01-29 18:21:10.000000000 +0200
+Index: LINUX-SRC-TREE/fs/namei.c
+===================================================================
+--- LINUX-SRC-TREE.orig/fs/namei.c
++++ LINUX-SRC-TREE/fs/namei.c
@@ -337,8 +337,19 @@ int deny_write_access(struct file * file
return 0;
}
unsigned int flags, struct nameidata *nd)
{
int retval = 0;
-@@ -1133,10 +1203,23 @@ unlock_fail:
- return retval;
+@@ -1134,10 +1204,23 @@ fput_fail:
+ goto out_fail;
}
-int fastcall path_lookup(const char *name, unsigned int flags,
}
static int __path_lookup_intent_open(int dfd, const char *name,
-@@ -1148,13 +1231,13 @@ static int __path_lookup_intent_open(int
+@@ -1149,13 +1232,13 @@ static int __path_lookup_intent_open(int
if (filp == NULL)
return -ENFILE;
path_release(nd);
}
} else if (err != 0)
-@@ -1171,10 +1254,10 @@ static int __path_lookup_intent_open(int
+@@ -1172,10 +1255,10 @@ static int __path_lookup_intent_open(int
* @open_flags: open intent flags
*/
int path_lookup_open(int dfd, const char *name, unsigned int lookup_flags,
}
/**
-@@ -1257,7 +1340,7 @@ struct dentry * lookup_hash(struct namei
+@@ -1258,7 +1341,7 @@ struct dentry * lookup_hash(struct namei
}
/* SMP-safe */
{
unsigned long hash;
struct qstr this;
-@@ -1277,11 +1360,17 @@ struct dentry * lookup_one_len(const cha
+@@ -1278,11 +1361,17 @@ struct dentry * lookup_one_len(const cha
}
this.hash = end_name_hash(hash);
/*
* namei()
*
-@@ -1293,22 +1382,36 @@ access:
+@@ -1294,22 +1383,36 @@ access:
* that namei follows links, while lnamei does not.
* SMP-safe
*/
}
/*
-@@ -1543,7 +1646,7 @@ int may_open(struct nameidata *nd, int a
+@@ -1545,7 +1648,7 @@ int may_open(struct nameidata *nd, int a
if (!error) {
DQUOT_INIT(inode);
}
put_write_access(inode);
if (error)
-@@ -1593,7 +1696,7 @@ int open_namei(int dfd, const char *path
+@@ -1595,7 +1698,7 @@ int open_namei(int dfd, const char *path
*/
if (!(flag & O_CREAT)) {
error = path_lookup_open(dfd, pathname, lookup_flags(flag),
if (error)
return error;
goto ok;
-@@ -1602,6 +1705,7 @@ int open_namei(int dfd, const char *path
+@@ -1604,6 +1707,7 @@ int open_namei(int dfd, const char *path
/*
* Create - we need to know the parent.
*/
error = path_lookup_create(dfd,pathname,LOOKUP_PARENT,nd,flag,mode);
if (error)
return error;
-@@ -1618,7 +1722,9 @@ int open_namei(int dfd, const char *path
+@@ -1620,7 +1724,9 @@ int open_namei(int dfd, const char *path
dir = nd->dentry;
nd->flags &= ~LOOKUP_PARENT;
mutex_lock(&dir->d_inode->i_mutex);
path.mnt = nd->mnt;
do_last:
-@@ -1628,9 +1734,9 @@ do_last:
+@@ -1630,9 +1736,9 @@ do_last:
goto exit;
}
goto exit_dput;
}
-@@ -1683,7 +1789,7 @@ ok:
+@@ -1687,7 +1793,7 @@ ok:
exit_dput:
dput_path(&path, nd);
exit:
release_open_intent(nd);
path_release(nd);
return error;
-@@ -1726,7 +1832,9 @@ do_link:
+@@ -1736,7 +1842,9 @@ do_link:
}
dir = nd->dentry;
mutex_lock(&dir->d_inode->i_mutex);
path.mnt = nd->mnt;
__putname(nd->last.name);
goto do_last;
-@@ -1811,15 +1919,26 @@ asmlinkage long sys_mknodat(int dfd, con
+@@ -1821,15 +1929,26 @@ asmlinkage long sys_mknodat(int dfd, con
struct dentry * dentry;
struct nameidata nd;
dentry = lookup_create(&nd, 0);
error = PTR_ERR(dentry);
-@@ -1846,6 +1965,7 @@ asmlinkage long sys_mknodat(int dfd, con
+@@ -1856,6 +1975,7 @@ asmlinkage long sys_mknodat(int dfd, con
dput(dentry);
}
mutex_unlock(&nd.dentry->d_inode->i_mutex);
path_release(&nd);
out:
putname(tmp);
-@@ -1891,9 +2011,18 @@ asmlinkage long sys_mkdirat(int dfd, con
+@@ -1901,9 +2021,18 @@ asmlinkage long sys_mkdirat(int dfd, con
struct dentry *dentry;
struct nameidata nd;
dentry = lookup_create(&nd, 1);
error = PTR_ERR(dentry);
if (!IS_ERR(dentry)) {
-@@ -1903,6 +2032,7 @@ asmlinkage long sys_mkdirat(int dfd, con
+@@ -1913,6 +2042,7 @@ asmlinkage long sys_mkdirat(int dfd, con
dput(dentry);
}
mutex_unlock(&nd.dentry->d_inode->i_mutex);
path_release(&nd);
out:
putname(tmp);
-@@ -1987,8 +2117,9 @@ static long do_rmdir(int dfd, const char
+@@ -1997,8 +2127,9 @@ static long do_rmdir(int dfd, const char
name = getname(pathname);
if(IS_ERR(name))
return PTR_ERR(name);
if (error)
goto exit;
-@@ -2003,6 +2134,14 @@ static long do_rmdir(int dfd, const char
+@@ -2013,6 +2144,14 @@ static long do_rmdir(int dfd, const char
error = -EBUSY;
goto exit1;
}
mutex_lock(&nd.dentry->d_inode->i_mutex);
dentry = lookup_hash(&nd);
error = PTR_ERR(dentry);
-@@ -2071,12 +2210,20 @@ static long do_unlinkat(int dfd, const c
+@@ -2081,12 +2220,20 @@ static long do_unlinkat(int dfd, const c
if(IS_ERR(name))
return PTR_ERR(name);
mutex_lock(&nd.dentry->d_inode->i_mutex);
dentry = lookup_hash(&nd);
error = PTR_ERR(dentry);
-@@ -2159,9 +2306,17 @@ asmlinkage long sys_symlinkat(const char
+@@ -2169,9 +2316,17 @@ asmlinkage long sys_symlinkat(const char
struct dentry *dentry;
struct nameidata nd;
dentry = lookup_create(&nd, 0);
error = PTR_ERR(dentry);
if (!IS_ERR(dentry)) {
-@@ -2169,6 +2324,7 @@ asmlinkage long sys_symlinkat(const char
+@@ -2179,6 +2334,7 @@ asmlinkage long sys_symlinkat(const char
dput(dentry);
}
mutex_unlock(&nd.dentry->d_inode->i_mutex);
path_release(&nd);
out:
putname(to);
-@@ -2245,15 +2401,25 @@ asmlinkage long sys_linkat(int olddfd, c
+@@ -2255,15 +2411,25 @@ asmlinkage long sys_linkat(int olddfd, c
if (IS_ERR(to))
return PTR_ERR(to);
new_dentry = lookup_create(&nd, 0);
error = PTR_ERR(new_dentry);
if (!IS_ERR(new_dentry)) {
-@@ -2430,12 +2596,14 @@ static int do_rename(int olddfd, const c
+@@ -2440,12 +2606,14 @@ static int do_rename(int olddfd, const c
struct dentry * old_dentry, *new_dentry;
struct dentry * trap;
struct nameidata oldnd, newnd;
if (error)
goto exit1;
-@@ -2452,6 +2620,13 @@ static int do_rename(int olddfd, const c
+@@ -2462,6 +2630,13 @@ static int do_rename(int olddfd, const c
if (newnd.last_type != LAST_NORM)
goto exit2;
trap = lock_rename(new_dir, old_dir);
old_dentry = lookup_hash(&oldnd);
-@@ -2483,8 +2658,7 @@ static int do_rename(int olddfd, const c
+@@ -2493,8 +2668,7 @@ static int do_rename(int olddfd, const c
if (new_dentry == trap)
goto exit5;
exit5:
dput(new_dentry);
exit4:
-@@ -2690,6 +2864,7 @@ EXPORT_SYMBOL(__page_symlink);
+@@ -2700,6 +2874,7 @@ EXPORT_SYMBOL(__page_symlink);
EXPORT_SYMBOL(page_symlink);
EXPORT_SYMBOL(page_symlink_inode_operations);
EXPORT_SYMBOL(path_lookup);
EXPORT_SYMBOL(path_release);
EXPORT_SYMBOL(path_walk);
EXPORT_SYMBOL(permission);
-diff -urNp linux-2.6.16.21-0.8.orig/fs/namespace.c linux-2.6.16.21-0.8/fs/namespace.c
---- linux-2.6.16.21-0.8.orig/fs/namespace.c 2006-10-04 02:18:11.000000000 +0300
-+++ linux-2.6.16.21-0.8/fs/namespace.c 2007-01-29 18:20:42.000000000 +0200
+Index: LINUX-SRC-TREE/fs/namespace.c
+===================================================================
+--- LINUX-SRC-TREE.orig/fs/namespace.c
++++ LINUX-SRC-TREE/fs/namespace.c
@@ -75,6 +75,7 @@ struct vfsmount *alloc_vfsmnt(const char
INIT_LIST_HEAD(&mnt->mnt_share);
INIT_LIST_HEAD(&mnt->mnt_slave_list);
if (retval)
return retval;
-diff -urNp linux-2.6.16.21-0.8.orig/fs/nfs/dir.c linux-2.6.16.21-0.8/fs/nfs/dir.c
---- linux-2.6.16.21-0.8.orig/fs/nfs/dir.c 2006-10-04 02:18:11.000000000 +0300
-+++ linux-2.6.16.21-0.8/fs/nfs/dir.c 2007-01-29 18:20:42.000000000 +0200
-@@ -831,7 +831,7 @@ int nfs_is_exclusive_create(struct inode
+Index: LINUX-SRC-TREE/fs/nfs/dir.c
+===================================================================
+--- LINUX-SRC-TREE.orig/fs/nfs/dir.c
++++ LINUX-SRC-TREE/fs/nfs/dir.c
+@@ -834,7 +834,7 @@ int nfs_is_exclusive_create(struct inode
return 0;
if (nd == NULL || nfs_lookup_check_intent(nd, LOOKUP_CREATE) == 0)
return 0;
}
static struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *nd)
-@@ -902,7 +902,7 @@ static int is_atomic_open(struct inode *
+@@ -911,7 +911,7 @@ static int is_atomic_open(struct inode *
if (nd->flags & LOOKUP_DIRECTORY)
return 0;
/* Are we trying to write to a read only partition? */
return 0;
return 1;
}
-@@ -923,7 +923,7 @@ static struct dentry *nfs_atomic_lookup(
+@@ -932,7 +932,7 @@ static struct dentry *nfs_atomic_lookup(
dentry->d_op = NFS_PROTO(dir)->dentry_ops;
/* Let vfs_create() deal with O_EXCL */
d_add(dentry, NULL);
goto out;
}
-@@ -938,7 +938,7 @@ static struct dentry *nfs_atomic_lookup(
+@@ -947,7 +947,7 @@ static struct dentry *nfs_atomic_lookup(
goto out;
}
nfs_begin_data_update(dir);
res = nfs4_atomic_open(dir, dentry, nd);
nfs_end_data_update(dir);
-@@ -957,7 +957,7 @@ static struct dentry *nfs_atomic_lookup(
+@@ -966,7 +966,7 @@ static struct dentry *nfs_atomic_lookup(
case -ENOTDIR:
goto no_open;
case -ELOOP:
goto no_open;
/* case -EINVAL: */
default:
-@@ -993,7 +993,7 @@ static int nfs_open_revalidate(struct de
+@@ -1002,7 +1002,7 @@ static int nfs_open_revalidate(struct de
/* NFS only supports OPEN on regular files */
if (!S_ISREG(inode->i_mode))
goto no_open;
/* We cannot do exclusive creation on a positive dentry */
if ((openflags & (O_CREAT|O_EXCL)) == (O_CREAT|O_EXCL))
goto no_open;
-@@ -1126,7 +1126,7 @@ static int nfs_create(struct inode *dir,
+@@ -1138,7 +1138,7 @@ static int nfs_create(struct inode *dir,
attr.ia_valid = ATTR_MODE;
if (nd && (nd->flags & LOOKUP_CREATE))
lock_kernel();
nfs_begin_data_update(dir);
-diff -urNp linux-2.6.16.21-0.8.orig/fs/nfs/nfs4proc.c linux-2.6.16.21-0.8/fs/nfs/nfs4proc.c
---- linux-2.6.16.21-0.8.orig/fs/nfs/nfs4proc.c 2006-10-04 02:18:11.000000000 +0300
-+++ linux-2.6.16.21-0.8/fs/nfs/nfs4proc.c 2007-01-29 18:20:42.000000000 +0200
+Index: LINUX-SRC-TREE/fs/nfs/nfs4proc.c
+===================================================================
+--- LINUX-SRC-TREE.orig/fs/nfs/nfs4proc.c
++++ LINUX-SRC-TREE/fs/nfs/nfs4proc.c
@@ -1220,7 +1220,7 @@ static void nfs4_intent_set_file(struct
ctx = (struct nfs_open_context *)filp->private_data;
ctx->state = state;
put_rpccred(cred);
if (IS_ERR(state)) {
if (PTR_ERR(state) == -ENOENT)
-diff -urNp linux-2.6.16.21-0.8.orig/fs/nfsctl.c linux-2.6.16.21-0.8/fs/nfsctl.c
---- linux-2.6.16.21-0.8.orig/fs/nfsctl.c 2006-10-04 02:18:11.000000000 +0300
-+++ linux-2.6.16.21-0.8/fs/nfsctl.c 2007-01-29 18:20:42.000000000 +0200
+Index: LINUX-SRC-TREE/fs/nfsctl.c
+===================================================================
+--- LINUX-SRC-TREE.orig/fs/nfsctl.c
++++ LINUX-SRC-TREE/fs/nfsctl.c
@@ -26,6 +26,7 @@ static struct file *do_open(char *name,
struct nameidata nd;
int error;
nd.mnt = do_kern_mount("nfsd", 0, "nfsd", NULL);
if (IS_ERR(nd.mnt))
-diff -urNp linux-2.6.16.21-0.8.orig/fs/open.c linux-2.6.16.21-0.8/fs/open.c
---- linux-2.6.16.21-0.8.orig/fs/open.c 2006-10-04 02:18:12.000000000 +0300
-+++ linux-2.6.16.21-0.8/fs/open.c 2007-01-29 18:20:42.000000000 +0200
-@@ -197,9 +197,10 @@ out:
+Index: LINUX-SRC-TREE/fs/open.c
+===================================================================
+--- LINUX-SRC-TREE.orig/fs/open.c
++++ LINUX-SRC-TREE/fs/open.c
+@@ -198,9 +198,10 @@ out:
}
int do_truncate(struct dentry *dentry, loff_t length, unsigned int time_attrs,
struct iattr newattrs;
/* Not pretty: "inode->i_size" shouldn't really be signed. But it is. */
-@@ -214,7 +215,17 @@ int do_truncate(struct dentry *dentry, l
+@@ -215,7 +216,17 @@ int do_truncate(struct dentry *dentry, l
}
mutex_lock(&dentry->d_inode->i_mutex);
mutex_unlock(&dentry->d_inode->i_mutex);
return err;
}
-@@ -224,12 +235,12 @@ static long do_sys_truncate(const char _
+@@ -225,12 +236,12 @@ static long do_sys_truncate(const char _
struct nameidata nd;
struct inode * inode;
int error;
if (error)
goto out;
inode = nd.dentry->d_inode;
-@@ -269,7 +280,7 @@ static long do_sys_truncate(const char _
+@@ -270,7 +281,7 @@ static long do_sys_truncate(const char _
error = locks_verify_truncate(inode, NULL, length);
if (!error) {
DQUOT_INIT(inode);
}
put_write_access(inode);
-@@ -321,7 +332,7 @@ static long do_sys_ftruncate(unsigned in
+@@ -322,7 +333,7 @@ static long do_sys_ftruncate(unsigned in
error = locks_verify_truncate(inode, file, length);
if (!error)
out_putf:
fput(file);
out:
-@@ -406,9 +417,20 @@ asmlinkage long sys_utime(char __user *
+@@ -407,9 +418,20 @@ asmlinkage long sys_utime(char __user *
(error = vfs_permission(&nd, MAY_WRITE)) != 0)
goto dput_and_out;
}
dput_and_out:
path_release(&nd);
out:
-@@ -494,6 +516,7 @@ asmlinkage long sys_faccessat(int dfd, c
+@@ -495,6 +517,7 @@ asmlinkage long sys_faccessat(int dfd, c
int old_fsuid, old_fsgid;
kernel_cap_t old_cap;
int res;
if (mode & ~S_IRWXO) /* where's F_OK, X_OK, W_OK, R_OK? */
return -EINVAL;
-@@ -518,7 +541,7 @@ asmlinkage long sys_faccessat(int dfd, c
+@@ -519,7 +542,7 @@ asmlinkage long sys_faccessat(int dfd, c
else
current->cap_effective = current->cap_permitted;
if (!res) {
res = vfs_permission(&nd, mode);
/* SuS v2 requires we report a read only fs too */
-@@ -544,8 +567,9 @@ asmlinkage long sys_chdir(const char __u
+@@ -545,8 +568,9 @@ asmlinkage long sys_chdir(const char __u
{
struct nameidata nd;
int error;
if (error)
goto out;
-@@ -595,8 +619,9 @@ asmlinkage long sys_chroot(const char __
+@@ -596,8 +620,9 @@ asmlinkage long sys_chroot(const char __
{
struct nameidata nd;
int error;
if (error)
goto out;
-@@ -617,36 +642,52 @@ out:
+@@ -618,38 +643,55 @@ 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 = dentry->d_inode;
-+ struct iattr newattrs;
-+ int error = -EROFS;
-+
-+ if (IS_RDONLY(inode))
-+ goto out;
-+
-+ if (inode->i_op->setattr_raw) {
-+ struct inode_operations *op = dentry->d_inode->i_op;
-+
-+ 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;
-+ }
-+
-+ error = -EPERM;
-+ if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
-+ 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;
-+ error = notify_change(dentry, &newattrs);
-+ mutex_unlock(&inode->i_mutex);
-+out:
-+ return error;
-+}
-+
- asmlinkage long sys_fchmod(unsigned int fd, mode_t mode)
{
- struct inode * inode;
- struct dentry * dentry;
- struct file * file;
- int err = -EBADF;
-- struct iattr newattrs;
+- struct file * file;
+- int err = -EBADF;
++ struct inode * inode = dentry->d_inode;
+ struct iattr newattrs;
++ int error = -EROFS;
- file = fget(fd);
- if (!file)
+- file = fget(fd);
+- if (!file)
++ 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;
-- if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
++ error = -EPERM;
+ if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
- goto out_putf;
-- 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;
++ 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);
-- mutex_unlock(&inode->i_mutex);
--
++ error = notify_change(dentry, &newattrs);
+ mutex_unlock(&inode->i_mutex);
++out:
++ return error;
++}
++
++asmlinkage long sys_fchmod(unsigned int fd, mode_t mode)
++{
++ struct file * file;
++ int err = -EBADF;
++
++ file = fget(fd);
++ if (!file)
++ goto out;
++
++ audit_inode(NULL, file->f_dentry->d_inode);
++
++ err = chmod_common(file->f_dentry, mode);
+
-out_putf:
-+ err = chmod_common(file->f_dentry, mode);
fput(file);
out:
return err;
-@@ -656,32 +697,12 @@ asmlinkage long sys_fchmodat(int dfd, co
+@@ -659,32 +701,12 @@ asmlinkage long sys_fchmodat(int dfd, co
mode_t mode)
{
struct nameidata nd;
path_release(&nd);
out:
return error;
-@@ -707,6 +728,18 @@ static int chown_common(struct dentry *
+@@ -710,6 +732,18 @@ static int chown_common(struct dentry *
if (IS_RDONLY(inode))
goto out;
error = -EPERM;
if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
goto out;
newattrs.ia_valid = ATTR_CTIME;
-@@ -817,6 +850,7 @@ static struct file *__dentry_open(struct
+@@ -823,6 +857,7 @@ static struct file *__dentry_open(struct
error = open(inode, f);
if (error)
goto cleanup_all;
}
f->f_flags &= ~(O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC);
-@@ -843,6 +877,7 @@ cleanup_all:
+@@ -849,6 +884,7 @@ cleanup_all:
f->f_dentry = NULL;
f->f_vfsmnt = NULL;
cleanup_file:
put_filp(f);
dput(dentry);
mntput(mnt);
-@@ -868,6 +903,7 @@ static struct file *do_filp_open(int dfd
+@@ -874,6 +910,7 @@ static struct file *do_filp_open(int dfd
{
int namei_flags, error;
struct nameidata nd;
namei_flags = flags;
if ((namei_flags+1) & O_ACCMODE)
-@@ -904,19 +940,19 @@ EXPORT_SYMBOL(filp_open);
+@@ -910,19 +947,19 @@ EXPORT_SYMBOL(filp_open);
struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry,
int (*open)(struct inode *, struct file *))
{
goto out;
}
EXPORT_SYMBOL_GPL(lookup_instantiate_filp);
-@@ -933,7 +969,8 @@ struct file *nameidata_to_filp(struct na
+@@ -939,7 +976,8 @@ struct file *nameidata_to_filp(struct na
struct file *filp;
/* Pick up the filp from the open intent */
/* Has the filesystem initialised the file for us? */
if (filp->f_dentry == NULL)
filp = __dentry_open(nd->dentry, nd->mnt, flags, filp, NULL);
-diff -urNp linux-2.6.16.21-0.8.orig/fs/stat.c linux-2.6.16.21-0.8/fs/stat.c
---- linux-2.6.16.21-0.8.orig/fs/stat.c 2006-10-04 02:18:12.000000000 +0300
-+++ linux-2.6.16.21-0.8/fs/stat.c 2007-01-29 18:20:42.000000000 +0200
+Index: LINUX-SRC-TREE/fs/stat.c
+===================================================================
+--- LINUX-SRC-TREE.orig/fs/stat.c
++++ LINUX-SRC-TREE/fs/stat.c
@@ -38,7 +38,7 @@ void generic_fillattr(struct inode *inod
EXPORT_SYMBOL(generic_fillattr);
fput(f);
}
return error;
-diff -urNp linux-2.6.16.21-0.8.orig/include/linux/dcache.h linux-2.6.16.21-0.8/include/linux/dcache.h
---- linux-2.6.16.21-0.8.orig/include/linux/dcache.h 2006-10-04 02:18:15.000000000 +0300
-+++ linux-2.6.16.21-0.8/include/linux/dcache.h 2007-01-29 18:20:42.000000000 +0200
+Index: LINUX-SRC-TREE/include/linux/dcache.h
+===================================================================
+--- LINUX-SRC-TREE.orig/include/linux/dcache.h
++++ LINUX-SRC-TREE/include/linux/dcache.h
@@ -36,6 +36,9 @@ struct qstr {
const unsigned char *name;
};
struct dentry_stat_t {
int nr_dentry;
int nr_unused;
-diff -urNp linux-2.6.16.21-0.8.orig/include/linux/fs.h linux-2.6.16.21-0.8/include/linux/fs.h
---- linux-2.6.16.21-0.8.orig/include/linux/fs.h 2006-10-04 02:18:16.000000000 +0300
-+++ linux-2.6.16.21-0.8/include/linux/fs.h 2007-01-29 18:20:42.000000000 +0200
-@@ -59,6 +59,7 @@ extern int dir_notify_enable;
+Index: LINUX-SRC-TREE/include/linux/fs.h
+===================================================================
+--- LINUX-SRC-TREE.orig/include/linux/fs.h
++++ LINUX-SRC-TREE/include/linux/fs.h
+@@ -61,6 +61,7 @@ extern int dir_notify_enable;
#define FMODE_READ 1
#define FMODE_WRITE 2
/* Internal kernel extensions */
#define FMODE_LSEEK 4
-@@ -265,6 +266,8 @@ typedef void (dio_iodone_t)(struct kiocb
+@@ -272,6 +273,8 @@ typedef void (dio_iodone_t)(struct kiocb
#define ATTR_KILL_SUID 2048
#define ATTR_KILL_SGID 4096
#define ATTR_FILE 8192
#define ATTR_NO_BLOCK 32768 /* Return EAGAIN and don't block on long truncates */
/*
-@@ -500,6 +503,7 @@ struct inode {
+@@ -517,6 +520,7 @@ struct inode {
struct block_device *i_bdev;
struct cdev *i_cdev;
int i_cindex;
__u32 i_generation;
-@@ -647,6 +651,7 @@ struct file {
+@@ -664,6 +668,7 @@ struct file {
spinlock_t f_ep_lock;
#endif /* #ifdef CONFIG_EPOLL */
struct address_space *f_mapping;
};
extern spinlock_t files_lock;
#define file_list_lock() spin_lock(&files_lock);
-@@ -1036,20 +1041,29 @@ struct inode_operations {
+@@ -1059,20 +1064,29 @@ 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 (*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);
-@@ -1090,6 +1104,7 @@ struct super_operations {
+@@ -1113,6 +1127,7 @@ struct super_operations {
int (*remount_fs) (struct super_block *, int *, char *);
void (*clear_inode) (struct inode *);
void (*umount_begin) (struct super_block *);
int (*show_options)(struct seq_file *, struct vfsmount *);
-@@ -1292,6 +1307,7 @@ extern int may_umount_tree(struct vfsmou
+@@ -1322,6 +1337,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 *);
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 *,
-@@ -1348,11 +1364,12 @@ static inline int break_lease(struct ino
+@@ -1378,11 +1394,12 @@ static inline int break_lease(struct ino
/* fs/open.c */
extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs,
extern int filp_close(struct file *, fl_owner_t id);
extern char * getname(const char __user *);
-diff -urNp linux-2.6.16.21-0.8.orig/include/linux/mount.h linux-2.6.16.21-0.8/include/linux/mount.h
---- linux-2.6.16.21-0.8.orig/include/linux/mount.h 2006-10-04 02:18:16.000000000 +0300
-+++ linux-2.6.16.21-0.8/include/linux/mount.h 2007-01-29 18:20:42.000000000 +0200
+Index: LINUX-SRC-TREE/include/linux/mount.h
+===================================================================
+--- LINUX-SRC-TREE.orig/include/linux/mount.h
++++ LINUX-SRC-TREE/include/linux/mount.h
@@ -46,6 +46,8 @@ struct vfsmount {
struct list_head mnt_slave; /* slave list entry */
struct vfsmount *mnt_master; /* slave is on master->mnt_slave_list */
int mnt_pinned;
};
-diff -urNp linux-2.6.16.21-0.8.orig/include/linux/namei.h linux-2.6.16.21-0.8/include/linux/namei.h
---- linux-2.6.16.21-0.8.orig/include/linux/namei.h 2006-10-04 02:18:16.000000000 +0300
-+++ linux-2.6.16.21-0.8/include/linux/namei.h 2007-01-29 18:20:49.000000000 +0200
+Index: LINUX-SRC-TREE/include/linux/namei.h
+===================================================================
+--- LINUX-SRC-TREE.orig/include/linux/namei.h
++++ LINUX-SRC-TREE/include/linux/namei.h
@@ -5,10 +5,39 @@
struct vfsmount;