fs/dcache.c | 15 ++++-
fs/namei.c | 132 ++++++++++++++++++++++++++++++++++++++++---------
fs/namespace.c | 1
- fs/open.c | 70 +++++++++++++++++--------
- fs/stat.c | 23 ++++++--
+ fs/open.c | 66 ++++++++++++++++--------
+ fs/stat.c | 24 ++++++--
fs/sysfs/inode.c | 2
- include/linux/dcache.h | 28 ++++++++++
+ include/linux/dcache.h | 33 ++++++++++++
include/linux/fs.h | 10 +++
include/linux/namei.h | 8 ++
kernel/ksyms.c | 7 ++
net/unix/af_unix.c | 2
- 11 files changed, 241 insertions(+), 57 deletions(-)
+ 11 files changed, 243 insertions(+), 57 deletions(-)
--- uml-2.5/fs/sysfs/inode.c~vfs_intent_2.5.69_rev1 2003-05-30 03:33:20.000000000 -0600
+++ uml-2.5-braam/fs/sysfs/inode.c 2003-05-31 22:24:46.000000000 -0600
void sysfs_hash_and_remove(struct dentry * dir, const char * name)
--- uml-2.5/fs/namei.c~vfs_intent_2.5.69_rev1 2003-05-30 03:33:15.000000000 -0600
-+++ uml-2.5-braam/fs/namei.c 2003-06-01 00:44:04.000000000 -0600
++++ uml-2.5-braam/fs/namei.c 2003-06-01 22:02:20.000000000 -0600
@@ -263,8 +263,15 @@ int deny_write_access(struct file * file
return 0;
}
static void chroot_fs_refs(struct nameidata *old_nd, struct nameidata *new_nd)
{
--- uml-2.5/fs/open.c~vfs_intent_2.5.69_rev1 2003-05-30 03:33:16.000000000 -0600
-+++ uml-2.5-braam/fs/open.c 2003-05-31 22:24:46.000000000 -0600
-@@ -97,7 +97,8 @@ static inline long do_sys_truncate(const
++++ uml-2.5-braam/fs/open.c 2003-06-01 21:54:37.000000000 -0600
+@@ -97,7 +97,7 @@ static inline long do_sys_truncate(const
struct nameidata nd;
struct inode * inode;
int error;
-
-+ struct lookup_intent it = { .it_op = IT_GETATTR };
-+ nd.it=it;
++ intent_init(&nd.it, IT_GETATTR, 0);
error = -EINVAL;
if (length < 0) /* sorry, but loff_t says... */
goto out;
-@@ -340,6 +341,8 @@ asmlinkage long sys_access(const char __
+@@ -340,6 +340,7 @@ asmlinkage long sys_access(const char __
int old_fsuid, old_fsgid;
kernel_cap_t old_cap;
int res;
-+ struct lookup_intent it = { .it_op = IT_GETATTR };
-+ nd.it=it;
++ intent_init(&nd.it, IT_GETATTR, 0);
if (mode & ~S_IRWXO) /* where's F_OK, X_OK, W_OK, R_OK? */
return -EINVAL;
-@@ -371,6 +374,7 @@ asmlinkage long sys_access(const char __
+@@ -371,6 +372,7 @@ asmlinkage long sys_access(const char __
if(!res && (mode & S_IWOTH) && IS_RDONLY(nd.dentry->d_inode)
&& !special_file(nd.dentry->d_inode->i_mode))
res = -EROFS;
path_release(&nd);
}
-@@ -385,6 +389,8 @@ asmlinkage long sys_chdir(const char __u
+@@ -385,6 +387,7 @@ asmlinkage long sys_chdir(const char __u
{
struct nameidata nd;
int error;
-+ struct lookup_intent it = { .it_op = IT_GETATTR };
-+ nd.it=it;
++ intent_init(&nd.it, IT_GETATTR, 0);
error = __user_walk(filename, LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &nd);
if (error)
-@@ -436,6 +442,8 @@ asmlinkage long sys_chroot(const char __
+@@ -436,6 +439,7 @@ asmlinkage long sys_chroot(const char __
{
struct nameidata nd;
int error;
-+ struct lookup_intent it = { .it_op = IT_GETATTR };
-+ nd.it=it;
++ intent_init(&nd.it, IT_GETATTR, 0);
error = __user_walk(filename, LOOKUP_FOLLOW | LOOKUP_DIRECTORY | LOOKUP_NOALT, &nd);
if (error)
-@@ -508,7 +516,7 @@ asmlinkage long sys_chmod(const char __u
+@@ -508,7 +512,7 @@ asmlinkage long sys_chmod(const char __u
error = -EROFS;
if (IS_RDONLY(inode))
goto dput_and_out;
error = -EPERM;
if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
goto dput_and_out;
-@@ -616,29 +624,13 @@ asmlinkage long sys_fchown(unsigned int
+@@ -616,29 +620,13 @@ asmlinkage long sys_fchown(unsigned int
* for the internal routines (ie open_namei()/follow_link() etc). 00 is
* used by symlinks.
*/
error = -ENFILE;
f = get_empty_filp();
-@@ -646,6 +638,7 @@ struct file *dentry_open(struct dentry *
+@@ -646,6 +634,7 @@ struct file *dentry_open(struct dentry *
goto cleanup_dentry;
f->f_flags = flags;
f->f_mode = (flags+1) & O_ACCMODE;
inode = dentry->d_inode;
if (f->f_mode & FMODE_WRITE) {
error = get_write_access(inode);
-@@ -664,6 +657,7 @@ struct file *dentry_open(struct dentry *
+@@ -664,6 +653,7 @@ struct file *dentry_open(struct dentry *
error = f->f_op->open(inode,f);
if (error)
goto cleanup_all;
}
f->f_flags &= ~(O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC);
-@@ -675,7 +669,7 @@ struct file *dentry_open(struct dentry *
+@@ -675,7 +665,7 @@ struct file *dentry_open(struct dentry *
goto cleanup_all;
}
}
return f;
cleanup_all:
-@@ -693,6 +687,38 @@ cleanup_dentry:
+@@ -693,6 +683,38 @@ cleanup_dentry:
return ERR_PTR(error);
}
+ int namei_flags, error;
+ struct file * temp_filp;
+ struct nameidata nd;
-+ nd.it= ((struct lookup_intent) { .it_op = IT_OPEN, .it_flags = flags });
++ intent_init(&nd.it, IT_OPEN, flags);
+
+ namei_flags = flags;
+ if ((namei_flags+1) & O_ACCMODE)
+ struct nameidata nd;
+ nd.dentry = dentry;
+ nd.mnt = mnt;
-+ nd.it = ((struct lookup_intent) { 0} );
++ intent_init(&nd.it, 0, 0);
+
+ return dentry_open_nd(&nd, flags);
+}
* Find an empty file descriptor entry, and mark it busy.
*/
--- uml-2.5/fs/stat.c~vfs_intent_2.5.69_rev1 2003-05-30 03:33:16.000000000 -0600
-+++ uml-2.5-braam/fs/stat.c 2003-06-01 01:06:38.000000000 -0600
++++ uml-2.5-braam/fs/stat.c 2003-06-01 22:00:14.000000000 -0600
@@ -33,7 +33,7 @@ void generic_fillattr(struct inode *inod
stat->blksize = inode->i_blksize;
}
{
struct nameidata nd;
int error;
-+ nd.it = ((struct lookup_intent) { IT_GETATTR });
++ intent_init(&nd.it, IT_GETATTR, 0);
- error = user_path_walk(name, &nd);
+ error = user_path_walk_it(name, &nd);
{
struct nameidata nd;
int error;
-+ nd.it = ((struct lookup_intent) { IT_GETATTR });
++ intent_init(&nd.it, IT_GETATTR, 0);
- error = user_path_walk_link(name, &nd);
+ error = user_path_walk_link_it(name, &nd);
path_release(&nd);
}
return error;
-@@ -86,11 +95,13 @@ int vfs_fstat(unsigned int fd, struct ks
+@@ -86,11 +95,14 @@ int vfs_fstat(unsigned int fd, struct ks
{
struct file *f = fget(fd);
int error = -EBADF;
-+ struct lookup_intent it = { .it_op = IT_GETATTR };
++ struct lookup_intent it;
++ intent_init(&it, IT_GETATTR, 0);
if (f) {
- error = vfs_getattr(f->f_vfsmnt, f->f_dentry, stat);
}
--- uml-2.5/include/linux/dcache.h~vfs_intent_2.5.69_rev1 2003-05-30 03:33:40.000000000 -0600
-+++ uml-2.5-braam/include/linux/dcache.h 2003-05-31 22:24:46.000000000 -0600
-@@ -12,6 +12,27 @@
++++ uml-2.5-braam/include/linux/dcache.h 2003-06-01 22:02:38.000000000 -0600
+@@ -4,6 +4,7 @@
+ #ifdef __KERNEL__
+
+ #include <asm/atomic.h>
++#include <linux/string.h>
+ #include <linux/list.h>
+ #include <linux/spinlock.h>
+ #include <linux/cache.h>
+@@ -12,6 +13,32 @@
struct vfsmount;
+ void *it_data;
+};
+
-+
++static inline void intent_init(struct lookup_intent *it, int op, int flags)
++{
++ memset(it, 0, sizeof(*it));
++ it->it_op = op;
++ it->it_flags = flags;
++}
/*
* linux/include/linux/dcache.h
*
-@@ -34,6 +55,8 @@ struct qstr {
+@@ -34,6 +61,8 @@ struct qstr {
char name_str[0];
};
struct dentry_stat_t {
int nr_dentry;
int nr_unused;
-@@ -97,6 +120,7 @@ struct dentry {
- unsigned long d_move_count; /* to indicated moved dentry while lockless lookup */
- struct qstr * d_qstr; /* quick str ptr used in lockless lookup and concurrent d_move */
- struct dentry * d_parent; /* parent directory */
-+ struct lookup_intent *d_it;
- struct qstr d_name;
- struct hlist_node d_hash; /* lookup hash list */
- struct hlist_head * d_bucket; /* lookup hash bucket */
-@@ -112,6 +136,8 @@ struct dentry_operations {
+@@ -112,6 +141,8 @@ struct dentry_operations {
int (*d_delete)(struct dentry *);
void (*d_release)(struct dentry *);
void (*d_iput)(struct dentry *, struct inode *);
};
/* the dentry parameter passed to d_hash and d_compare is the parent
-@@ -152,6 +178,8 @@ d_iput: no no yes
+@@ -152,6 +183,8 @@ d_iput: no no yes
#define DCACHE_REFERENCED 0x0008 /* Recently used, don't discard. */
#define DCACHE_UNHASHED 0x0010
extern int vfs_permission(struct inode *, int);
extern int get_write_access(struct inode *);
--- uml-2.5/include/linux/namei.h~vfs_intent_2.5.69_rev1 2003-05-30 03:33:42.000000000 -0600
-+++ uml-2.5-braam/include/linux/namei.h 2003-06-01 00:45:52.000000000 -0600
++++ uml-2.5-braam/include/linux/namei.h 2003-06-01 21:49:20.000000000 -0600
@@ -11,6 +11,7 @@ struct nameidata {
struct qstr last;
unsigned int flags;
fs/exec.c | 2 -
- fs/namei.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++------
- fs/open.c | 73 +++++++++++++++++++++++++++++++++++++++++------
+ fs/namei.c | 82 +++++++++++++++++++++++++++++++++++++++++++++++------
+ fs/open.c | 73 ++++++++++++++++++++++++++++++++++++++++-------
include/linux/fs.h | 9 +++++
- 4 files changed, 144 insertions(+), 21 deletions(-)
+ 4 files changed, 145 insertions(+), 21 deletions(-)
---- uml-2.5-lustre/fs/namei.c~vfs_nointent_2.5.69_rev1 2003-05-31 17:04:05.000000000 -0700
-+++ uml-2.5-lustre-zab/fs/namei.c 2003-05-31 17:05:54.000000000 -0700
-@@ -1248,7 +1248,7 @@ int may_open(struct nameidata *nd, int a
+--- uml-2.5/fs/namei.c~vfs_nointent_2.5.69_rev1 2003-06-01 22:02:20.000000000 -0600
++++ uml-2.5-braam/fs/namei.c 2003-06-01 22:19:39.000000000 -0600
+@@ -1260,7 +1260,7 @@ int may_open(struct nameidata *nd, int a
if (!error) {
DQUOT_INIT(inode);
}
put_write_access(inode);
if (error)
-@@ -1493,6 +1493,15 @@ asmlinkage long sys_mknod(const char __u
+@@ -1495,6 +1495,7 @@ asmlinkage long sys_mknod(const char __u
+ char * tmp;
+ struct dentry * dentry;
+ struct nameidata nd;
++ intent_init(&nd.it, IT_LOOKUP, 0);
+
+ if (S_ISDIR(mode))
+ return -EPERM;
+@@ -1505,6 +1506,15 @@ asmlinkage long sys_mknod(const char __u
error = path_lookup(tmp, LOOKUP_PARENT, &nd);
if (error)
goto out;
dentry = lookup_create(&nd, 0);
error = PTR_ERR(dentry);
-@@ -1515,6 +1524,7 @@ asmlinkage long sys_mknod(const char __u
+@@ -1527,6 +1537,7 @@ asmlinkage long sys_mknod(const char __u
dput(dentry);
}
up(&nd.dentry->d_inode->i_sem);
path_release(&nd);
out:
putname(tmp);
-@@ -1556,10 +1566,18 @@ asmlinkage long sys_mkdir(const char __u
+@@ -1568,10 +1579,18 @@ asmlinkage long sys_mkdir(const char __u
if (!IS_ERR(tmp)) {
struct dentry *dentry;
struct nameidata nd;
-+ nd.it.it_op = 0; /* no intent yet */
++ intent_init(&nd.it, IT_LOOKUP, 0);
error = path_lookup(tmp, LOOKUP_PARENT, &nd);
if (error)
dentry = lookup_create(&nd, 1);
error = PTR_ERR(dentry);
if (!IS_ERR(dentry)) {
-@@ -1569,6 +1587,7 @@ asmlinkage long sys_mkdir(const char __u
+@@ -1581,6 +1600,7 @@ asmlinkage long sys_mkdir(const char __u
dput(dentry);
}
up(&nd.dentry->d_inode->i_sem);
path_release(&nd);
out:
putname(tmp);
-@@ -1649,6 +1668,7 @@ asmlinkage long sys_rmdir(const char __u
+@@ -1661,6 +1681,7 @@ asmlinkage long sys_rmdir(const char __u
char * name;
struct dentry *dentry;
struct nameidata nd;
-+ nd.it.it_op = 0; /* no intent yet */
++ intent_init(&nd.it, IT_LOOKUP, 0);
name = getname(pathname);
if(IS_ERR(name))
-@@ -1669,8 +1689,18 @@ asmlinkage long sys_rmdir(const char __u
+@@ -1681,8 +1702,18 @@ asmlinkage long sys_rmdir(const char __u
error = -EBUSY;
goto exit1;
}
error = PTR_ERR(dentry);
if (!IS_ERR(dentry)) {
error = vfs_rmdir(nd.dentry->d_inode, dentry);
-@@ -1725,6 +1755,7 @@ asmlinkage long sys_unlink(const char __
+@@ -1737,6 +1768,7 @@ asmlinkage long sys_unlink(const char __
struct dentry *dentry;
struct nameidata nd;
struct inode *inode = NULL;
-+ nd.it.it_op = 0; /* no intent yet */
++ intent_init(&nd.it, IT_LOOKUP, 0);
name = getname(pathname);
if(IS_ERR(name))
-@@ -1736,8 +1767,15 @@ asmlinkage long sys_unlink(const char __
+@@ -1748,8 +1780,15 @@ asmlinkage long sys_unlink(const char __
error = -EISDIR;
if (nd.last_type != LAST_NORM)
goto exit1;
error = PTR_ERR(dentry);
if (!IS_ERR(dentry)) {
/* Why not before? Because we want correct error value */
-@@ -1803,10 +1841,18 @@ asmlinkage long sys_symlink(const char _
+@@ -1815,10 +1854,18 @@ asmlinkage long sys_symlink(const char _
if (!IS_ERR(to)) {
struct dentry *dentry;
struct nameidata nd;
-+ nd.it.it_op = 0; /* no intent yet */
++ intent_init(&nd.it, IT_LOOKUP, 0);
error = path_lookup(to, LOOKUP_PARENT, &nd);
if (error)
dentry = lookup_create(&nd, 0);
error = PTR_ERR(dentry);
if (!IS_ERR(dentry)) {
-@@ -1814,6 +1860,7 @@ asmlinkage long sys_symlink(const char _
+@@ -1826,6 +1873,7 @@ asmlinkage long sys_symlink(const char _
dput(dentry);
}
up(&nd.dentry->d_inode->i_sem);
path_release(&nd);
out:
putname(to);
-@@ -1877,6 +1924,8 @@ asmlinkage long sys_link(const char __us
+@@ -1889,6 +1937,8 @@ asmlinkage long sys_link(const char __us
struct nameidata nd, old_nd;
int error;
char * to;
-+ nd.it.it_op = 0; /* no intent yet */
-+ old_nd.it.it_op = 0; /* no intent yet */
++ intent_init(&nd.it, IT_LOOKUP, 0);
++ intent_init(&old_nd.it, IT_LOOKUP, 0);
to = getname(newname);
if (IS_ERR(to))
-@@ -1891,6 +1940,13 @@ asmlinkage long sys_link(const char __us
+@@ -1903,6 +1953,13 @@ asmlinkage long sys_link(const char __us
error = -EXDEV;
if (old_nd.mnt != nd.mnt)
goto out_release;
new_dentry = lookup_create(&nd, 0);
error = PTR_ERR(new_dentry);
if (!IS_ERR(new_dentry)) {
-@@ -1941,7 +1997,7 @@ exit:
+@@ -1953,7 +2010,7 @@ exit:
* locking].
*/
int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry,
{
int error = 0;
struct inode *target;
-@@ -1986,7 +2042,7 @@ int vfs_rename_dir(struct inode *old_dir
+@@ -1998,7 +2055,7 @@ int vfs_rename_dir(struct inode *old_dir
}
int vfs_rename_other(struct inode *old_dir, struct dentry *old_dentry,
{
struct inode *target;
int error;
-@@ -2063,6 +2119,8 @@ static inline int do_rename(const char *
+@@ -2075,6 +2132,8 @@ static inline int do_rename(const char *
struct dentry * old_dentry, *new_dentry;
struct dentry * trap;
struct nameidata oldnd, newnd;
-+ oldnd.it.it_op = 0; /* no intent yet */
-+ newnd.it.it_op = 0; /* no intent yet */
++ intent_init(&oldnd.it, IT_LOOKUP, 0);
++ intent_init(&newnd.it, IT_LOOKUP, 0);
error = path_lookup(oldname, LOOKUP_PARENT, &oldnd);
if (error)
-@@ -2085,9 +2143,15 @@ static inline int do_rename(const char *
+@@ -2097,9 +2156,15 @@ static inline int do_rename(const char *
if (newnd.last_type != LAST_NORM)
goto exit2;
error = PTR_ERR(old_dentry);
if (IS_ERR(old_dentry))
goto exit3;
-@@ -2107,7 +2171,7 @@ static inline int do_rename(const char *
+@@ -2119,7 +2184,7 @@ static inline int do_rename(const char *
error = -EINVAL;
if (old_dentry == trap)
goto exit4;
error = PTR_ERR(new_dentry);
if (IS_ERR(new_dentry))
goto exit4;
-@@ -2116,8 +2180,7 @@ static inline int do_rename(const char *
+@@ -2128,8 +2193,7 @@ static inline int do_rename(const char *
if (new_dentry == trap)
goto exit5;
exit5:
dput(new_dentry);
exit4:
---- uml-2.5-lustre/fs/open.c~vfs_nointent_2.5.69_rev1 2003-05-31 17:04:05.000000000 -0700
-+++ uml-2.5-lustre-zab/fs/open.c 2003-05-31 17:05:36.000000000 -0700
+--- uml-2.5/fs/open.c~vfs_nointent_2.5.69_rev1 2003-06-01 21:54:37.000000000 -0600
++++ uml-2.5-braam/fs/open.c 2003-06-01 22:06:02.000000000 -0600
@@ -75,9 +75,10 @@ out:
return error;
}
up(&dentry->d_inode->i_sem);
return err;
}
-@@ -143,7 +151,7 @@ static inline long do_sys_truncate(const
+@@ -142,7 +150,7 @@ static inline long do_sys_truncate(const
error = locks_verify_truncate(inode, NULL, length);
if (!error) {
DQUOT_INIT(inode);
}
put_write_access(inode);
-@@ -195,7 +203,7 @@ static inline long do_sys_ftruncate(unsi
+@@ -194,7 +202,7 @@ static inline long do_sys_ftruncate(unsi
error = locks_verify_truncate(inode, file, length);
if (!error)
out_putf:
fput(file);
out:
-@@ -266,9 +274,19 @@ asmlinkage long sys_utime(char __user *
+@@ -265,9 +273,19 @@ asmlinkage long sys_utime(char __user *
(error = permission(inode,MAY_WRITE)) != 0)
goto dput_and_out;
}
dput_and_out:
path_release(&nd);
out:
-@@ -311,9 +329,19 @@ long do_utimes(char __user * filename, s
+@@ -310,9 +328,19 @@ long do_utimes(char __user * filename, s
(error = permission(inode,MAY_WRITE)) != 0)
goto dput_and_out;
}
dput_and_out:
path_release(&nd);
out:
-@@ -517,6 +545,18 @@ asmlinkage long sys_chmod(const char __u
+@@ -513,6 +541,18 @@ asmlinkage long sys_chmod(const char __u
if (IS_RDONLY(inode))
goto dput_and_out;
error = -EPERM;
if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
goto dput_and_out;
-@@ -550,6 +590,18 @@ static int chown_common(struct dentry *
+@@ -546,6 +586,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;
-@@ -563,6 +615,7 @@ static int chown_common(struct dentry *
+@@ -559,6 +611,7 @@ static int chown_common(struct dentry *
}
if (!S_ISDIR(inode->i_mode))
newattrs.ia_valid |= ATTR_KILL_SUID|ATTR_KILL_SGID;
down(&inode->i_sem);
error = notify_change(dentry, &newattrs);
up(&inode->i_sem);
---- uml-2.5-lustre/include/linux/fs.h~vfs_nointent_2.5.69_rev1 2003-05-31 17:04:05.000000000 -0700
-+++ uml-2.5-lustre-zab/include/linux/fs.h 2003-05-31 17:08:21.000000000 -0700
+--- uml-2.5/include/linux/fs.h~vfs_nointent_2.5.69_rev1 2003-06-01 00:13:35.000000000 -0600
++++ uml-2.5-braam/include/linux/fs.h 2003-06-01 22:06:02.000000000 -0600
@@ -737,13 +737,20 @@ struct inode_operations {
struct dentry * (*lookup_it) (struct inode *,struct dentry *,
struct lookup_intent *);
int (*readlink) (struct dentry *, char __user *,int);
int (*follow_link) (struct dentry *, struct nameidata *);
void (*truncate) (struct inode *);
-@@ -1027,7 +1034,7 @@ static inline int break_lease(struct ino
+@@ -1028,7 +1035,7 @@ static inline int break_lease(struct ino
asmlinkage long sys_open(const char *, int, int);
asmlinkage long sys_close(unsigned int); /* yes, it's really unsigned */
extern struct file *filp_open(const char *, int, int);
extern struct file * dentry_open(struct dentry *, struct vfsmount *, int);
---- uml-2.5-lustre/fs/exec.c~vfs_nointent_2.5.69_rev1 2003-05-31 16:58:16.000000000 -0700
-+++ uml-2.5-lustre-zab/fs/exec.c 2003-05-31 17:08:10.000000000 -0700
+--- uml-2.5/fs/exec.c~vfs_nointent_2.5.69_rev1 2003-05-31 22:26:50.000000000 -0600
++++ uml-2.5-braam/fs/exec.c 2003-06-01 22:06:02.000000000 -0600
@@ -1353,7 +1353,7 @@ int do_coredump(long signr, int exit_cod
goto close_fail;
if (!file->f_op->write)