kernel/ksyms.c | 1
12 files changed, 564 insertions(+), 99 deletions(-)
-Index: linux-2.4.18-p4smp/fs/exec.c
+Index: linux-2.4.18-chaos52/fs/exec.c
===================================================================
---- linux-2.4.18-p4smp.orig/fs/exec.c Fri Jul 25 16:12:35 2003
-+++ linux-2.4.18-p4smp/fs/exec.c Fri Jul 25 16:13:49 2003
-@@ -117,8 +117,9 @@
+--- linux-2.4.18-chaos52.orig/fs/exec.c 2003-08-11 10:10:12.000000000 +0800
++++ linux-2.4.18-chaos52/fs/exec.c 2003-08-11 10:17:04.000000000 +0800
+@@ -117,8 +117,10 @@
struct file * file;
struct nameidata nd;
int error;
-+ struct lookup_intent it = { .it_op = IT_OPEN, .it_flags = O_RDONLY };
-
+-
- error = user_path_walk(library, &nd);
++ struct lookup_intent it = { .it_op = IT_OPEN,
++ .it_flags = FMODE_READ|FMODE_EXEC };
++
+ error = user_path_walk_it(library, &nd, &it);
if (error)
goto out;
-@@ -130,7 +131,8 @@
+@@ -130,7 +132,8 @@
if (error)
goto exit;
error = PTR_ERR(file);
if (IS_ERR(file))
goto out;
-@@ -359,8 +361,9 @@
+@@ -359,8 +362,9 @@
struct inode *inode;
struct file *file;
int err = 0;
-+ struct lookup_intent it = { .it_op = IT_OPEN, .it_flags = O_RDONLY };
-
+-
- err = path_lookup(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, &nd);
++ struct lookup_intent it = { .it_op = IT_OPEN,
++ .it_flags = FMODE_READ|FMODE_EXEC };
+ err = path_lookup_it(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, &nd, &it);
file = ERR_PTR(err);
if (!err) {
inode = nd.dentry->d_inode;
-@@ -372,7 +375,8 @@
+@@ -372,7 +376,8 @@
err = -EACCES;
file = ERR_PTR(err);
if (!err) {
if (!IS_ERR(file)) {
err = deny_write_access(file);
if (err) {
-@@ -384,6 +388,7 @@
+@@ -384,6 +389,7 @@
return file;
}
}
path_release(&nd);
}
goto out;
-@@ -1104,7 +1109,7 @@
+@@ -1104,7 +1110,7 @@
goto close_fail;
if (!file->f_op->write)
goto close_fail;
goto close_fail;
retval = binfmt->core_dump(signr, regs, file);
-Index: linux-2.4.18-p4smp/fs/dcache.c
+Index: linux-2.4.18-chaos52/fs/dcache.c
===================================================================
---- linux-2.4.18-p4smp.orig/fs/dcache.c Fri Jul 25 16:12:35 2003
-+++ linux-2.4.18-p4smp/fs/dcache.c Fri Jul 25 16:13:49 2003
+--- linux-2.4.18-chaos52.orig/fs/dcache.c 2003-08-11 10:10:12.000000000 +0800
++++ linux-2.4.18-chaos52/fs/dcache.c 2003-08-11 10:11:27.000000000 +0800
@@ -186,6 +186,13 @@
spin_unlock(&dcache_lock);
return 0;
}
#define do_switch(x,y) do { \
-Index: linux-2.4.18-p4smp/fs/namespace.c
+Index: linux-2.4.18-chaos52/fs/namespace.c
===================================================================
---- linux-2.4.18-p4smp.orig/fs/namespace.c Fri Jul 25 16:12:35 2003
-+++ linux-2.4.18-p4smp/fs/namespace.c Fri Jul 25 16:13:49 2003
+--- linux-2.4.18-chaos52.orig/fs/namespace.c 2003-08-11 10:10:12.000000000 +0800
++++ linux-2.4.18-chaos52/fs/namespace.c 2003-08-11 10:11:27.000000000 +0800
@@ -99,6 +99,7 @@
{
old_nd->dentry = mnt->mnt_mountpoint;
path_release(&new_nd);
out0:
unlock_kernel();
-Index: linux-2.4.18-p4smp/fs/namei.c
+Index: linux-2.4.18-chaos52/fs/namei.c
===================================================================
---- linux-2.4.18-p4smp.orig/fs/namei.c Fri Jul 25 16:12:35 2003
-+++ linux-2.4.18-p4smp/fs/namei.c Fri Jul 25 16:30:22 2003
+--- linux-2.4.18-chaos52.orig/fs/namei.c 2003-08-11 10:10:12.000000000 +0800
++++ linux-2.4.18-chaos52/fs/namei.c 2003-08-11 10:11:27.000000000 +0800
@@ -94,6 +94,13 @@
* XEmacs seems to be relying on it...
*/
if (page) {
kunmap(page);
page_cache_release(page);
-Index: linux-2.4.18-p4smp/fs/open.c
+Index: linux-2.4.18-chaos52/fs/open.c
===================================================================
---- linux-2.4.18-p4smp.orig/fs/open.c Fri Jul 25 16:12:35 2003
-+++ linux-2.4.18-p4smp/fs/open.c Fri Jul 25 16:13:49 2003
+--- linux-2.4.18-chaos52.orig/fs/open.c 2003-08-11 10:10:12.000000000 +0800
++++ linux-2.4.18-chaos52/fs/open.c 2003-08-11 10:19:28.000000000 +0800
@@ -19,6 +19,8 @@
#include <asm/uaccess.h>
if (error)
goto out;
-@@ -454,6 +504,7 @@
+@@ -454,39 +504,56 @@
set_fs_altroot();
error = 0;
dput_and_out:
path_release(&nd);
out:
return error;
-@@ -508,6 +559,18 @@
- if (IS_RDONLY(inode))
- goto dput_and_out;
+ }
+
+-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;
++ int err = -EROFS;
+
+- 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 = nd.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);
++ err = inode->i_op->setattr_raw(inode, &newattrs);
+ /* the file system wants to use normal vfs path now */
-+ if (error != -EOPNOTSUPP)
-+ goto dput_and_out;
++ if (err != -EOPNOTSUPP)
++ goto out;
+ }
-+
- error = -EPERM;
+
+- err = -EROFS;
+- if (IS_RDONLY(inode))
+- goto out_putf;
+ err = -EPERM;
if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
- goto dput_and_out;
-@@ -538,6 +601,20 @@
+- goto out_putf;
++ goto out;
++
+ 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);
+
+-out_putf:
++out:
++ return err;
++}
++
++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;
+@@ -495,30 +562,14 @@
+ asmlinkage long sys_chmod(const char * filename, mode_t mode)
+ {
+ struct nameidata nd;
+- struct inode * inode;
+ int error;
+- struct iattr newattrs;
+
+ error = user_path_walk(filename, &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;
+-
+- 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);
++ error = chmod_common(nd.dentry, mode);
+
+-dput_and_out:
+ path_release(&nd);
+ out:
+ return error;
+@@ -538,6 +589,20 @@
error = -EROFS;
if (IS_RDONLY(inode))
goto out;
error = -EPERM;
if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
goto out;
-@@ -628,7 +705,8 @@
+@@ -628,7 +693,8 @@
/* for files over a certains size it doesn't pay to do readahead on open */
#define READAHEAD_CUTOFF 48000
{
struct file * f;
struct inode *inode;
-@@ -649,7 +727,7 @@
+@@ -649,7 +715,7 @@
error = locks_verify_locked(inode);
if (!error) {
DQUOT_INIT(inode);
}
if (error || !(f->f_mode & FMODE_WRITE))
put_write_access(inode);
-@@ -679,7 +757,9 @@
+@@ -679,7 +745,9 @@
}
if (f->f_op && f->f_op->open) {
if (error)
goto cleanup_all;
}
-@@ -693,6 +773,7 @@
+@@ -693,6 +761,7 @@
do_readahead(f, 0, (48 * 1024) >> PAGE_SHIFT);
return f;
cleanup_all:
-@@ -707,11 +788,17 @@
+@@ -707,11 +776,17 @@
cleanup_file:
put_filp(f);
cleanup_dentry:
/*
* Find an empty file descriptor entry, and mark it busy.
*/
-Index: linux-2.4.18-p4smp/fs/stat.c
+Index: linux-2.4.18-chaos52/fs/stat.c
===================================================================
---- linux-2.4.18-p4smp.orig/fs/stat.c Fri Jul 25 16:12:35 2003
-+++ linux-2.4.18-p4smp/fs/stat.c Fri Jul 25 16:13:49 2003
+--- linux-2.4.18-chaos52.orig/fs/stat.c 2003-08-11 10:10:12.000000000 +0800
++++ linux-2.4.18-chaos52/fs/stat.c 2003-08-11 10:11:27.000000000 +0800
@@ -17,21 +17,24 @@
* Revalidate the inode. This is required for proper NFS attribute caching.
*/
UPDATE_ATIME(inode);
error = inode->i_op->readlink(nd.dentry, buf, bufsiz);
}
-Index: linux-2.4.18-p4smp/include/linux/dcache.h
+Index: linux-2.4.18-chaos52/include/linux/dcache.h
===================================================================
---- linux-2.4.18-p4smp.orig/include/linux/dcache.h Fri Jul 25 16:12:35 2003
-+++ linux-2.4.18-p4smp/include/linux/dcache.h Fri Jul 25 16:13:49 2003
+--- linux-2.4.18-chaos52.orig/include/linux/dcache.h 2003-08-11 10:10:12.000000000 +0800
++++ linux-2.4.18-chaos52/include/linux/dcache.h 2003-08-11 10:11:28.000000000 +0800
@@ -5,6 +5,51 @@
#include <asm/atomic.h>
extern spinlock_t dcache_lock;
-Index: linux-2.4.18-p4smp/include/linux/fs.h
+Index: linux-2.4.18-chaos52/include/linux/fs.h
===================================================================
---- linux-2.4.18-p4smp.orig/include/linux/fs.h Fri Jul 25 16:13:48 2003
-+++ linux-2.4.18-p4smp/include/linux/fs.h Fri Jul 25 16:13:49 2003
-@@ -339,6 +339,9 @@
+--- linux-2.4.18-chaos52.orig/include/linux/fs.h 2003-08-11 10:11:24.000000000 +0800
++++ linux-2.4.18-chaos52/include/linux/fs.h 2003-08-11 10:41:55.000000000 +0800
+@@ -73,6 +73,7 @@
+
+ #define FMODE_READ 1
+ #define FMODE_WRITE 2
++#define FMODE_EXEC 4
+
+ #define READ 0
+ #define WRITE 1
+@@ -338,6 +339,9 @@
#define ATTR_MTIME_SET 256
#define ATTR_FORCE 512 /* Not a change, but a change it */
#define ATTR_ATTR_FLAG 1024
/*
* This is the Inode Attributes structure, used for notify_change(). It
-@@ -578,6 +581,7 @@
+@@ -576,6 +580,7 @@
/* needed for tty driver, and maybe others */
void *private_data;
/* preallocated helper kiobuf to speedup O_DIRECT */
struct kiobuf *f_iobuf;
-@@ -707,6 +711,7 @@
+@@ -705,6 +710,7 @@
struct qstr last;
unsigned int flags;
int last_type;
};
#define DQUOT_USR_ENABLED 0x01 /* User diskquotas enabled */
-@@ -840,7 +845,8 @@
+@@ -836,7 +842,8 @@
extern int vfs_link(struct dentry *, struct inode *, struct dentry *);
extern int vfs_rmdir(struct inode *, struct dentry *);
extern int vfs_unlink(struct inode *, struct dentry *);
/*
* File types
-@@ -900,21 +906,34 @@
+@@ -896,21 +903,34 @@
struct inode_operations {
int (*create) (struct inode *,struct dentry *,int);
int (*getattr) (struct dentry *, struct iattr *);
};
-@@ -1119,10 +1138,12 @@
+@@ -1115,10 +1135,12 @@
asmlinkage long sys_open(const char *, int, int);
asmlinkage long sys_close(unsigned int); /* yes, it's really unsigned */
extern int filp_close(struct file *, fl_owner_t id);
extern char * getname(const char *);
-@@ -1388,9 +1409,12 @@
+@@ -1384,9 +1406,12 @@
extern loff_t default_llseek(struct file *file, loff_t offset, int origin);
extern int FASTCALL(__user_walk(const char *, unsigned, struct nameidata *));
extern int FASTCALL(link_path_walk(const char *, struct nameidata *));
extern void path_release(struct nameidata *);
extern int follow_down(struct vfsmount **, struct dentry **);
-@@ -1399,6 +1423,8 @@
+@@ -1395,6 +1420,8 @@
extern struct dentry * lookup_hash(struct qstr *, struct dentry *);
#define user_path_walk(name,nd) __user_walk(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, nd)
#define user_path_walk_link(name,nd) __user_walk(name, LOOKUP_POSITIVE, nd)
extern void inode_init_once(struct inode *);
extern void iput(struct inode *);
-@@ -1499,6 +1525,8 @@
+@@ -1495,6 +1522,8 @@
extern int vfs_readlink(struct dentry *, char *, int, const char *);
extern int vfs_follow_link(struct nameidata *, const char *);
extern int page_readlink(struct dentry *, char *, int);
extern int page_follow_link(struct dentry *, struct nameidata *);
extern struct inode_operations page_symlink_inode_operations;
-Index: linux-2.4.18-p4smp/kernel/fork.c
+Index: linux-2.4.18-chaos52/kernel/fork.c
===================================================================
---- linux-2.4.18-p4smp.orig/kernel/fork.c Fri Jul 25 16:12:35 2003
-+++ linux-2.4.18-p4smp/kernel/fork.c Fri Jul 25 16:13:49 2003
+--- linux-2.4.18-chaos52.orig/kernel/fork.c 2003-08-11 10:10:13.000000000 +0800
++++ linux-2.4.18-chaos52/kernel/fork.c 2003-08-11 10:11:28.000000000 +0800
@@ -399,10 +399,13 @@
fs->umask = old->umask;
read_lock(&old->lock);
fs->altrootmnt = mntget(old->altrootmnt);
fs->altroot = dget(old->altroot);
} else {
-Index: linux-2.4.18-p4smp/kernel/exit.c
+Index: linux-2.4.18-chaos52/kernel/exit.c
===================================================================
---- linux-2.4.18-p4smp.orig/kernel/exit.c Fri Jul 25 16:12:35 2003
-+++ linux-2.4.18-p4smp/kernel/exit.c Fri Jul 25 16:13:49 2003
+--- linux-2.4.18-chaos52.orig/kernel/exit.c 2003-08-11 10:10:13.000000000 +0800
++++ linux-2.4.18-chaos52/kernel/exit.c 2003-08-11 10:11:28.000000000 +0800
@@ -303,11 +303,14 @@
{
/* No need to hold fs->lock if we are killing it */
dput(fs->altroot);
mntput(fs->altrootmnt);
}
-Index: linux-2.4.18-p4smp/kernel/ksyms.c
+Index: linux-2.4.18-chaos52/kernel/ksyms.c
===================================================================
---- linux-2.4.18-p4smp.orig/kernel/ksyms.c Fri Jul 25 16:13:48 2003
-+++ linux-2.4.18-p4smp/kernel/ksyms.c Fri Jul 25 16:13:49 2003
+--- linux-2.4.18-chaos52.orig/kernel/ksyms.c 2003-08-11 10:11:25.000000000 +0800
++++ linux-2.4.18-chaos52/kernel/ksyms.c 2003-08-11 10:11:28.000000000 +0800
@@ -294,6 +294,7 @@
EXPORT_SYMBOL(set_page_dirty);
EXPORT_SYMBOL(vfs_readlink);
0 files changed
--- linux/fs/exec.c~vfs_intent-2.4.20-hp 2003-06-09 23:07:04.000000000 +0800
-+++ linux-root/fs/exec.c 2003-07-30 18:10:09.000000000 +0800
-@@ -116,8 +116,9 @@ asmlinkage long sys_uselib(const char *
++++ linux-root/fs/exec.c 2003-08-08 16:13:23.000000000 +0800
+@@ -116,8 +116,10 @@ asmlinkage long sys_uselib(const char *
struct file * file;
struct nameidata nd;
int error;
-+ struct lookup_intent it = { .it_op = IT_OPEN, .it_flags = O_RDONLY };
++ struct lookup_intent it = { .it_op = IT_OPEN,
++ .it_flags = FMODE_READ|FMODE_EXEC };
- error = user_path_walk(library, &nd);
+ error = user_path_walk_it(library, &nd, &it);
if (error)
goto out;
-@@ -129,7 +130,8 @@ asmlinkage long sys_uselib(const char *
+@@ -129,7 +131,8 @@ asmlinkage long sys_uselib(const char *
if (error)
goto exit;
error = PTR_ERR(file);
if (IS_ERR(file))
goto out;
-@@ -372,8 +374,9 @@ struct file *open_exec(const char *name)
+@@ -372,8 +375,10 @@ struct file *open_exec(const char *name)
struct inode *inode;
struct file *file;
int err = 0;
-+ struct lookup_intent it = { .it_op = IT_OPEN, .it_flags = O_RDONLY };
++ struct lookup_intent it = { .it_op = IT_OPEN,
++ .it_flags = FMODE_READ|FMODE_EXEC };
- err = path_lookup(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, &nd);
+ err = path_lookup_it(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, &nd, &it);
file = ERR_PTR(err);
if (!err) {
inode = nd.dentry->d_inode;
-@@ -385,7 +388,8 @@ struct file *open_exec(const char *name)
+@@ -385,7 +390,8 @@ struct file *open_exec(const char *name)
err = -EACCES;
file = ERR_PTR(err);
if (!err) {
if (!IS_ERR(file)) {
err = deny_write_access(file);
if (err) {
-@@ -397,6 +401,7 @@ out:
+@@ -397,6 +403,7 @@ out:
return file;
}
}
path_release(&nd);
}
goto out;
-@@ -1128,7 +1133,7 @@ int do_coredump(long signr, struct pt_re
+@@ -1128,7 +1135,7 @@ int do_coredump(long signr, struct pt_re
goto close_fail;
if (!file->f_op->write)
goto close_fail;
retval = binfmt->core_dump(signr, regs, file);
--- linux/fs/dcache.c~vfs_intent-2.4.20-hp 2003-06-09 23:07:04.000000000 +0800
-+++ linux-root/fs/dcache.c 2003-07-30 18:10:09.000000000 +0800
++++ linux-root/fs/dcache.c 2003-08-08 15:58:57.000000000 +0800
@@ -181,6 +181,13 @@ int d_invalidate(struct dentry * dentry)
spin_unlock(&dcache_lock);
return 0;
#define do_switch(x,y) do { \
--- linux/fs/namespace.c~vfs_intent-2.4.20-hp 2002-11-29 07:53:15.000000000 +0800
-+++ linux-root/fs/namespace.c 2003-07-30 18:10:09.000000000 +0800
++++ linux-root/fs/namespace.c 2003-08-08 15:58:57.000000000 +0800
@@ -99,6 +99,7 @@ static void detach_mnt(struct vfsmount *
{
old_nd->dentry = mnt->mnt_mountpoint;
out0:
unlock_kernel();
--- linux/fs/namei.c~vfs_intent-2.4.20-hp 2003-06-09 23:07:04.000000000 +0800
-+++ linux-root/fs/namei.c 2003-07-30 18:14:35.000000000 +0800
++++ linux-root/fs/namei.c 2003-08-08 15:58:57.000000000 +0800
@@ -94,6 +94,13 @@
* XEmacs seems to be relying on it...
*/
kunmap(page);
page_cache_release(page);
--- linux/fs/open.c~vfs_intent-2.4.20-hp 2003-06-09 23:07:04.000000000 +0800
-+++ linux-root/fs/open.c 2003-07-30 18:10:09.000000000 +0800
++++ linux-root/fs/open.c 2003-08-08 17:09:13.000000000 +0800
@@ -19,6 +19,8 @@
#include <asm/uaccess.h>
if (error)
goto out;
-@@ -454,6 +502,7 @@ asmlinkage long sys_chroot(const char *
+@@ -454,39 +502,56 @@ asmlinkage long sys_chroot(const char *
set_fs_altroot();
error = 0;
dput_and_out:
path_release(&nd);
out:
return error;
-@@ -508,6 +557,18 @@ asmlinkage long sys_chmod(const char * f
- if (IS_RDONLY(inode))
- goto dput_and_out;
+ }
+
+-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;
++ int err = -EROFS;
+- 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 = nd.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);
++ err = inode->i_op->setattr_raw(inode, &newattrs);
+ /* the file system wants to use normal vfs path now */
-+ if (error != -EOPNOTSUPP)
-+ goto dput_and_out;
++ if (err != -EOPNOTSUPP)
++ goto out;
+ }
-+
- error = -EPERM;
+
+- err = -EROFS;
+- if (IS_RDONLY(inode))
+- goto out_putf;
+ err = -EPERM;
if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
- goto dput_and_out;
-@@ -538,6 +599,20 @@ static int chown_common(struct dentry *
+- goto out_putf;
++ goto out;
++
+ 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);
+
+-out_putf:
++out:
++ return err;
++}
++
++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;
+@@ -495,30 +560,14 @@ out:
+ asmlinkage long sys_chmod(const char * filename, mode_t mode)
+ {
+ struct nameidata nd;
+- struct inode * inode;
+ int error;
+- struct iattr newattrs;
+
+ error = user_path_walk(filename, &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;
+
+- 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);
++ error = chmod_common(nd.dentry, mode);
+
+-dput_and_out:
+ path_release(&nd);
+ out:
+ return error;
+@@ -538,6 +587,20 @@ static int chown_common(struct dentry *
error = -EROFS;
if (IS_RDONLY(inode))
goto out;
error = -EPERM;
if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
goto out;
-@@ -638,10 +713,12 @@ asmlinkage long sys_fchown(unsigned int
+@@ -638,10 +701,12 @@ asmlinkage long sys_fchown(unsigned int
* for the internal routines (ie open_namei()/follow_link() etc). 00 is
* used by symlinks.
*/
namei_flags = flags;
if ((namei_flags+1) & O_ACCMODE)
-@@ -649,14 +726,15 @@ struct file *filp_open(const char * file
+@@ -649,14 +714,15 @@ struct file *filp_open(const char * file
if (namei_flags & O_TRUNC)
namei_flags |= 2;
{
struct file * f;
struct inode *inode;
-@@ -693,12 +771,15 @@ struct file *dentry_open(struct dentry *
+@@ -693,12 +759,15 @@ struct file *dentry_open(struct dentry *
}
if (f->f_op && f->f_op->open) {
return f;
cleanup_all:
-@@ -713,11 +794,17 @@ cleanup_all:
+@@ -713,11 +782,17 @@ cleanup_all:
cleanup_file:
put_filp(f);
cleanup_dentry:
* Find an empty file descriptor entry, and mark it busy.
*/
--- linux/fs/stat.c~vfs_intent-2.4.20-hp 2003-06-09 23:07:04.000000000 +0800
-+++ linux-root/fs/stat.c 2003-07-30 18:10:09.000000000 +0800
++++ linux-root/fs/stat.c 2003-08-08 15:58:57.000000000 +0800
@@ -17,10 +17,12 @@
* Revalidate the inode. This is required for proper NFS attribute caching.
*/
err = cp_new_stat64(dentry->d_inode, statbuf);
fput(f);
--- linux/fs/proc/base.c~vfs_intent-2.4.20-hp 2003-06-09 23:04:21.000000000 +0800
-+++ linux-root/fs/proc/base.c 2003-07-30 18:10:09.000000000 +0800
++++ linux-root/fs/proc/base.c 2003-08-08 15:58:57.000000000 +0800
@@ -464,6 +464,9 @@ static int proc_pid_follow_link(struct d
error = inode->u.proc_i.op.proc_get_link(inode, &nd->dentry, &nd->mnt);
return error;
}
--- linux/include/linux/dcache.h~vfs_intent-2.4.20-hp 2002-11-29 07:53:15.000000000 +0800
-+++ linux-root/include/linux/dcache.h 2003-07-30 18:13:51.000000000 +0800
++++ linux-root/include/linux/dcache.h 2003-08-08 15:58:57.000000000 +0800
@@ -5,8 +5,53 @@
#include <asm/atomic.h>
extern spinlock_t dcache_lock;
---- linux/include/linux/fs.h~vfs_intent-2.4.20-hp 2003-07-30 18:10:03.000000000 +0800
-+++ linux-root/include/linux/fs.h 2003-07-30 18:14:17.000000000 +0800
-@@ -340,6 +340,9 @@ extern void set_bh_page(struct buffer_he
+--- linux/include/linux/fs.h~vfs_intent-2.4.20-hp 2003-08-08 15:58:54.000000000 +0800
++++ linux-root/include/linux/fs.h 2003-08-08 17:16:15.000000000 +0800
+@@ -73,6 +73,7 @@ extern int leases_enable, dir_notify_ena
+
+ #define FMODE_READ 1
+ #define FMODE_WRITE 2
++#define FMODE_EXEC 4
+
+ #define READ 0
+ #define WRITE 1
+@@ -340,6 +341,9 @@ extern void set_bh_page(struct buffer_he
#define ATTR_MTIME_SET 256
#define ATTR_FORCE 512 /* Not a change, but a change it */
#define ATTR_ATTR_FLAG 1024
/*
* This is the Inode Attributes structure, used for notify_change(). It
-@@ -576,6 +579,7 @@ struct file {
+@@ -576,6 +580,7 @@ struct file {
/* needed for tty driver, and maybe others */
void *private_data;
/* preallocated helper kiobuf to speedup O_DIRECT */
struct kiobuf *f_iobuf;
-@@ -697,6 +701,7 @@ struct nameidata {
+@@ -697,6 +702,7 @@ struct nameidata {
struct qstr last;
unsigned int flags;
int last_type;
};
/*
-@@ -817,7 +822,8 @@ extern int vfs_symlink(struct inode *, s
+@@ -817,7 +823,8 @@ extern int vfs_symlink(struct inode *, s
extern int vfs_link(struct dentry *, struct inode *, struct dentry *);
extern int vfs_rmdir(struct inode *, struct dentry *);
extern int vfs_unlink(struct inode *, struct dentry *);
/*
* File types
-@@ -877,21 +883,32 @@ struct file_operations {
+@@ -877,21 +884,32 @@ struct file_operations {
struct inode_operations {
int (*create) (struct inode *,struct dentry *,int);
int (*getattr) (struct dentry *, struct iattr *);
int (*setxattr) (struct dentry *, const char *, void *, size_t, int);
ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
-@@ -1088,10 +1105,14 @@ static inline int get_lease(struct inode
+@@ -1088,10 +1106,14 @@ static inline int get_lease(struct inode
asmlinkage long sys_open(const char *, int, int);
asmlinkage long sys_close(unsigned int); /* yes, it's really unsigned */
extern int filp_close(struct file *, fl_owner_t id);
extern char * getname(const char *);
-@@ -1353,6 +1374,7 @@ typedef int (*read_actor_t)(read_descrip
+@@ -1353,6 +1375,7 @@ typedef int (*read_actor_t)(read_descrip
extern loff_t default_llseek(struct file *file, loff_t offset, int origin);
extern int FASTCALL(__user_walk(const char *, unsigned, struct nameidata *));
extern int FASTCALL(path_init(const char *, unsigned, struct nameidata *));
extern int FASTCALL(path_walk(const char *, struct nameidata *));
extern int FASTCALL(path_lookup(const char *, unsigned, struct nameidata *));
-@@ -1364,6 +1386,8 @@ extern struct dentry * lookup_one_len(co
+@@ -1364,6 +1387,8 @@ extern struct dentry * lookup_one_len(co
extern struct dentry * lookup_hash(struct qstr *, struct dentry *);
#define user_path_walk(name,nd) __user_walk(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, nd)
#define user_path_walk_link(name,nd) __user_walk(name, LOOKUP_POSITIVE, nd)
extern void inode_init_once(struct inode *);
extern void iput(struct inode *);
-@@ -1499,6 +1523,8 @@ extern struct file_operations generic_ro
+@@ -1499,6 +1524,8 @@ extern struct file_operations generic_ro
extern int vfs_readlink(struct dentry *, char *, int, const char *);
extern int vfs_follow_link(struct nameidata *, const char *);
extern int page_follow_link(struct dentry *, struct nameidata *);
extern struct inode_operations page_symlink_inode_operations;
--- linux/include/linux/fs_struct.h~vfs_intent-2.4.20-hp 2001-07-14 06:10:44.000000000 +0800
-+++ linux-root/include/linux/fs_struct.h 2003-07-30 18:10:09.000000000 +0800
++++ linux-root/include/linux/fs_struct.h 2003-08-08 15:58:57.000000000 +0800
@@ -34,10 +34,12 @@ static inline void set_fs_root(struct fs
write_lock(&fs->lock);
old_root = fs->root;
dput(old_pwd);
mntput(old_pwdmnt);
}
---- linux/kernel/ksyms.c~vfs_intent-2.4.20-hp 2003-07-30 18:10:05.000000000 +0800
-+++ linux-root/kernel/ksyms.c 2003-07-30 18:10:09.000000000 +0800
+--- linux/kernel/ksyms.c~vfs_intent-2.4.20-hp 2003-08-08 15:58:55.000000000 +0800
++++ linux-root/kernel/ksyms.c 2003-08-08 15:58:57.000000000 +0800
@@ -296,6 +296,7 @@ EXPORT_SYMBOL(read_cache_page);
EXPORT_SYMBOL(set_page_dirty);
EXPORT_SYMBOL(vfs_readlink);
EXPORT_SYMBOL(page_follow_link);
EXPORT_SYMBOL(page_symlink_inode_operations);
--- linux/kernel/fork.c~vfs_intent-2.4.20-hp 2003-05-29 03:14:31.000000000 +0800
-+++ linux-root/kernel/fork.c 2003-07-30 18:10:09.000000000 +0800
++++ linux-root/kernel/fork.c 2003-08-08 15:58:57.000000000 +0800
@@ -388,10 +388,13 @@ static inline struct fs_struct *__copy_f
fs->umask = old->umask;
read_lock(&old->lock);
fs->altroot = dget(old->altroot);
} else {
--- linux/kernel/exit.c~vfs_intent-2.4.20-hp 2003-05-29 03:14:31.000000000 +0800
-+++ linux-root/kernel/exit.c 2003-07-30 18:10:09.000000000 +0800
++++ linux-root/kernel/exit.c 2003-08-08 15:58:57.000000000 +0800
@@ -239,11 +239,14 @@ static inline void __put_fs_struct(struc
{
/* No need to hold fs->lock if we are killing it */
ENTRY;
CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu\n", inode->i_ino);
-
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
lprocfs_counter_incr(ll_i2sbi(inode)->ll_stats, LPROC_LL_SETATTR);
-#endif
if (ia_valid & ATTR_SIZE) {
if (attr->ia_size > ll_file_maxbytes(inode)) {
* o_append users on other nodes. */
if (extent.start == 0)
ast_flags = LDLM_AST_DISCARD_DATA;
+ /* bug 1639: avoid write/truncate i_sem/DLM deadlock */
+ LASSERT(atomic_read(&inode->i_sem.count) == 0);
+ up(&inode->i_sem);
rc = ll_extent_lock_no_validate(NULL, inode, lsm, LCK_PW,
&extent, &lockh, ast_flags);
+ down(&inode->i_sem);
if (rc != ELDLM_OK) {
if (rc > 0)
RETURN(-ENOLCK);
LASSERT(!lli->lli_smd);
- /* core attributes from the MDS first */
+ /* Core attributes from the MDS first. This is a new inode, and
+ * the VFS doesn't zero times in the core inode so we have to do
+ * it ourselves. They will be overwritten by either MDS or OST
+ * attributes - we just need to make sure they aren't newer. */
+ LTIME_S(inode->i_mtime) = 0;
+ LTIME_S(inode->i_atime) = 0;
+ LTIME_S(inode->i_ctime) = 0;
ll_update_inode(inode, md->body, md->lsm);
/* OIDEBUG(inode); */
&ioc_data, NULL);
obd = class_conn2obd(&sbi->ll_osc_conn);
+ if (obd == NULL) {
+ CERROR("Invalid LOV connection handle "LPX64"\n",
+ sbi->ll_osc_conn.cookie);
+ EXIT;
+ return;
+ }
+
obd->obd_no_recov = 1;
obd_iocontrol(IOC_OSC_SET_ACTIVE, &sbi->ll_osc_conn, sizeof ioc_data,
&ioc_data, NULL);
if (IS_ERR(page))
return lnb->rc = PTR_ERR(page);
+ LASSERT(page->mapping == mapping);
+
lnb->page = page;
if (inode->i_size < lnb->offset + lnb->len - 1)
lnb->page = page;
lnb->flags |= N_LOCAL_TEMP_PAGE;
} else if (!IS_ERR(page)) {
+ unsigned from = lnb->offset & ~PAGE_MASK, to = from + lnb->len;
(*pglocked)++;
- rc = mapping->a_ops->prepare_write(NULL, page,
- lnb->offset & ~PAGE_MASK,
- lnb->len);
+ rc = mapping->a_ops->prepare_write(NULL, page, from, to);
if (rc) {
if (rc != -ENOSPC)
CERROR("page index %lu, rc = %d\n", index, rc);
struct fsfilt_objinfo *fso;
struct dentry *dentry;
struct inode *inode;
- int rc = 0, i, j, tot_bytes = 0;
+ int rc = 0, i, j, tot_bytes = 0, cleanup_phase = 0;
unsigned long now = jiffies;
ENTRY;
- /* We are currently not supporting multi-obj BRW_READ RPCS at all */
+ /* We are currently not supporting multi-obj BRW_READ RPCS at all.
+ * When we do this function's dentry cleanup will need to be fixed */
LASSERT(objcount == 1);
OBD_ALLOC(fso, objcount * sizeof(*fso));
dentry = filter_oa2dentry(exp->exp_obd, oa);
if (IS_ERR(dentry))
- GOTO(out_objinfo, rc = PTR_ERR(dentry));
+ GOTO(cleanup, rc = PTR_ERR(dentry));
if (dentry->d_inode == NULL) {
CERROR("trying to BRW to non-existent file "LPU64"\n",
o->ioo_id);
f_dput(dentry);
- GOTO(out_objinfo, rc = -ENOENT);
+ GOTO(cleanup, rc = -ENOENT);
}
fso[i].fso_dentry = dentry;
inode = dentry->d_inode;
for (j = 0; j < o->ioo_bufcnt; j++, rnb++, lnb++) {
- if (j == 0)
- lnb->dentry = dentry;
- else
- lnb->dentry = dget(dentry);
-
+ lnb->dentry = dentry;
lnb->offset = rnb->offset;
lnb->len = rnb->len;
lnb->flags = rnb->flags;
/* If there's no more data, abort early.
* lnb->page == NULL and lnb->rc == 0, so it's
* easy to detect later. */
- f_dput(dentry);
- lnb->dentry = NULL;
break;
} else {
rc = filter_start_page_read(inode, lnb);
"page err %u@"LPU64" %u/%u %p: rc %d\n",
lnb->len, lnb->offset, j, o->ioo_bufcnt,
dentry, rc);
- f_dput(dentry);
- GOTO(out_pages, rc);
+ cleanup_phase = 1;
+ GOTO(cleanup, rc);
}
tot_bytes += lnb->rc;
- if (lnb->rc < lnb->len)
- break; /* short read */
+ if (lnb->rc < lnb->len) {
+ /* short read, be sure to wait on it */
+ lnb++;
+ break;
+ }
}
}
if (rc) {
CERROR("error page %u@"LPU64" %u %p: rc %d\n", lnb->len,
lnb->offset, (int)(lnb - res), lnb->dentry, rc);
- f_dput(lnb->dentry);
- GOTO(out_pages, rc);
+ cleanup_phase = 1;
+ GOTO(cleanup, rc);
}
}
CERROR("slow prep finish page %lus\n", (jiffies - now) / HZ);
EXIT;
-out:
- OBD_FREE(fso, objcount * sizeof(*fso));
- /* we saved the journal handle into oti->oti_handle instead */
- current->journal_info = NULL;
- pop_ctxt(&saved, &exp->exp_obd->u.filter.fo_ctxt, NULL);
- return rc;
-out_pages:
- while (lnb-- > res) {
- page_cache_release(lnb->page);
- f_dput(lnb->dentry);
+ cleanup:
+ switch (cleanup_phase) {
+ case 1:
+ for (lnb = res; lnb < (res + niocount); lnb++) {
+ if (lnb->page)
+ page_cache_release(lnb->page);
+ }
+ if (res->dentry != NULL)
+ f_dput(res->dentry);
+ else
+ CERROR("NULL dentry in cleanup -- tell CFS\n");
+ res->dentry = NULL;
+ case 0:
+ OBD_FREE(fso, objcount * sizeof(*fso));
+ pop_ctxt(&saved, &exp->exp_obd->u.filter.fo_ctxt, NULL);
}
- goto out; /* dropped the dentry refs already (one per page) */
-
-out_objinfo:
- for (i = 0; i < objcount && fso[i].fso_dentry; i++)
- f_dput(fso[i].fso_dentry);
- goto out;
+ return rc;
}
/* We need to balance prepare_write() calls with commit_write() calls.
RETURN(rc);
}
-int filter_commitrw(int cmd, struct obd_export *exp, struct obdo *oa,
- int objcount, struct obd_ioobj *obj, int niocount,
- struct niobuf_local *res, struct obd_trans_info *oti)
+static int filter_commitrw_read(struct obd_export *exp, int objcount,
+ struct obd_ioobj *obj, int niocount,
+ struct niobuf_local *res,
+ struct obd_trans_info *oti)
+{
+ struct obd_ioobj *o;
+ struct niobuf_local *lnb;
+ int i, j;
+ ENTRY;
+
+ for (i = 0, o = obj, lnb = res; i < objcount; i++, o++) {
+ for (j = 0 ; j < o->ioo_bufcnt ; j++, lnb++) {
+ if (lnb->page != NULL)
+ page_cache_release(lnb->page);
+ }
+ }
+ if (res->dentry != NULL)
+ f_dput(res->dentry);
+ RETURN(0);
+}
+
+static int
+filter_commitrw_write(int cmd, struct obd_export *exp, struct obdo *oa,
+ int objcount, struct obd_ioobj *obj, int niocount,
+ struct niobuf_local *res, struct obd_trans_info *oti)
{
struct obd_run_ctxt saved;
struct obd_ioobj *o;
}
if (time_after(jiffies, lnb->start + 15 * HZ))
- CERROR("slow commitrw %lusi (%lus)\n",
+ CERROR("slow commitrw %lus (%lus)\n",
(jiffies - lnb->start) / HZ,
(jiffies - now) / HZ);
RETURN(rc);
}
+/* XXX needs to trickle its oa down */
+int filter_commitrw(int cmd, struct obd_export *exp, struct obdo *oa,
+ int objcount, struct obd_ioobj *obj, int niocount,
+ struct niobuf_local *res, struct obd_trans_info *oti)
+{
+ if (cmd == OBD_BRW_WRITE)
+ return filter_commitrw_write(cmd, exp, oa, objcount, obj,
+ niocount, res, oti);
+ if (cmd == OBD_BRW_READ)
+ return filter_commitrw_read(exp, objcount, obj, niocount,
+ res, oti);
+ LBUG();
+ return -EPROTO;
+}
+
int filter_brw(int cmd, struct lustre_handle *conn, struct obdo *oa,
struct lov_stripe_md *lsm, obd_count oa_bufs,
struct brw_page *pga, struct obd_trans_info *oti)