+
+static void dx_sort_map (struct dx_map_entry *map, unsigned count)
+{
-+ struct dx_map_entry *p, *q, *top = map + count - 1;
-+ int more;
-+ /* Combsort until bubble sort doesn't suck */
-+ while (count > 2)
++ struct dx_map_entry *p, *q, *top = map + count - 1;
++ int more;
++ /* Combsort until bubble sort doesn't suck */
++ while (count > 2)
+ {
-+ count = count*10/13;
-+ if (count - 9 < 2) /* 9, 10 -> 11 */
-+ count = 11;
-+ for (p = top, q = p - count; q >= map; p--, q--)
-+ if (p->hash < q->hash)
-+ swap(*p, *q);
-+ }
-+ /* Garden variety bubble sort */
-+ do {
-+ more = 0;
-+ q = top;
-+ while (q-- > map)
++ count = count*10/13;
++ if (count - 9 < 2) /* 9, 10 -> 11 */
++ count = 11;
++ for (p = top, q = p - count; q >= map; p--, q--)
++ if (p->hash < q->hash)
++ swap(*p, *q);
++ }
++ /* Garden variety bubble sort */
++ do {
++ more = 0;
++ q = top;
++ while (q-- > map)
+ {
-+ if (q[1].hash >= q[0].hash)
++ if (q[1].hash >= q[0].hash)
+ continue;
-+ swap(*(q+1), *q);
-+ more = 1;
++ swap(*(q+1), *q);
++ more = 1;
+ }
+ } while(more);
+}
}
d_add(dentry, inode);
return NULL;
-@@ -238,6 +952,300 @@ static inline void ext3_set_de_type(stru
+@@ -238,6 +952,301 @@ static inline void ext3_set_de_type(stru
de->file_type = ext3_type_by_mode[(mode & S_IFMT)>>S_SHIFT];
}
+ data1 = bh2->b_data;
+
+ /* The 0th block becomes the root, move the dirents out */
-+ de = (struct ext3_dir_entry_2 *) &root->info;
++ de = &root->dotdot;
++ de = (struct ext3_dir_entry_2 *) ((char *)de + de->rec_len);
+ len = ((char *) root) + blocksize - (char *) de;
+ memcpy (data1, de, len);
+ de = (struct ext3_dir_entry_2 *) data1;
- inode->u.ext3_i.i_disksize = inode->i_size;
+ EXT3_I(inode)->i_disksize = inode->i_size;
err = ext3_add_nondir(handle, dentry, inode);
-+ ext3_mark_inode_dirty(handle, inode);
++ ext3_mark_inode_dirty(handle, inode);
out_stop:
ext3_journal_stop(handle, dir);
return err;
+
+static void dx_sort_map (struct dx_map_entry *map, unsigned count)
+{
-+ struct dx_map_entry *p, *q, *top = map + count - 1;
-+ int more;
-+ /* Combsort until bubble sort doesn't suck */
-+ while (count > 2)
++ struct dx_map_entry *p, *q, *top = map + count - 1;
++ int more;
++ /* Combsort until bubble sort doesn't suck */
++ while (count > 2)
+ {
-+ count = count*10/13;
-+ if (count - 9 < 2) /* 9, 10 -> 11 */
-+ count = 11;
-+ for (p = top, q = p - count; q >= map; p--, q--)
-+ if (p->hash < q->hash)
-+ swap(*p, *q);
-+ }
-+ /* Garden variety bubble sort */
-+ do {
-+ more = 0;
-+ q = top;
-+ while (q-- > map)
++ count = count*10/13;
++ if (count - 9 < 2) /* 9, 10 -> 11 */
++ count = 11;
++ for (p = top, q = p - count; q >= map; p--, q--)
++ if (p->hash < q->hash)
++ swap(*p, *q);
++ }
++ /* Garden variety bubble sort */
++ do {
++ more = 0;
++ q = top;
++ while (q-- > map)
+ {
-+ if (q[1].hash >= q[0].hash)
++ if (q[1].hash >= q[0].hash)
+ continue;
-+ swap(*(q+1), *q);
-+ more = 1;
++ swap(*(q+1), *q);
++ more = 1;
+ }
+ } while(more);
+}
}
d_add(dentry, inode);
return NULL;
-@@ -237,6 +951,300 @@ static inline void ext3_set_de_type(stru
+@@ -237,6 +951,301 @@ static inline void ext3_set_de_type(stru
de->file_type = ext3_type_by_mode[(mode & S_IFMT)>>S_SHIFT];
}
+ data1 = bh2->b_data;
+
+ /* The 0th block becomes the root, move the dirents out */
-+ de = (struct ext3_dir_entry_2 *) &root->info;
++ de = &root->dotdot;
++ de = (struct ext3_dir_entry_2 *) ((char *)de + de->rec_len);
+ len = ((char *) root) + blocksize - (char *) de;
+ memcpy (data1, de, len);
+ de = (struct ext3_dir_entry_2 *) data1;
- fs/ext3/ialloc.c | 38 ++++++++++++++++++++++++++++++++++++--
+ fs/ext3/ialloc.c | 40 ++++++++++++++++++++++++++++++++++++++--
+ fs/ext3/inode.c | 2 +-
fs/ext3/ioctl.c | 25 +++++++++++++++++++++++++
- fs/ext3/namei.c | 12 ++++++++----
+ fs/ext3/namei.c | 21 +++++++++++++++++----
+ include/linux/dcache.h | 5 +++++
include/linux/ext3_fs.h | 5 ++++-
- 4 files changed, 73 insertions(+), 7 deletions(-)
+ 6 files changed, 90 insertions(+), 8 deletions(-)
---- linux-2.4.20/fs/ext3/namei.c~extN-wantedi 2003-04-08 23:35:55.000000000 -0600
-+++ linux-2.4.20-braam/fs/ext3/namei.c 2003-04-08 23:35:55.000000000 -0600
-@@ -1555,7 +1555,8 @@ static int ext3_create (struct inode * d
+--- linux-2.4.18-chaos-uml/fs/ext3/namei.c~extN-wantedi 2003-09-18 12:17:23.000000000 +0400
++++ linux-2.4.18-chaos-uml-alexey/fs/ext3/namei.c 2003-09-18 12:17:26.000000000 +0400
+@@ -1531,6 +1531,19 @@ static int ext3_add_nondir(handle_t *han
+ return err;
+ }
+
++static struct inode * ext3_new_inode_wantedi(handle_t *handle, struct inode *dir,
++ int mode, struct dentry *dentry)
++{
++ unsigned long inum = 0;
++
++ if (dentry->d_fsdata != NULL) {
++ struct dentry_params *param =
++ (struct dentry_params *) dentry->d_fsdata;
++ inum = param->p_inum;
++ }
++ return ext3_new_inode(handle, dir, mode, inum);
++}
++
+ /*
+ * By the time this is called, we already have created
+ * the directory cache entry for the new file, but it
+@@ -1554,7 +1567,7 @@ static int ext3_create (struct inode * d
if (IS_SYNC(dir))
handle->h_sync = 1;
- inode = ext3_new_inode (handle, dir, mode);
-+ inode = ext3_new_inode (handle, dir, mode,
-+ (unsigned long)dentry->d_fsdata);
++ inode = ext3_new_inode_wantedi (handle, dir, mode, dentry);
err = PTR_ERR(inode);
if (!IS_ERR(inode)) {
inode->i_op = &ext3_file_inode_operations;
-@@ -1583,7 +1584,8 @@ static int ext3_mknod (struct inode * di
+@@ -1583,7 +1596,7 @@ static int ext3_mknod (struct inode * di
if (IS_SYNC(dir))
handle->h_sync = 1;
- inode = ext3_new_inode (handle, dir, mode);
-+ inode = ext3_new_inode (handle, dir, mode,
-+ (unsigned long)dentry->d_fsdata);
++ inode = ext3_new_inode_wantedi (handle, dir, mode, dentry);
err = PTR_ERR(inode);
if (!IS_ERR(inode)) {
init_special_inode(inode, mode, rdev);
-@@ -1613,7 +1615,8 @@ static int ext3_mkdir(struct inode * dir
+@@ -1614,7 +1627,7 @@ static int ext3_mkdir(struct inode * dir
if (IS_SYNC(dir))
handle->h_sync = 1;
- inode = ext3_new_inode (handle, dir, S_IFDIR | mode);
-+ inode = ext3_new_inode (handle, dir, S_IFDIR | mode,
-+ (unsigned long)dentry->d_fsdata);
++ inode = ext3_new_inode_wantedi (handle, dir, S_IFDIR | mode, dentry);
err = PTR_ERR(inode);
if (IS_ERR(inode))
goto out_stop;
-@@ -2009,7 +2012,8 @@ static int ext3_symlink (struct inode *
+@@ -2008,7 +2021,7 @@ static int ext3_symlink (struct inode *
if (IS_SYNC(dir))
handle->h_sync = 1;
- inode = ext3_new_inode (handle, dir, S_IFLNK|S_IRWXUGO);
-+ inode = ext3_new_inode (handle, dir, S_IFLNK|S_IRWXUGO,
-+ (unsigned long)dentry->d_fsdata);
++ inode = ext3_new_inode_wantedi (handle, dir, S_IFLNK|S_IRWXUGO, dentry);
err = PTR_ERR(inode);
if (IS_ERR(inode))
goto out_stop;
---- linux-2.4.20/fs/ext3/ialloc.c~extN-wantedi 2003-04-08 23:35:55.000000000 -0600
-+++ linux-2.4.20-braam/fs/ext3/ialloc.c 2003-04-08 23:35:55.000000000 -0600
-@@ -299,7 +299,8 @@ error_return:
+--- linux-2.4.18-chaos-uml/fs/ext3/ialloc.c~extN-wantedi 2003-09-18 12:17:25.000000000 +0400
++++ linux-2.4.18-chaos-uml-alexey/fs/ext3/ialloc.c 2003-09-18 12:17:26.000000000 +0400
+@@ -330,7 +330,8 @@ int ext3_itable_block_used(struct super_
* group to find a free inode.
*/
struct inode * ext3_new_inode (handle_t *handle,
extern void ext3_free_inode (handle_t *, struct inode *);
extern struct inode * ext3_orphan_get (struct super_block *, unsigned long);
extern unsigned long ext3_count_free_inodes (struct super_block *);
-@@ -757,4 +759,5 @@ extern struct inode_operations ext3_fast
+@@ -776,4 +778,5 @@ extern struct inode_operations ext3_fast
#endif /* __KERNEL__ */
+#define EXT3_IOC_CREATE_INUM _IOW('f', 5, long)
#endif /* _LINUX_EXT3_FS_H */
+--- linux-2.4.18-chaos-uml/include/linux/dcache.h~extN-wantedi 2003-09-18 12:17:17.000000000 +0400
++++ linux-2.4.18-chaos-uml-alexey/include/linux/dcache.h 2003-09-18 12:18:47.000000000 +0400
+@@ -62,6 +62,11 @@ static inline void intent_init(struct lo
+
+ #define IS_ROOT(x) ((x) == (x)->d_parent)
+
++struct dentry_params {
++ unsigned long p_inum;
++ void *p_ptr;
++};
++
+ /*
+ * "quick string" -- eases parameter passing, but more importantly
+ * saves "metadata" about the string (ie length and the hash).
_
/*
* ext3_add_entry()
*
-@@ -255,118 +849,278 @@
+@@ -255,118 +849,279 @@
struct inode *inode)
{
struct inode *dir = dentry->d_parent->d_inode;
+ data1 = bh2->b_data;
+
+ /* The 0th block becomes the root, move the dirents out */
-+ de = (ext3_dirent *) &root->info;
++ de = &root->dotdot;
++ de = (struct ext3_dir_entry_2 *) ((char *)de + de->rec_len);
+ len = ((char *) root) + sb->s_blocksize - (char *) de;
+ memcpy (data1, de, len);
+ de = (ext3_dirent *) data1;
- 0 files changed
+ fs/dcache.c | 19 ++
+ fs/exec.c | 17 +-
+ fs/namei.c | 333 ++++++++++++++++++++++++++++++++++++++--------
+ fs/namespace.c | 28 ++-
+ fs/open.c | 176 +++++++++++++++++-------
+ fs/proc/base.c | 3
+ fs/stat.c | 28 ++-
+ include/linux/dcache.h | 60 ++++++++
+ include/linux/fs.h | 32 ++++
+ include/linux/fs_struct.h | 4
+ kernel/exit.c | 3
+ kernel/fork.c | 3
+ kernel/ksyms.c | 1
+ 13 files changed, 578 insertions(+), 129 deletions(-)
-Index: linux-2.4.20-rh/fs/dcache.c
-===================================================================
---- linux-2.4.20-rh.orig/fs/dcache.c 2003-08-08 13:50:29.000000000 +0800
-+++ linux-2.4.20-rh/fs/dcache.c 2003-08-08 17:12:59.000000000 +0800
-@@ -186,6 +186,13 @@
+--- linux-2.4.20-rh-20.9/fs/dcache.c~vfs_intent-2.4.20-rh 2003-09-13 19:34:35.000000000 +0400
++++ linux-2.4.20-rh-20.9-alexey/fs/dcache.c 2003-09-14 17:34:53.000000000 +0400
+@@ -186,6 +186,13 @@ int d_invalidate(struct dentry * dentry)
spin_unlock(&dcache_lock);
return 0;
}
/*
* Check whether to do a partial shrink_dcache
* to get rid of unused child entries.
-@@ -841,13 +848,19 @@
+@@ -841,13 +848,19 @@ void d_delete(struct dentry * dentry)
* Adds a dentry to the hash according to its name.
*/
}
#define do_switch(x,y) do { \
-Index: linux-2.4.20-rh/fs/namei.c
-===================================================================
---- linux-2.4.20-rh.orig/fs/namei.c 2003-08-08 13:50:29.000000000 +0800
-+++ linux-2.4.20-rh/fs/namei.c 2003-08-08 17:12:59.000000000 +0800
+--- linux-2.4.20-rh-20.9/fs/exec.c~vfs_intent-2.4.20-rh 2003-09-13 19:34:35.000000000 +0400
++++ linux-2.4.20-rh-20.9-alexey/fs/exec.c 2003-09-14 17:34:53.000000000 +0400
+@@ -114,8 +114,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 = FMODE_READ|FMODE_EXEC };
+
+- error = user_path_walk(library, &nd);
++ error = user_path_walk_it(library, &nd, &it);
+ if (error)
+ goto out;
+
+@@ -127,7 +129,8 @@ asmlinkage long sys_uselib(const char *
+ if (error)
+ goto exit;
+
+- file = dentry_open(nd.dentry, nd.mnt, O_RDONLY);
++ file = dentry_open_it(nd.dentry, nd.mnt, O_RDONLY, &it);
++ intent_release(&it);
+ error = PTR_ERR(file);
+ if (IS_ERR(file))
+ goto out;
+@@ -382,8 +385,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 = 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;
+@@ -395,7 +400,8 @@ struct file *open_exec(const char *name)
+ err = -EACCES;
+ file = ERR_PTR(err);
+ if (!err) {
+- file = dentry_open(nd.dentry, nd.mnt, O_RDONLY);
++ file = dentry_open_it(nd.dentry, nd.mnt, O_RDONLY, &it);
++ intent_release(&it);
+ if (!IS_ERR(file)) {
+ err = deny_write_access(file);
+ if (err) {
+@@ -407,6 +413,7 @@ out:
+ return file;
+ }
+ }
++ intent_release(&it);
+ path_release(&nd);
+ }
+ goto out;
+@@ -1296,7 +1303,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)
++ if (do_truncate(file->f_dentry, 0, 0) != 0)
+ goto close_fail;
+
+ retval = binfmt->core_dump(signr, regs, file);
+--- linux-2.4.20-rh-20.9/fs/namei.c~vfs_intent-2.4.20-rh 2003-09-13 19:34:25.000000000 +0400
++++ linux-2.4.20-rh-20.9-alexey/fs/namei.c 2003-09-14 17:34:53.000000000 +0400
@@ -94,6 +94,13 @@
* XEmacs seems to be relying on it...
*/
/* In order to reduce some races, while at the same time doing additional
* checking and hopefully speeding things up, we copy filenames to the
* kernel data space before using them..
-@@ -260,10 +267,19 @@
+@@ -260,10 +267,19 @@ void path_release(struct nameidata *nd)
* Internal lookup() using the new generic dcache.
* SMP-safe
*/
if (dentry && dentry->d_op && dentry->d_op->d_revalidate) {
if (!dentry->d_op->d_revalidate(dentry, flags) && !d_invalidate(dentry)) {
dput(dentry);
-@@ -281,11 +297,14 @@
+@@ -281,11 +297,15 @@ static struct dentry * cached_lookup(str
* make sure that nobody added the entry to the dcache in the meantime..
* SMP-safe
*/
{
struct dentry * result;
struct inode *dir = parent->d_inode;
++ int counter = 0;
+again:
-+
++ counter++;
down(&dir->i_sem);
/*
* First re-do the cached lookup just in case it was created
-@@ -300,6 +319,9 @@
+@@ -300,6 +320,9 @@ static struct dentry * real_lookup(struc
result = ERR_PTR(-ENOMEM);
if (dentry) {
lock_kernel();
result = dir->i_op->lookup(dir, dentry);
unlock_kernel();
if (result)
-@@ -321,6 +343,12 @@
+@@ -321,6 +344,15 @@ static struct dentry * real_lookup(struc
dput(result);
result = ERR_PTR(-ENOENT);
}
+ if (!result->d_op->d_revalidate_it(result, flags, it) &&
+ !d_invalidate(result)) {
+ dput(result);
-+ goto again;
++ if (counter > 10)
++ result = ERR_PTR(-ESTALE);
++ if (!IS_ERR(result))
++ goto again;
+ }
}
return result;
}
-@@ -334,7 +362,8 @@
+@@ -334,7 +366,8 @@ int max_recursive_link = 5;
* Without that kind of total limit, nasty chains of consecutive
* symlinks can cause almost arbitrarily long lookups.
*/
{
int err;
if (current->link_count >= max_recursive_link)
-@@ -348,10 +377,18 @@
+@@ -348,10 +381,18 @@ static inline int do_follow_link(struct
current->link_count++;
current->total_link_count++;
UPDATE_ATIME(dentry->d_inode);
path_release(nd);
return -ELOOP;
}
-@@ -381,15 +418,26 @@
+@@ -381,15 +422,26 @@ int follow_up(struct vfsmount **mnt, str
return __follow_up(mnt, dentry);
}
dput(*dentry);
mntput(mounted->mnt_parent);
*dentry = dget(mounted->mnt_root);
-@@ -401,7 +449,7 @@
+@@ -401,7 +453,7 @@ static inline int __follow_down(struct v
int follow_down(struct vfsmount **mnt, struct dentry **dentry)
{
}
static inline void follow_dotdot(struct nameidata *nd)
-@@ -437,7 +485,7 @@
+@@ -437,7 +489,7 @@ static inline void follow_dotdot(struct
mntput(nd->mnt);
nd->mnt = parent;
}
;
}
-@@ -449,7 +497,8 @@
+@@ -449,7 +501,8 @@ static inline void follow_dotdot(struct
*
* We expect 'base' to be positive and a directory.
*/
{
struct dentry *dentry;
struct inode *inode;
-@@ -526,19 +575,18 @@
+@@ -526,19 +579,18 @@ int link_path_walk(const char * name, st
break;
}
/* This does the actual lookups.. */
err = -ENOENT;
inode = dentry->d_inode;
-@@ -549,7 +597,7 @@
+@@ -549,7 +601,7 @@ int link_path_walk(const char * name, st
goto out_dput;
if (inode->i_op->follow_link) {
dput(dentry);
if (err)
goto return_err;
-@@ -565,7 +613,7 @@
+@@ -565,7 +617,7 @@ int link_path_walk(const char * name, st
nd->dentry = dentry;
}
err = -ENOTDIR;
break;
continue;
/* here ends the main loop */
-@@ -592,22 +640,22 @@
+@@ -592,22 +644,22 @@ last_component:
if (err < 0)
break;
}
dput(dentry);
if (err)
goto return_err;
-@@ -621,7 +669,8 @@
+@@ -621,7 +673,8 @@ last_component:
goto no_inode;
if (lookup_flags & LOOKUP_DIRECTORY) {
err = -ENOTDIR;
break;
}
goto return_base;
-@@ -645,6 +694,23 @@
+@@ -645,6 +698,25 @@ return_reval:
* Check the cached dentry for staleness.
*/
dentry = nd->dentry;
-+ revalidate_again:
+ if (dentry && dentry->d_op && dentry->d_op->d_revalidate_it) {
+ err = -ESTALE;
+ if (!dentry->d_op->d_revalidate_it(dentry, 0, it)) {
+ &dentry->d_name, 0, NULL);
+ d_invalidate(dentry);
+ dput(dentry);
-+ dentry = new;
-+ goto revalidate_again;
++ if (IS_ERR(new)) {
++ err = PTR_ERR(new);
++ break;
++ }
++ nd->dentry = new;
+ }
+ } else
if (dentry && dentry->d_op && dentry->d_op->d_revalidate) {
err = -ESTALE;
if (!dentry->d_op->d_revalidate(dentry, 0)) {
-@@ -658,15 +724,28 @@
+@@ -658,15 +730,28 @@ out_dput:
dput(dentry);
break;
}
}
/* SMP-safe */
-@@ -751,6 +830,17 @@
+@@ -751,6 +836,17 @@ walk_init_root(const char *name, struct
}
/* SMP-safe */
int path_lookup(const char *path, unsigned flags, struct nameidata *nd)
{
int error = 0;
-@@ -765,6 +855,7 @@
+@@ -765,6 +861,7 @@ int path_init(const char *name, unsigned
{
nd->last_type = LAST_ROOT; /* if there are only slashes... */
nd->flags = flags;
if (*name=='/')
return walk_init_root(name,nd);
read_lock(¤t->fs->lock);
-@@ -779,7 +870,8 @@
+@@ -779,7 +876,8 @@ int path_init(const char *name, unsigned
* needs parent already locked. Doesn't follow mounts.
* SMP-safe.
*/
{
struct dentry * dentry;
struct inode *inode;
-@@ -802,13 +894,16 @@
+@@ -802,13 +900,16 @@ struct dentry * lookup_hash(struct qstr
goto out;
}
dentry = inode->i_op->lookup(inode, new);
unlock_kernel();
if (!dentry)
-@@ -820,6 +915,12 @@
+@@ -820,6 +921,12 @@ out:
return dentry;
}
/* SMP-safe */
struct dentry * lookup_one_len(const char * name, struct dentry * base, int len)
{
-@@ -841,7 +942,7 @@
+@@ -841,7 +948,7 @@ struct dentry * lookup_one_len(const cha
}
this.hash = end_name_hash(hash);
access:
return ERR_PTR(-EACCES);
}
-@@ -872,6 +973,23 @@
+@@ -872,6 +979,23 @@ int __user_walk(const char *name, unsign
return err;
}
/*
* It's inline, so penalty for filesystems that don't use sticky bit is
* minimal.
-@@ -969,7 +1087,8 @@
+@@ -969,7 +1093,8 @@ static inline int lookup_flags(unsigned
return retval;
}
{
int error;
-@@ -982,12 +1101,15 @@
+@@ -982,12 +1107,15 @@ int vfs_create(struct inode *dir, struct
goto exit_lock;
error = -EACCES; /* shouldn't it be ENOSYS? */
unlock_kernel();
exit_lock:
up(&dir->i_zombie);
-@@ -996,6 +1118,11 @@
+@@ -996,6 +1124,11 @@ exit_lock:
return error;
}
/*
* open_namei()
*
-@@ -1010,7 +1137,8 @@
+@@ -1010,7 +1143,8 @@ exit_lock:
* for symlinks (where the permissions are checked later).
* SMP-safe
*/
{
int acc_mode, error = 0;
struct inode *inode;
-@@ -1024,7 +1152,7 @@
+@@ -1020,11 +1154,14 @@ int open_namei(const char * pathname, in
+
+ acc_mode = ACC_MODE(flag);
+
++ if (it)
++ it->it_flags = flag;
++
+ /*
* The simplest case - just a plain lookup.
*/
if (!(flag & O_CREAT)) {
if (error)
return error;
dentry = nd->dentry;
-@@ -1034,6 +1162,10 @@
+@@ -1034,6 +1171,10 @@ int open_namei(const char * pathname, in
/*
* Create - we need to know the parent.
*/
-+ if (it) {
-+ it->it_create_mode = mode;
-+ it->it_op |= IT_CREAT;
-+ }
++ if (it) {
++ it->it_create_mode = mode;
++ it->it_op |= IT_CREAT;
++ }
error = path_lookup(pathname, LOOKUP_PARENT, nd);
if (error)
return error;
-@@ -1049,7 +1181,7 @@
+@@ -1049,7 +1190,7 @@ int open_namei(const char * pathname, in
dir = nd->dentry;
down(&dir->d_inode->i_sem);
do_last:
error = PTR_ERR(dentry);
-@@ -1058,10 +1190,11 @@
+@@ -1058,10 +1199,11 @@ do_last:
goto exit;
}
up(&dir->d_inode->i_sem);
dput(nd->dentry);
nd->dentry = dentry;
-@@ -1086,7 +1219,7 @@
+@@ -1086,7 +1228,7 @@ do_last:
error = -ELOOP;
if (flag & O_NOFOLLOW)
goto exit_dput;
}
error = -ENOENT;
if (!dentry->d_inode)
-@@ -1165,7 +1298,7 @@
+@@ -1165,7 +1307,7 @@ ok:
if (!error) {
DQUOT_INIT(inode);
}
put_write_access(inode);
if (error)
-@@ -1177,8 +1310,10 @@
+@@ -1177,8 +1319,10 @@ ok:
return 0;
exit_dput:
path_release(nd);
return error;
-@@ -1197,7 +1332,16 @@
+@@ -1197,7 +1341,16 @@ do_link:
* are done. Procfs-like symlinks just set LAST_BIND.
*/
UPDATE_ATIME(dentry->d_inode);
dput(dentry);
if (error)
return error;
-@@ -1219,13 +1363,20 @@
+@@ -1219,13 +1372,20 @@ do_link:
}
dir = nd->dentry;
down(&dir->d_inode->i_sem);
{
struct dentry *dentry;
-@@ -1233,7 +1384,7 @@
+@@ -1233,7 +1393,7 @@ static struct dentry *lookup_create(stru
dentry = ERR_PTR(-EEXIST);
if (nd->last_type != LAST_NORM)
goto fail;
if (IS_ERR(dentry))
goto fail;
if (!is_dir && nd->last.name[nd->last.len] && !dentry->d_inode)
-@@ -1289,7 +1440,16 @@
+@@ -1289,7 +1449,16 @@ asmlinkage long sys_mknod(const char * f
error = path_lookup(tmp, LOOKUP_PARENT, &nd);
if (error)
goto out;
error = PTR_ERR(dentry);
mode &= ~current->fs->umask;
-@@ -1310,6 +1470,7 @@
+@@ -1310,6 +1479,7 @@ asmlinkage long sys_mknod(const char * f
dput(dentry);
}
up(&nd.dentry->d_inode->i_sem);
path_release(&nd);
out:
putname(tmp);
-@@ -1357,7 +1518,14 @@
+@@ -1357,7 +1527,14 @@ asmlinkage long sys_mkdir(const char * p
error = path_lookup(tmp, LOOKUP_PARENT, &nd);
if (error)
goto out;
- dentry = lookup_create(&nd, 1);
-+ 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;
-+ }
++ 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, NULL);
error = PTR_ERR(dentry);
if (!IS_ERR(dentry)) {
error = vfs_mkdir(nd.dentry->d_inode, dentry,
-@@ -1365,6 +1533,7 @@
+@@ -1365,6 +1542,7 @@ asmlinkage long sys_mkdir(const char * p
dput(dentry);
}
up(&nd.dentry->d_inode->i_sem);
path_release(&nd);
out:
putname(tmp);
-@@ -1465,8 +1634,16 @@
+@@ -1465,8 +1643,16 @@ asmlinkage long sys_rmdir(const char * p
error = -EBUSY;
goto exit1;
}
-+ if (nd.dentry->d_inode->i_op->rmdir_raw) {
-+ struct inode_operations *op = nd.dentry->d_inode->i_op;
++ 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;
-+ }
++ error = op->rmdir_raw(&nd);
++ /* the file system wants to use normal vfs path now */
++ if (error != -EOPNOTSUPP)
++ goto exit1;
++ }
down(&nd.dentry->d_inode->i_sem);
- dentry = lookup_hash(&nd.last, nd.dentry);
+ dentry = lookup_hash_it(&nd.last, nd.dentry, NULL);
error = PTR_ERR(dentry);
if (!IS_ERR(dentry)) {
error = vfs_rmdir(nd.dentry->d_inode, dentry);
-@@ -1524,8 +1701,15 @@
+@@ -1524,8 +1710,15 @@ asmlinkage long sys_unlink(const char *
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;
-+ }
++ 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;
++ }
down(&nd.dentry->d_inode->i_sem);
- dentry = lookup_hash(&nd.last, nd.dentry);
+ dentry = lookup_hash_it(&nd.last, nd.dentry, NULL);
error = PTR_ERR(dentry);
if (!IS_ERR(dentry)) {
/* Why not before? Because we want correct error value */
-@@ -1592,15 +1776,23 @@
+@@ -1592,15 +1785,23 @@ asmlinkage long sys_symlink(const char *
error = path_lookup(to, LOOKUP_PARENT, &nd);
if (error)
goto out;
putname(to);
}
putname(from);
-@@ -1676,7 +1868,14 @@
+@@ -1676,7 +1877,14 @@ asmlinkage long sys_link(const char * ol
error = -EXDEV;
if (old_nd.mnt != nd.mnt)
goto out_release;
error = PTR_ERR(new_dentry);
if (!IS_ERR(new_dentry)) {
error = vfs_link(old_nd.dentry, nd.dentry->d_inode, new_dentry);
-@@ -1720,7 +1919,7 @@
+@@ -1720,7 +1928,7 @@ exit:
* locking].
*/
int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry,
{
int error;
struct inode *target;
-@@ -1799,7 +1998,7 @@
+@@ -1799,7 +2007,7 @@ out_unlock:
}
int vfs_rename_other(struct inode *old_dir, struct dentry *old_dentry,
{
int error;
-@@ -1887,9 +2086,18 @@
+@@ -1887,9 +2095,18 @@ static inline int do_rename(const char *
if (newnd.last_type != LAST_NORM)
goto exit2;
-+ if (old_dir->d_inode->i_op->rename_raw) {
++ if (old_dir->d_inode->i_op->rename_raw) {
+ lock_kernel();
-+ error = old_dir->d_inode->i_op->rename_raw(&oldnd, &newnd);
++ error = old_dir->d_inode->i_op->rename_raw(&oldnd, &newnd);
+ unlock_kernel();
-+ /* the file system wants to use normal vfs path now */
-+ if (error != -EOPNOTSUPP)
-+ goto exit2;
-+ }
++ /* the file system wants to use normal vfs path now */
++ if (error != -EOPNOTSUPP)
++ goto exit2;
++ }
+
double_lock(new_dir, old_dir);
error = PTR_ERR(old_dentry);
if (IS_ERR(old_dentry))
goto exit3;
-@@ -1905,16 +2113,16 @@
+@@ -1905,16 +2122,16 @@ static inline int do_rename(const char *
if (newnd.last.name[newnd.last.len])
goto exit4;
}
dput(new_dentry);
exit4:
dput(old_dentry);
-@@ -1965,20 +2173,28 @@
+@@ -1965,20 +2182,28 @@ out:
}
static inline int
out:
if (current->link_count || res || nd->last_type!=LAST_NORM)
return res;
-@@ -2002,7 +2218,13 @@
+@@ -2002,7 +2227,13 @@ fail:
int vfs_follow_link(struct nameidata *nd, const char *link)
{
}
/* get the link contents into pagecache */
-@@ -2044,7 +2266,7 @@
+@@ -2044,7 +2275,7 @@ int page_follow_link(struct dentry *dent
{
struct page *page = NULL;
char *s = page_getlink(dentry, &page);
if (page) {
kunmap(page);
page_cache_release(page);
-Index: linux-2.4.20-rh/fs/open.c
-===================================================================
---- linux-2.4.20-rh.orig/fs/open.c 2003-08-08 13:50:29.000000000 +0800
-+++ linux-2.4.20-rh/fs/open.c 2003-08-08 17:12:59.000000000 +0800
+--- linux-2.4.20-rh-20.9/fs/namespace.c~vfs_intent-2.4.20-rh 2003-09-13 19:34:35.000000000 +0400
++++ linux-2.4.20-rh-20.9-alexey/fs/namespace.c 2003-09-14 17:34:53.000000000 +0400
+@@ -99,6 +99,7 @@ static void detach_mnt(struct vfsmount *
+ {
+ old_nd->dentry = mnt->mnt_mountpoint;
+ old_nd->mnt = mnt->mnt_parent;
++ UNPIN(old_nd->dentry, old_nd->mnt, 1);
+ mnt->mnt_parent = mnt;
+ mnt->mnt_mountpoint = mnt->mnt_root;
+ list_del_init(&mnt->mnt_child);
+@@ -110,6 +111,7 @@ static void attach_mnt(struct vfsmount *
+ {
+ mnt->mnt_parent = mntget(nd->mnt);
+ mnt->mnt_mountpoint = dget(nd->dentry);
++ PIN(nd->dentry, nd->mnt, 1);
+ list_add(&mnt->mnt_hash, mount_hashtable+hash(nd->mnt, nd->dentry));
+ list_add(&mnt->mnt_child, &nd->mnt->mnt_mounts);
+ nd->dentry->d_mounted++;
+@@ -485,14 +487,17 @@ static int do_loopback(struct nameidata
+ {
+ struct nameidata old_nd;
+ struct vfsmount *mnt = NULL;
++ struct lookup_intent it = { .it_op = IT_GETATTR };
+ int err = mount_is_safe(nd);
+ if (err)
+ return err;
+ if (!old_name || !*old_name)
+ return -EINVAL;
+- err = path_lookup(old_name, LOOKUP_POSITIVE|LOOKUP_FOLLOW, &old_nd);
+- if (err)
++ err = path_lookup_it(old_name, LOOKUP_POSITIVE|LOOKUP_FOLLOW, &old_nd, &it);
++ if (err) {
++ intent_release(&it);
+ return err;
++ }
+
+ down_write(¤t->namespace->sem);
+ err = -EINVAL;
+@@ -515,6 +520,7 @@ static int do_loopback(struct nameidata
+ }
+
+ up_write(¤t->namespace->sem);
++ intent_release(&it);
+ path_release(&old_nd);
+ return err;
+ }
+@@ -698,6 +704,7 @@ long do_mount(char * dev_name, char * di
+ unsigned long flags, void *data_page)
+ {
+ struct nameidata nd;
++ struct lookup_intent it = { .it_op = IT_GETATTR };
+ int retval = 0;
+ int mnt_flags = 0;
+
+@@ -722,10 +729,11 @@ long do_mount(char * dev_name, char * di
+ flags &= ~(MS_NOSUID|MS_NOEXEC|MS_NODEV);
+
+ /* ... and get the mountpoint */
+- retval = path_lookup(dir_name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, &nd);
+- if (retval)
++ retval = path_lookup_it(dir_name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, &nd, &it);
++ if (retval) {
++ intent_release(&it);
+ return retval;
+-
++ }
+ if (flags & MS_REMOUNT)
+ retval = do_remount(&nd, flags & ~MS_REMOUNT, mnt_flags,
+ data_page);
+@@ -736,6 +744,8 @@ long do_mount(char * dev_name, char * di
+ else
+ retval = do_add_mount(&nd, type_page, flags, mnt_flags,
+ dev_name, data_page);
++
++ intent_release(&it);
+ path_release(&nd);
+ return retval;
+ }
+@@ -901,6 +911,8 @@ asmlinkage long sys_pivot_root(const cha
+ {
+ struct vfsmount *tmp;
+ struct nameidata new_nd, old_nd, parent_nd, root_parent, user_nd;
++ struct lookup_intent new_it = { .it_op = IT_GETATTR };
++ struct lookup_intent old_it = { .it_op = IT_GETATTR };
+ int error;
+
+ if (!capable(CAP_SYS_ADMIN))
+@@ -908,14 +920,14 @@ asmlinkage long sys_pivot_root(const cha
+
+ lock_kernel();
+
+- error = __user_walk(new_root, LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &new_nd);
++ error = __user_walk_it(new_root, LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &new_nd, &new_it);
+ if (error)
+ goto out0;
+ error = -EINVAL;
+ if (!check_mnt(new_nd.mnt))
+ goto out1;
+
+- error = __user_walk(put_old, LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &old_nd);
++ error = __user_walk_it(put_old, LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &old_nd, &old_it);
+ if (error)
+ goto out1;
+
+@@ -970,8 +982,10 @@ out2:
+ up(&old_nd.dentry->d_inode->i_zombie);
+ up_write(¤t->namespace->sem);
+ path_release(&user_nd);
++ intent_release(&old_it);
+ path_release(&old_nd);
+ out1:
++ intent_release(&new_it);
+ path_release(&new_nd);
+ out0:
+ unlock_kernel();
+--- linux-2.4.20-rh-20.9/fs/open.c~vfs_intent-2.4.20-rh 2003-09-13 19:34:25.000000000 +0400
++++ linux-2.4.20-rh-20.9-alexey/fs/open.c 2003-09-14 17:34:53.000000000 +0400
@@ -19,6 +19,8 @@
#include <asm/uaccess.h>
int vfs_statfs(struct super_block *sb, struct statfs *buf)
{
-@@ -95,9 +97,10 @@
+@@ -95,9 +97,10 @@ void fd_install(unsigned int fd, struct
write_unlock(&files->file_lock);
}
int error;
struct iattr newattrs;
-@@ -108,7 +111,13 @@
+@@ -108,7 +111,13 @@ int do_truncate(struct dentry *dentry, l
down(&inode->i_sem);
newattrs.ia_size = length;
newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
up(&inode->i_sem);
return error;
}
-@@ -118,12 +127,13 @@
+@@ -118,12 +127,13 @@ static inline long do_sys_truncate(const
struct nameidata nd;
struct inode * inode;
int error;
if (error)
goto out;
inode = nd.dentry->d_inode;
-@@ -163,11 +173,13 @@
+@@ -163,11 +173,13 @@ static inline long do_sys_truncate(const
error = locks_verify_truncate(inode, NULL, length);
if (!error) {
DQUOT_INIT(inode);
path_release(&nd);
out:
return error;
-@@ -215,7 +227,7 @@
+@@ -215,7 +227,7 @@ static inline long do_sys_ftruncate(unsi
error = locks_verify_truncate(inode, file, length);
if (!error)
out_putf:
fput(file);
out:
-@@ -260,11 +272,13 @@
+@@ -260,11 +272,13 @@ asmlinkage long sys_utime(char * filenam
struct inode * inode;
struct iattr newattrs;
error = -EROFS;
if (IS_RDONLY(inode))
goto dput_and_out;
-@@ -279,11 +293,25 @@
+@@ -279,11 +293,25 @@ asmlinkage long sys_utime(char * filenam
goto dput_and_out;
newattrs.ia_valid |= ATTR_ATIME_SET | ATTR_MTIME_SET;
error = notify_change(nd.dentry, &newattrs);
dput_and_out:
path_release(&nd);
-@@ -304,12 +332,14 @@
+@@ -304,12 +332,14 @@ asmlinkage long sys_utimes(char * filena
struct inode * inode;
struct iattr newattrs;
error = -EROFS;
if (IS_RDONLY(inode))
goto dput_and_out;
-@@ -324,7 +354,20 @@
+@@ -324,7 +354,20 @@ asmlinkage long sys_utimes(char * filena
newattrs.ia_atime = times[0].tv_sec;
newattrs.ia_mtime = times[1].tv_sec;
newattrs.ia_valid |= ATTR_ATIME_SET | ATTR_MTIME_SET;
if (current->fsuid != inode->i_uid &&
(error = permission(inode,MAY_WRITE)) != 0)
goto dput_and_out;
-@@ -347,6 +390,7 @@
+@@ -347,6 +390,7 @@ asmlinkage long sys_access(const char *
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;
-@@ -364,13 +408,14 @@
+@@ -364,13 +408,14 @@ asmlinkage long sys_access(const char *
else
current->cap_effective = current->cap_permitted;
path_release(&nd);
}
-@@ -385,8 +430,9 @@
+@@ -385,8 +430,9 @@ asmlinkage long sys_chdir(const char * f
{
int error;
struct nameidata nd;
-+ struct lookup_intent it = { .it_op = IT_GETATTR };
++ struct lookup_intent it = { .it_op = IT_GETATTR };
- error = __user_walk(filename,LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY,&nd);
+ error = __user_walk_it(filename,LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY,&nd, &it);
if (error)
goto out;
-@@ -397,6 +443,7 @@
+@@ -397,6 +443,7 @@ asmlinkage long sys_chdir(const char * f
set_fs_pwd(current->fs, nd.mnt, nd.dentry);
dput_and_out:
path_release(&nd);
out:
return error;
-@@ -436,9 +483,10 @@
+@@ -436,9 +483,10 @@ asmlinkage long sys_chroot(const char *
{
int error;
struct nameidata nd;
-+ struct lookup_intent it = { .it_op = IT_GETATTR };
++ struct lookup_intent it = { .it_op = IT_GETATTR };
- error = __user_walk(filename, LOOKUP_POSITIVE | LOOKUP_FOLLOW |
- LOOKUP_DIRECTORY | LOOKUP_NOALT, &nd);
if (error)
goto out;
-@@ -454,39 +502,56 @@
+@@ -454,39 +502,56 @@ asmlinkage long sys_chroot(const char *
set_fs_altroot();
error = 0;
dput_and_out:
fput(file);
out:
return err;
-@@ -495,30 +560,14 @@
+@@ -495,30 +560,14 @@ out:
asmlinkage long sys_chmod(const char * filename, mode_t mode)
{
struct nameidata nd;
path_release(&nd);
out:
return error;
-@@ -538,6 +587,20 @@
+@@ -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;
-@@ -642,8 +705,9 @@
+@@ -642,8 +705,9 @@ struct file *filp_open(const char * file
{
int namei_flags, error;
struct nameidata nd;
-
- flags &= ~O_DIRECT;
-+ struct lookup_intent it = { .it_op = IT_OPEN, .it_flags = flags };
++ struct lookup_intent it = { .it_op = IT_OPEN };
+
+ //flags &= ~O_DIRECT;
namei_flags = flags;
if ((namei_flags+1) & O_ACCMODE)
-@@ -651,14 +715,15 @@
+@@ -651,14 +715,15 @@ struct file *filp_open(const char * file
if (namei_flags & O_TRUNC)
namei_flags |= 2;
{
struct file * f;
struct inode *inode;
-@@ -695,12 +760,15 @@
+@@ -695,12 +760,15 @@ struct file *dentry_open(struct dentry *
}
if (f->f_op && f->f_op->open) {
return f;
cleanup_all:
-@@ -715,11 +783,17 @@
+@@ -715,11 +783,17 @@ cleanup_all:
cleanup_file:
put_filp(f);
cleanup_dentry:
/*
* Find an empty file descriptor entry, and mark it busy.
*/
-Index: linux-2.4.20-rh/fs/stat.c
-===================================================================
---- linux-2.4.20-rh.orig/fs/stat.c 2003-08-08 13:50:29.000000000 +0800
-+++ linux-2.4.20-rh/fs/stat.c 2003-08-08 17:12:59.000000000 +0800
-@@ -17,10 +17,12 @@
+--- linux-2.4.20-rh-20.9/fs/proc/base.c~vfs_intent-2.4.20-rh 2003-09-13 19:34:35.000000000 +0400
++++ linux-2.4.20-rh-20.9-alexey/fs/proc/base.c 2003-09-14 17:34:53.000000000 +0400
+@@ -494,6 +494,9 @@ static int proc_pid_follow_link(struct d
+
+ error = inode->u.proc_i.op.proc_get_link(inode, &nd->dentry, &nd->mnt);
+ nd->last_type = LAST_BIND;
++
++ if (nd->intent != NULL)
++ nd->intent->d.lustre.it_int_flags |= IT_FL_FOLLOWED;
+ out:
+ return error;
+ }
+--- linux-2.4.20-rh-20.9/fs/stat.c~vfs_intent-2.4.20-rh 2003-09-13 19:34:35.000000000 +0400
++++ linux-2.4.20-rh-20.9-alexey/fs/stat.c 2003-09-14 17:35:10.000000000 +0400
+@@ -17,10 +17,14 @@
* Revalidate the inode. This is required for proper NFS attribute caching.
*/
static __inline__ int
{
struct inode * inode = dentry->d_inode;
- if (inode->i_op && inode->i_op->revalidate)
++ if (!inode)
++ return -ENOENT;
+ if (inode->i_op && inode->i_op->revalidate_it)
+ return inode->i_op->revalidate_it(dentry, it);
+ else if (inode->i_op && inode->i_op->revalidate)
return inode->i_op->revalidate(dentry);
return 0;
}
-@@ -32,13 +34,13 @@
+@@ -32,13 +36,13 @@ static inline nlink_t user_nlink(struct
return inode->i_nlink;
}
if (res)
return res;
-@@ -111,10 +113,12 @@
+@@ -111,10 +115,12 @@ int vfs_stat(char *name, struct kstat *s
{
struct nameidata nd;
int error;
-+ struct lookup_intent it = { .it_op = IT_GETATTR };
++ struct lookup_intent it = { .it_op = IT_GETATTR };
- error = user_path_walk(name, &nd);
+ error = user_path_walk_it(name, &nd, &it);
if (!error) {
- error = do_getattr(nd.mnt, nd.dentry, stat);
+ error = do_getattr(nd.mnt, nd.dentry, stat, &it);
-+ intent_release(&it);
++ intent_release(&it);
path_release(&nd);
}
return error;
-@@ -124,10 +128,12 @@
+@@ -124,10 +130,12 @@ int vfs_lstat(char *name, struct kstat *
{
struct nameidata nd;
int error;
-+ struct lookup_intent it = { .it_op = IT_GETATTR };
++ struct lookup_intent it = { .it_op = IT_GETATTR };
- error = user_path_walk_link(name, &nd);
+ error = user_path_walk_link_it(name, &nd, &it);
if (!error) {
- error = do_getattr(nd.mnt, nd.dentry, stat);
+ error = do_getattr(nd.mnt, nd.dentry, stat, &it);
-+ intent_release(&it);
++ intent_release(&it);
path_release(&nd);
}
return error;
-@@ -139,7 +145,7 @@
+@@ -139,7 +147,7 @@ int vfs_fstat(unsigned int fd, struct ks
int error = -EBADF;
if (f) {
fput(f);
}
return error;
-@@ -286,7 +292,7 @@
+@@ -286,7 +294,7 @@ asmlinkage long sys_readlink(const char
error = -EINVAL;
if (inode->i_op && inode->i_op->readlink &&
UPDATE_ATIME(inode);
error = inode->i_op->readlink(nd.dentry, buf, bufsiz);
}
-Index: linux-2.4.20-rh/include/linux/dcache.h
-===================================================================
---- linux-2.4.20-rh.orig/include/linux/dcache.h 2003-08-08 13:50:29.000000000 +0800
-+++ linux-2.4.20-rh/include/linux/dcache.h 2003-08-08 17:12:59.000000000 +0800
-@@ -6,6 +6,52 @@
+--- linux-2.4.20-rh-20.9/include/linux/dcache.h~vfs_intent-2.4.20-rh 2003-09-13 19:34:28.000000000 +0400
++++ linux-2.4.20-rh-20.9-alexey/include/linux/dcache.h 2003-09-14 17:34:53.000000000 +0400
+@@ -6,6 +6,51 @@
#include <asm/atomic.h>
#include <linux/mount.h>
#include <linux/kernel.h>
+
+
+struct lustre_intent_data {
-+ int it_disposition;
-+ int it_status;
-+ __u64 it_lock_handle;
-+ void *it_data;
-+ int it_lock_mode;
++ int it_disposition;
++ int it_status;
++ __u64 it_lock_handle;
++ void *it_data;
++ int it_lock_mode;
+ int it_int_flags;
+};
+struct lookup_intent {
-+ int it_magic;
-+ void (*it_op_release)(struct lookup_intent *);
-+ int it_op;
++ int it_magic;
++ void (*it_op_release)(struct lookup_intent *);
++ int it_op;
+ int it_flags;
+ int it_create_mode;
-+ union {
-+ struct lustre_intent_data lustre;
-+ } d;
++ union {
++ struct lustre_intent_data lustre;
++ } d;
+};
+
-+
+static inline void intent_init(struct lookup_intent *it, int op, int flags)
+{
+ memset(it, 0, sizeof(*it));
/*
* linux/include/linux/dcache.h
-@@ -96,8 +142,22 @@
+@@ -96,8 +141,22 @@ 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
* directory of the entries to be compared. It is used in case these
* functions need any directory specific information for determining
-@@ -129,6 +189,7 @@
+@@ -129,6 +188,7 @@ d_iput: no no yes
* s_nfsd_free_path semaphore will be down
*/
#define DCACHE_REFERENCED 0x0008 /* Recently used, don't discard. */
extern spinlock_t dcache_lock;
-Index: linux-2.4.20-rh/include/linux/fs.h
-===================================================================
---- linux-2.4.20-rh.orig/include/linux/fs.h 2003-08-08 16:55:31.000000000 +0800
-+++ linux-2.4.20-rh/include/linux/fs.h 2003-08-08 17:14:21.000000000 +0800
-@@ -73,6 +73,7 @@
+--- linux-2.4.20-rh-20.9/include/linux/fs.h~vfs_intent-2.4.20-rh 2003-09-14 17:34:50.000000000 +0400
++++ linux-2.4.20-rh-20.9-alexey/include/linux/fs.h 2003-09-14 17:34:53.000000000 +0400
+@@ -73,6 +73,7 @@ extern int leases_enable, dir_notify_ena
#define FMODE_READ 1
#define FMODE_WRITE 2
#define READ 0
#define WRITE 1
-@@ -338,6 +339,9 @@
+@@ -338,6 +339,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
-@@ -575,6 +579,7 @@
+@@ -473,6 +477,7 @@ struct inode {
+ struct pipe_inode_info *i_pipe;
+ struct block_device *i_bdev;
+ struct char_device *i_cdev;
++ void *i_filterdata;
+
+ unsigned long i_dnotify_mask; /* Directory notify events */
+ struct dnotify_struct *i_dnotify; /* for directory notifications */
+@@ -575,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;
-@@ -702,6 +707,7 @@
+@@ -702,6 +708,7 @@ struct nameidata {
struct qstr last;
unsigned int flags;
int last_type;
};
/*
-@@ -822,7 +828,8 @@
+@@ -822,7 +829,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
-@@ -882,21 +889,32 @@
+@@ -882,21 +890,32 @@ struct file_operations {
struct inode_operations {
int (*create) (struct inode *,struct dentry *,int);
int (*revalidate) (struct dentry *);
+ int (*revalidate_it) (struct dentry *, struct lookup_intent *);
int (*setattr) (struct dentry *, struct iattr *);
-+ int (*setattr_raw) (struct inode *, struct iattr *);
++ int (*setattr_raw) (struct inode *, struct iattr *);
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);
-@@ -1092,10 +1110,14 @@
+@@ -1092,10 +1111,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 *);
-@@ -1386,6 +1408,7 @@
+@@ -1386,6 +1409,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 *));
-@@ -1397,6 +1420,8 @@
+@@ -1397,6 +1421,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 *);
-@@ -1504,6 +1529,8 @@
+@@ -1504,6 +1530,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_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.20-rh/kernel/ksyms.c
-===================================================================
---- linux-2.4.20-rh.orig/kernel/ksyms.c 2003-08-08 16:55:33.000000000 +0800
-+++ linux-2.4.20-rh/kernel/ksyms.c 2003-08-08 17:13:00.000000000 +0800
-@@ -298,6 +298,7 @@
+--- linux-2.4.20-rh-20.9/include/linux/fs_struct.h~vfs_intent-2.4.20-rh 2003-09-13 19:34:19.000000000 +0400
++++ linux-2.4.20-rh-20.9-alexey/include/linux/fs_struct.h 2003-09-14 17:34:53.000000000 +0400
+@@ -37,10 +37,12 @@ static inline void set_fs_root(struct fs
+ write_lock(&fs->lock);
+ old_root = fs->root;
+ old_rootmnt = fs->rootmnt;
++ PIN(dentry, mnt, 1);
+ fs->rootmnt = mntget(mnt);
+ fs->root = dget(dentry);
+ write_unlock(&fs->lock);
+ if (old_root) {
++ UNPIN(old_root, old_rootmnt, 1);
+ dput(old_root);
+ mntput(old_rootmnt);
+ }
+@@ -60,10 +62,12 @@ static inline void set_fs_pwd(struct fs_
+ write_lock(&fs->lock);
+ old_pwd = fs->pwd;
+ old_pwdmnt = fs->pwdmnt;
++ PIN(dentry, mnt, 0);
+ fs->pwdmnt = mntget(mnt);
+ fs->pwd = dget(dentry);
+ write_unlock(&fs->lock);
+ if (old_pwd) {
++ UNPIN(old_pwd, old_pwdmnt, 0);
+ dput(old_pwd);
+ mntput(old_pwdmnt);
+ }
+--- linux-2.4.20-rh-20.9/kernel/ksyms.c~vfs_intent-2.4.20-rh 2003-09-14 17:34:51.000000000 +0400
++++ linux-2.4.20-rh-20.9-alexey/kernel/ksyms.c 2003-09-14 17:34:53.000000000 +0400
+@@ -298,6 +298,7 @@ EXPORT_SYMBOL(read_cache_page);
EXPORT_SYMBOL(set_page_dirty);
EXPORT_SYMBOL(vfs_readlink);
EXPORT_SYMBOL(vfs_follow_link);
EXPORT_SYMBOL(page_readlink);
EXPORT_SYMBOL(page_follow_link);
EXPORT_SYMBOL(page_symlink_inode_operations);
-Index: linux-2.4.20-rh/fs/exec.c
-===================================================================
---- linux-2.4.20-rh.orig/fs/exec.c 2003-08-08 13:50:29.000000000 +0800
-+++ linux-2.4.20-rh/fs/exec.c 2003-08-08 17:13:00.000000000 +0800
-@@ -114,8 +114,9 @@
- struct file * file;
- struct nameidata nd;
- int error;
--
-- 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;
-
-@@ -127,7 +128,8 @@
- if (error)
- goto exit;
-
-- file = dentry_open(nd.dentry, nd.mnt, O_RDONLY);
-+ file = dentry_open_it(nd.dentry, nd.mnt, O_RDONLY, &it);
-+ intent_release(&it);
- error = PTR_ERR(file);
- if (IS_ERR(file))
- goto out;
-@@ -382,8 +384,9 @@
- struct inode *inode;
- struct file *file;
- int err = 0;
--
-- 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;
-@@ -395,7 +398,8 @@
- err = -EACCES;
- file = ERR_PTR(err);
- if (!err) {
-- file = dentry_open(nd.dentry, nd.mnt, O_RDONLY);
-+ file = dentry_open_it(nd.dentry, nd.mnt, O_RDONLY, &it);
-+ intent_release(&it);
- if (!IS_ERR(file)) {
- err = deny_write_access(file);
- if (err) {
-@@ -407,6 +411,7 @@
- return file;
- }
+--- linux-2.4.20-rh-20.9/kernel/fork.c~vfs_intent-2.4.20-rh 2003-09-13 19:34:35.000000000 +0400
++++ linux-2.4.20-rh-20.9-alexey/kernel/fork.c 2003-09-14 17:34:53.000000000 +0400
+@@ -440,10 +440,13 @@ static inline struct fs_struct *__copy_f
+ fs->umask = old->umask;
+ read_lock(&old->lock);
+ fs->rootmnt = mntget(old->rootmnt);
++ PIN(old->pwd, old->pwdmnt, 0);
++ PIN(old->root, old->rootmnt, 1);
+ fs->root = dget(old->root);
+ fs->pwdmnt = mntget(old->pwdmnt);
+ fs->pwd = dget(old->pwd);
+ if (old->altroot) {
++ PIN(old->altroot, old->altrootmnt, 1);
+ fs->altrootmnt = mntget(old->altrootmnt);
+ fs->altroot = dget(old->altroot);
+ } else {
+--- linux-2.4.20-rh-20.9/kernel/exit.c~vfs_intent-2.4.20-rh 2003-09-13 19:34:35.000000000 +0400
++++ linux-2.4.20-rh-20.9-alexey/kernel/exit.c 2003-09-14 17:34:53.000000000 +0400
+@@ -345,11 +345,14 @@ static inline void __put_fs_struct(struc
+ {
+ /* No need to hold fs->lock if we are killing it */
+ if (atomic_dec_and_test(&fs->count)) {
++ UNPIN(fs->pwd, fs->pwdmnt, 0);
++ UNPIN(fs->root, fs->rootmnt, 1);
+ dput(fs->root);
+ mntput(fs->rootmnt);
+ dput(fs->pwd);
+ mntput(fs->pwdmnt);
+ if (fs->altroot) {
++ UNPIN(fs->altroot, fs->altrootmnt, 1);
+ dput(fs->altroot);
+ mntput(fs->altrootmnt);
}
-+ intent_release(&it);
- path_release(&nd);
- }
- goto out;
-@@ -1296,7 +1301,7 @@
- goto close_fail;
- if (!file->f_op->write)
- goto close_fail;
-- if (do_truncate(file->f_dentry, 0) != 0)
-+ if (do_truncate(file->f_dentry, 0, 0) != 0)
- goto close_fail;
-
- retval = binfmt->core_dump(signr, regs, file);
-Index: linux-2.4.20-rh/fs/proc/base.c
-===================================================================
---- linux-2.4.20-rh.orig/fs/proc/base.c 2003-08-08 13:50:29.000000000 +0800
-+++ linux-2.4.20-rh/fs/proc/base.c 2003-08-08 17:13:00.000000000 +0800
-@@ -494,6 +494,9 @@
-
- error = inode->u.proc_i.op.proc_get_link(inode, &nd->dentry, &nd->mnt);
- nd->last_type = LAST_BIND;
-+
-+ if (nd->intent != NULL)
-+ nd->intent->d.lustre.it_int_flags |= IT_FL_FOLLOWED;
- out:
- return error;
- }
+
+_
- fs/dcache.c | 19 ++-
- fs/exec.c | 15 +-
- fs/namei.c | 289 ++++++++++++++++++++++++++++++++++++++--------
+ fs/dcache.c | 19 ++
+ fs/exec.c | 17 +-
+ fs/namei.c | 295 +++++++++++++++++++++++++++++++++++++++-------
fs/namespace.c | 28 +++-
- fs/open.c | 123 ++++++++++++++++---
- fs/stat.c | 50 +++++--
- include/linux/dcache.h | 59 +++++++++
- include/linux/fs.h | 30 ++++
+ fs/open.c | 172 +++++++++++++++++++-------
+ fs/stat.c | 52 +++++---
+ include/linux/dcache.h | 60 +++++++++
+ include/linux/fs.h | 32 ++++
include/linux/fs_struct.h | 4
kernel/exit.c | 3
kernel/fork.c | 3
kernel/ksyms.c | 1
- 12 files changed, 527 insertions(+), 97 deletions(-)
+ 12 files changed, 558 insertions(+), 128 deletions(-)
-Index: lum/fs/exec.c
-===================================================================
---- lum.orig/fs/exec.c 2003-08-07 05:11:15.000000000 -0600
-+++ lum/fs/exec.c 2003-08-30 07:20:56.000000000 -0600
+--- linux-2.4.20-vanilla/fs/exec.c~vfs_intent-2.4.20-vanilla 2003-05-16 05:29:12.000000000 +0400
++++ linux-2.4.20-vanilla-alexey/fs/exec.c 2003-09-17 21:05:04.000000000 +0400
@@ -107,8 +107,10 @@ asmlinkage long sys_uselib(const char *
struct file * file;
struct nameidata nd;
int error;
-+ struct lookup_intent it = { .it_op = IT_OPEN,
++ struct lookup_intent it = { .it_op = IT_OPEN,
+ .it_flags = FMODE_READ|FMODE_EXEC };
- error = user_path_walk(library, &nd);
struct inode *inode;
struct file *file;
int err = 0;
-+ struct lookup_intent it = { .it_op = IT_OPEN,
-+ .it_flags = FMODE_EXEC|FMODE_READ };
++ 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);
goto close_fail;
retval = binfmt->core_dump(signr, regs, file);
-Index: lum/fs/dcache.c
-===================================================================
---- lum.orig/fs/dcache.c 2003-08-07 05:11:15.000000000 -0600
-+++ lum/fs/dcache.c 2003-08-30 07:20:56.000000000 -0600
+--- linux-2.4.20-vanilla/fs/dcache.c~vfs_intent-2.4.20-vanilla 2003-05-16 05:29:12.000000000 +0400
++++ linux-2.4.20-vanilla-alexey/fs/dcache.c 2003-09-17 21:05:04.000000000 +0400
@@ -181,6 +181,13 @@ int d_invalidate(struct dentry * dentry)
spin_unlock(&dcache_lock);
return 0;
}
#define do_switch(x,y) do { \
-Index: lum/fs/namespace.c
-===================================================================
---- lum.orig/fs/namespace.c 2003-08-07 05:11:15.000000000 -0600
-+++ lum/fs/namespace.c 2003-08-30 07:20:56.000000000 -0600
+--- linux-2.4.20-vanilla/fs/namespace.c~vfs_intent-2.4.20-vanilla 2003-05-16 05:29:12.000000000 +0400
++++ linux-2.4.20-vanilla-alexey/fs/namespace.c 2003-09-17 21:05:04.000000000 +0400
@@ -99,6 +99,7 @@ static void detach_mnt(struct vfsmount *
{
old_nd->dentry = mnt->mnt_mountpoint;
path_release(&new_nd);
out0:
unlock_kernel();
-Index: lum/fs/namei.c
-===================================================================
---- lum.orig/fs/namei.c 2003-08-07 05:11:15.000000000 -0600
-+++ lum/fs/namei.c 2003-08-30 07:21:03.000000000 -0600
+--- linux-2.4.20-vanilla/fs/namei.c~vfs_intent-2.4.20-vanilla 2003-05-16 05:29:12.000000000 +0400
++++ linux-2.4.20-vanilla-alexey/fs/namei.c 2003-09-17 21:05:04.000000000 +0400
@@ -94,6 +94,13 @@
* XEmacs seems to be relying on it...
*/
{
struct dentry * result;
struct inode *dir = parent->d_inode;
-+ int counter = 0;
++ int counter = 0;
+again:
-+ counter++;
++ counter++;
down(&dir->i_sem);
/*
* First re-do the cached lookup just in case it was created
+ if (!result->d_op->d_revalidate_it(result, flags, it) &&
+ !d_invalidate(result)) {
+ dput(result);
-+ if (counter > 10)
-+ result = ERR_PTR(-ESTALE);
-+ if (!IS_ERR(result))
-+ goto again;
++ if (counter > 10)
++ result = ERR_PTR(-ESTALE);
++ if (!IS_ERR(result))
++ goto again;
+ }
}
return result;
break;
}
goto return_base;
-@@ -633,6 +670,21 @@ return_reval:
+@@ -633,6 +670,25 @@ return_reval:
* Check the cached dentry for staleness.
*/
dentry = nd->dentry;
+ &dentry->d_name, 0, NULL);
+ d_invalidate(dentry);
+ dput(dentry);
-+ dentry = new;
++ if (IS_ERR(new)) {
++ err = PTR_ERR(new);
++ break;
++ }
++ nd->dentry = new;
+ }
+ } else
if (dentry && dentry->d_op && dentry->d_op->d_revalidate) {
err = -ESTALE;
if (!dentry->d_op->d_revalidate(dentry, 0)) {
-@@ -646,15 +698,28 @@ out_dput:
+@@ -646,15 +702,28 @@ out_dput:
dput(dentry);
break;
}
}
/* SMP-safe */
-@@ -739,6 +804,17 @@ walk_init_root(const char *name, struct
+@@ -739,6 +808,17 @@ walk_init_root(const char *name, struct
}
/* SMP-safe */
int path_lookup(const char *path, unsigned flags, struct nameidata *nd)
{
int error = 0;
-@@ -753,6 +829,7 @@ int path_init(const char *name, unsigned
+@@ -753,6 +833,7 @@ int path_init(const char *name, unsigned
{
nd->last_type = LAST_ROOT; /* if there are only slashes... */
nd->flags = flags;
if (*name=='/')
return walk_init_root(name,nd);
read_lock(¤t->fs->lock);
-@@ -767,7 +844,8 @@ int path_init(const char *name, unsigned
+@@ -767,7 +848,8 @@ int path_init(const char *name, unsigned
* needs parent already locked. Doesn't follow mounts.
* SMP-safe.
*/
{
struct dentry * dentry;
struct inode *inode;
-@@ -790,13 +868,16 @@ struct dentry * lookup_hash(struct qstr
+@@ -790,13 +872,16 @@ struct dentry * lookup_hash(struct qstr
goto out;
}
dentry = inode->i_op->lookup(inode, new);
unlock_kernel();
if (!dentry)
-@@ -808,6 +889,12 @@ out:
+@@ -808,6 +893,12 @@ out:
return dentry;
}
/* SMP-safe */
struct dentry * lookup_one_len(const char * name, struct dentry * base, int len)
{
-@@ -829,7 +916,7 @@ struct dentry * lookup_one_len(const cha
+@@ -829,7 +920,7 @@ struct dentry * lookup_one_len(const cha
}
this.hash = end_name_hash(hash);
access:
return ERR_PTR(-EACCES);
}
-@@ -860,6 +947,23 @@ int __user_walk(const char *name, unsign
+@@ -860,6 +951,23 @@ int __user_walk(const char *name, unsign
return err;
}
/*
* It's inline, so penalty for filesystems that don't use sticky bit is
* minimal.
-@@ -955,7 +1059,8 @@ static inline int lookup_flags(unsigned
+@@ -955,7 +1063,8 @@ static inline int lookup_flags(unsigned
return retval;
}
{
int error;
-@@ -968,12 +1073,15 @@ int vfs_create(struct inode *dir, struct
+@@ -968,12 +1077,15 @@ int vfs_create(struct inode *dir, struct
goto exit_lock;
error = -EACCES; /* shouldn't it be ENOSYS? */
unlock_kernel();
exit_lock:
up(&dir->i_zombie);
-@@ -982,6 +1090,11 @@ exit_lock:
+@@ -982,6 +1094,11 @@ exit_lock:
return error;
}
/*
* open_namei()
*
-@@ -996,7 +1109,8 @@ exit_lock:
+@@ -996,7 +1113,8 @@ exit_lock:
* for symlinks (where the permissions are checked later).
* SMP-safe
*/
{
int acc_mode, error = 0;
struct inode *inode;
-@@ -1006,11 +1120,14 @@ int open_namei(const char * pathname, in
+@@ -1006,11 +1124,14 @@ int open_namei(const char * pathname, in
acc_mode = ACC_MODE(flag);
-+ if (it)
-+ it->it_flags = flag;
++ if (it)
++ it->it_flags = flag;
+
/*
* The simplest case - just a plain lookup.
if (error)
return error;
dentry = nd->dentry;
-@@ -1020,6 +1137,10 @@ int open_namei(const char * pathname, in
+@@ -1020,6 +1141,10 @@ int open_namei(const char * pathname, in
/*
* Create - we need to know the parent.
*/
-+ if (it) {
-+ it->it_create_mode = mode;
-+ it->it_op |= IT_CREAT;
-+ }
++ if (it) {
++ it->it_create_mode = mode;
++ it->it_op |= IT_CREAT;
++ }
error = path_lookup(pathname, LOOKUP_PARENT, nd);
if (error)
return error;
-@@ -1035,7 +1156,7 @@ int open_namei(const char * pathname, in
+@@ -1035,7 +1160,7 @@ int open_namei(const char * pathname, in
dir = nd->dentry;
down(&dir->d_inode->i_sem);
do_last:
error = PTR_ERR(dentry);
-@@ -1044,10 +1165,11 @@ do_last:
+@@ -1044,10 +1169,11 @@ do_last:
goto exit;
}
up(&dir->d_inode->i_sem);
dput(nd->dentry);
nd->dentry = dentry;
-@@ -1151,7 +1273,7 @@ ok:
+@@ -1151,7 +1277,7 @@ ok:
if (!error) {
DQUOT_INIT(inode);
}
put_write_access(inode);
if (error)
-@@ -1163,8 +1285,10 @@ ok:
+@@ -1163,8 +1289,10 @@ ok:
return 0;
exit_dput:
path_release(nd);
return error;
-@@ -1183,7 +1307,10 @@ do_link:
+@@ -1183,7 +1311,10 @@ do_link:
* are done. Procfs-like symlinks just set LAST_BIND.
*/
UPDATE_ATIME(dentry->d_inode);
dput(dentry);
if (error)
return error;
-@@ -1205,13 +1332,20 @@ do_link:
+@@ -1205,13 +1336,20 @@ do_link:
}
dir = nd->dentry;
down(&dir->d_inode->i_sem);
{
struct dentry *dentry;
-@@ -1219,7 +1353,7 @@ static struct dentry *lookup_create(stru
+@@ -1219,7 +1357,7 @@ static struct dentry *lookup_create(stru
dentry = ERR_PTR(-EEXIST);
if (nd->last_type != LAST_NORM)
goto fail;
if (IS_ERR(dentry))
goto fail;
if (!is_dir && nd->last.name[nd->last.len] && !dentry->d_inode)
-@@ -1275,7 +1409,16 @@ asmlinkage long sys_mknod(const char * f
+@@ -1275,7 +1413,16 @@ asmlinkage long sys_mknod(const char * f
error = path_lookup(tmp, LOOKUP_PARENT, &nd);
if (error)
goto out;
error = PTR_ERR(dentry);
mode &= ~current->fs->umask;
-@@ -1296,6 +1439,7 @@ asmlinkage long sys_mknod(const char * f
+@@ -1296,6 +1443,7 @@ asmlinkage long sys_mknod(const char * f
dput(dentry);
}
up(&nd.dentry->d_inode->i_sem);
path_release(&nd);
out:
putname(tmp);
-@@ -1343,7 +1487,14 @@ asmlinkage long sys_mkdir(const char * p
+@@ -1343,7 +1491,14 @@ asmlinkage long sys_mkdir(const char * p
error = path_lookup(tmp, LOOKUP_PARENT, &nd);
if (error)
goto out;
- dentry = lookup_create(&nd, 1);
-+ 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;
-+ }
++ 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, NULL);
error = PTR_ERR(dentry);
if (!IS_ERR(dentry)) {
error = vfs_mkdir(nd.dentry->d_inode, dentry,
-@@ -1351,6 +1502,7 @@ asmlinkage long sys_mkdir(const char * p
+@@ -1351,6 +1506,7 @@ asmlinkage long sys_mkdir(const char * p
dput(dentry);
}
up(&nd.dentry->d_inode->i_sem);
path_release(&nd);
out:
putname(tmp);
-@@ -1451,8 +1603,16 @@ asmlinkage long sys_rmdir(const char * p
+@@ -1451,8 +1607,16 @@ asmlinkage long sys_rmdir(const char * p
error = -EBUSY;
goto exit1;
}
-+ if (nd.dentry->d_inode->i_op->rmdir_raw) {
-+ struct inode_operations *op = nd.dentry->d_inode->i_op;
++ 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;
-+ }
++ error = op->rmdir_raw(&nd);
++ /* the file system wants to use normal vfs path now */
++ if (error != -EOPNOTSUPP)
++ goto exit1;
++ }
down(&nd.dentry->d_inode->i_sem);
- dentry = lookup_hash(&nd.last, nd.dentry);
+ dentry = lookup_hash_it(&nd.last, nd.dentry, NULL);
error = PTR_ERR(dentry);
if (!IS_ERR(dentry)) {
error = vfs_rmdir(nd.dentry->d_inode, dentry);
-@@ -1510,8 +1670,15 @@ asmlinkage long sys_unlink(const char *
+@@ -1510,8 +1674,15 @@ asmlinkage long sys_unlink(const char *
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;
-+ }
++ 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;
++ }
down(&nd.dentry->d_inode->i_sem);
- dentry = lookup_hash(&nd.last, nd.dentry);
+ dentry = lookup_hash_it(&nd.last, nd.dentry, NULL);
error = PTR_ERR(dentry);
if (!IS_ERR(dentry)) {
/* Why not before? Because we want correct error value */
-@@ -1578,15 +1745,23 @@ asmlinkage long sys_symlink(const char *
+@@ -1578,15 +1749,23 @@ asmlinkage long sys_symlink(const char *
error = path_lookup(to, LOOKUP_PARENT, &nd);
if (error)
goto out;
putname(to);
}
putname(from);
-@@ -1662,7 +1837,14 @@ asmlinkage long sys_link(const char * ol
+@@ -1662,7 +1841,14 @@ asmlinkage long sys_link(const char * ol
error = -EXDEV;
if (old_nd.mnt != nd.mnt)
goto out_release;
error = PTR_ERR(new_dentry);
if (!IS_ERR(new_dentry)) {
error = vfs_link(old_nd.dentry, nd.dentry->d_inode, new_dentry);
-@@ -1706,7 +1888,7 @@ exit:
+@@ -1706,7 +1892,7 @@ exit:
* locking].
*/
int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry,
{
int error;
struct inode *target;
-@@ -1785,7 +1967,7 @@ out_unlock:
+@@ -1785,7 +1971,7 @@ out_unlock:
}
int vfs_rename_other(struct inode *old_dir, struct dentry *old_dentry,
{
int error;
-@@ -1873,9 +2055,18 @@ static inline int do_rename(const char *
+@@ -1873,9 +2059,18 @@ static inline int do_rename(const char *
if (newnd.last_type != LAST_NORM)
goto exit2;
-+ if (old_dir->d_inode->i_op->rename_raw) {
++ if (old_dir->d_inode->i_op->rename_raw) {
+ lock_kernel();
-+ error = old_dir->d_inode->i_op->rename_raw(&oldnd, &newnd);
++ error = old_dir->d_inode->i_op->rename_raw(&oldnd, &newnd);
+ unlock_kernel();
-+ /* the file system wants to use normal vfs path now */
-+ if (error != -EOPNOTSUPP)
-+ goto exit2;
-+ }
++ /* the file system wants to use normal vfs path now */
++ if (error != -EOPNOTSUPP)
++ goto exit2;
++ }
+
double_lock(new_dir, old_dir);
error = PTR_ERR(old_dentry);
if (IS_ERR(old_dentry))
goto exit3;
-@@ -1891,16 +2082,16 @@ static inline int do_rename(const char *
+@@ -1891,16 +2086,16 @@ static inline int do_rename(const char *
if (newnd.last.name[newnd.last.len])
goto exit4;
}
dput(new_dentry);
exit4:
dput(old_dentry);
-@@ -1951,20 +2142,26 @@ out:
+@@ -1951,20 +2146,26 @@ out:
}
static inline int
+ if (it == NULL)
+ it = nd->intent;
+ else if (it != nd->intent)
-+ printk("it != nd->it: tell phil@clusterfs.com\n");
++ printk("it != nd->intent: tell phil@clusterfs.com\n");
+
if (*link == '/') {
path_release(nd);
out:
if (current->link_count || res || nd->last_type!=LAST_NORM)
return res;
-@@ -1986,7 +2183,13 @@ fail:
+@@ -1986,7 +2187,13 @@ fail:
int vfs_follow_link(struct nameidata *nd, const char *link)
{
}
/* get the link contents into pagecache */
-@@ -2028,7 +2231,7 @@ int page_follow_link(struct dentry *dent
+@@ -2028,7 +2235,7 @@ int page_follow_link(struct dentry *dent
{
struct page *page = NULL;
char *s = page_getlink(dentry, &page);
if (page) {
kunmap(page);
page_cache_release(page);
-Index: lum/fs/open.c
-===================================================================
---- lum.orig/fs/open.c 2003-08-07 05:11:15.000000000 -0600
-+++ lum/fs/open.c 2003-08-30 07:20:56.000000000 -0600
+--- linux-2.4.20-vanilla/fs/open.c~vfs_intent-2.4.20-vanilla 2003-05-16 05:29:13.000000000 +0400
++++ linux-2.4.20-vanilla-alexey/fs/open.c 2003-09-17 21:05:04.000000000 +0400
@@ -19,6 +19,8 @@
#include <asm/uaccess.h>
{
int error;
struct nameidata nd;
-+ struct lookup_intent it = { .it_op = IT_GETATTR };
++ struct lookup_intent it = { .it_op = IT_GETATTR };
- error = __user_walk(filename,LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY,&nd);
+ error = __user_walk_it(filename,LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY,&nd, &it);
{
int error;
struct nameidata nd;
-+ struct lookup_intent it = { .it_op = IT_GETATTR };
++ struct lookup_intent it = { .it_op = IT_GETATTR };
- error = __user_walk(filename, LOOKUP_POSITIVE | LOOKUP_FOLLOW |
- LOOKUP_DIRECTORY | LOOKUP_NOALT, &nd);
- error = -EROFS;
- if (IS_RDONLY(inode))
- goto dput_and_out;
--
+
- error = -EPERM;
- if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
- goto dput_and_out;
++ error = chmod_common(nd.dentry, mode);
- 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:
error = -EPERM;
if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
goto out;
-@@ -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.
- */
-+
- struct file *filp_open(const char * filename, int flags, int mode)
+@@ -642,6 +705,7 @@ struct file *filp_open(const char * file
{
int namei_flags, error;
struct nameidata nd;
-+ struct lookup_intent it = { .it_op = IT_OPEN};
++ struct lookup_intent it = { .it_op = IT_OPEN };
namei_flags = flags;
if ((namei_flags+1) & O_ACCMODE)
-@@ -649,14 +714,15 @@ struct file *filp_open(const char * file
+@@ -649,14 +713,15 @@ struct file *filp_open(const char * file
if (namei_flags & O_TRUNC)
namei_flags |= 2;
{
struct file * f;
struct inode *inode;
-@@ -693,12 +759,15 @@ struct file *dentry_open(struct dentry *
+@@ -693,12 +758,15 @@ struct file *dentry_open(struct dentry *
}
if (f->f_op && f->f_op->open) {
return f;
cleanup_all:
-@@ -713,11 +782,17 @@ cleanup_all:
+@@ -713,11 +781,17 @@ cleanup_all:
cleanup_file:
put_filp(f);
cleanup_dentry:
/*
* Find an empty file descriptor entry, and mark it busy.
*/
-Index: lum/fs/stat.c
-===================================================================
---- lum.orig/fs/stat.c 2003-08-07 05:11:15.000000000 -0600
-+++ lum/fs/stat.c 2003-08-30 07:20:56.000000000 -0600
-@@ -17,10 +17,12 @@
+--- linux-2.4.20-vanilla/fs/stat.c~vfs_intent-2.4.20-vanilla 2001-09-14 03:04:43.000000000 +0400
++++ linux-2.4.20-vanilla-alexey/fs/stat.c 2003-09-17 21:05:04.000000000 +0400
+@@ -17,10 +17,14 @@
* Revalidate the inode. This is required for proper NFS attribute caching.
*/
static __inline__ int
{
struct inode * inode = dentry->d_inode;
- if (inode->i_op && inode->i_op->revalidate)
++ if (!inode)
++ return -ENOENT;
+ if (inode->i_op && inode->i_op->revalidate_it)
+ return inode->i_op->revalidate_it(dentry, it);
+ else if (inode->i_op && inode->i_op->revalidate)
return inode->i_op->revalidate(dentry);
return 0;
}
-@@ -135,13 +137,15 @@ static int cp_new_stat(struct inode * in
+@@ -135,13 +139,15 @@ static int cp_new_stat(struct inode * in
asmlinkage long sys_stat(char * filename, struct __old_kernel_stat * statbuf)
{
struct nameidata nd;
path_release(&nd);
}
return error;
-@@ -151,13 +155,15 @@ asmlinkage long sys_stat(char * filename
+@@ -151,13 +157,15 @@ asmlinkage long sys_stat(char * filename
asmlinkage long sys_newstat(char * filename, struct stat * statbuf)
{
struct nameidata nd;
path_release(&nd);
}
return error;
-@@ -172,13 +178,15 @@ asmlinkage long sys_newstat(char * filen
+@@ -172,13 +180,15 @@ asmlinkage long sys_newstat(char * filen
asmlinkage long sys_lstat(char * filename, struct __old_kernel_stat * statbuf)
{
struct nameidata nd;
path_release(&nd);
}
return error;
-@@ -189,13 +197,15 @@ asmlinkage long sys_lstat(char * filenam
+@@ -189,13 +199,15 @@ asmlinkage long sys_lstat(char * filenam
asmlinkage long sys_newlstat(char * filename, struct stat * statbuf)
{
struct nameidata nd;
path_release(&nd);
}
return error;
-@@ -216,7 +226,7 @@ asmlinkage long sys_fstat(unsigned int f
+@@ -216,7 +228,7 @@ asmlinkage long sys_fstat(unsigned int f
if (f) {
struct dentry * dentry = f->f_dentry;
if (!err)
err = cp_old_stat(dentry->d_inode, statbuf);
fput(f);
-@@ -235,7 +245,7 @@ asmlinkage long sys_newfstat(unsigned in
+@@ -235,7 +247,7 @@ asmlinkage long sys_newfstat(unsigned in
if (f) {
struct dentry * dentry = f->f_dentry;
if (!err)
err = cp_new_stat(dentry->d_inode, statbuf);
fput(f);
-@@ -257,7 +267,7 @@ asmlinkage long sys_readlink(const char
+@@ -257,7 +269,7 @@ asmlinkage long sys_readlink(const char
error = -EINVAL;
if (inode->i_op && inode->i_op->readlink &&
UPDATE_ATIME(inode);
error = inode->i_op->readlink(nd.dentry, buf, bufsiz);
}
-@@ -333,12 +343,14 @@ asmlinkage long sys_stat64(char * filena
+@@ -333,12 +345,14 @@ asmlinkage long sys_stat64(char * filena
{
struct nameidata nd;
int error;
path_release(&nd);
}
return error;
-@@ -348,12 +360,14 @@ asmlinkage long sys_lstat64(char * filen
+@@ -348,12 +362,14 @@ asmlinkage long sys_lstat64(char * filen
{
struct nameidata nd;
int error;
path_release(&nd);
}
return error;
-@@ -368,7 +382,7 @@ asmlinkage long sys_fstat64(unsigned lon
+@@ -368,7 +384,7 @@ asmlinkage long sys_fstat64(unsigned lon
if (f) {
struct dentry * dentry = f->f_dentry;
if (!err)
err = cp_new_stat64(dentry->d_inode, statbuf);
fput(f);
-Index: lum/include/linux/dcache.h
-===================================================================
---- lum.orig/include/linux/dcache.h 2003-08-07 05:11:15.000000000 -0600
-+++ lum/include/linux/dcache.h 2003-08-30 07:20:56.000000000 -0600
-@@ -7,6 +7,50 @@
+--- linux-2.4.20-vanilla/include/linux/dcache.h~vfs_intent-2.4.20-vanilla 2003-05-16 05:29:15.000000000 +0400
++++ linux-2.4.20-vanilla-alexey/include/linux/dcache.h 2003-09-17 21:05:42.000000000 +0400
+@@ -6,6 +6,51 @@
+ #include <asm/atomic.h>
#include <linux/mount.h>
#include <linux/kernel.h>
-
++#include <linux/string.h>
++
+#define IT_OPEN 0x0001
+#define IT_CREAT 0x0002
+#define IT_READDIR 0x0004
+
+
+struct lustre_intent_data {
-+ int it_disposition;
-+ int it_status;
-+ __u64 it_lock_handle;
-+ void *it_data;
-+ int it_lock_mode;
++ int it_disposition;
++ int it_status;
++ __u64 it_lock_handle;
++ void *it_data;
++ int it_lock_mode;
+ int it_int_flags;
+};
+struct lookup_intent {
-+ int it_magic;
-+ void (*it_op_release)(struct lookup_intent *);
-+ int it_op;
++ int it_magic;
++ void (*it_op_release)(struct lookup_intent *);
++ int it_op;
+ int it_flags;
+ int it_create_mode;
-+ union {
-+ struct lustre_intent_data lustre;
-+ } d;
++ union {
++ struct lustre_intent_data lustre;
++ } d;
+};
-+
++
+static inline void intent_init(struct lookup_intent *it, int op, int flags)
+{
+ memset(it, 0, sizeof(*it));
+ it->it_flags = flags;
+}
+
-+
+
/*
* linux/include/linux/dcache.h
- *
-@@ -91,8 +135,22 @@ struct dentry_operations {
+@@ -91,8 +136,22 @@ 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
* directory of the entries to be compared. It is used in case these
* functions need any directory specific information for determining
-@@ -124,6 +182,7 @@ d_iput: no no yes
+@@ -124,6 +183,7 @@ d_iput: no no yes
* s_nfsd_free_path semaphore will be down
*/
#define DCACHE_REFERENCED 0x0008 /* Recently used, don't discard. */
extern spinlock_t dcache_lock;
-Index: lum/include/linux/fs.h
-===================================================================
---- lum.orig/include/linux/fs.h 2003-08-30 07:20:55.000000000 -0600
-+++ lum/include/linux/fs.h 2003-08-30 07:20:56.000000000 -0600
+--- linux-2.4.20-vanilla/include/linux/fs.h~vfs_intent-2.4.20-vanilla 2003-09-17 21:05:03.000000000 +0400
++++ linux-2.4.20-vanilla-alexey/include/linux/fs.h 2003-09-17 21:05:04.000000000 +0400
@@ -73,6 +73,7 @@ extern int leases_enable, dir_notify_ena
#define FMODE_READ 1
/*
* This is the Inode Attributes structure, used for notify_change(). It
-@@ -542,6 +546,7 @@ struct file {
+@@ -471,6 +475,7 @@ struct inode {
+ struct pipe_inode_info *i_pipe;
+ struct block_device *i_bdev;
+ struct char_device *i_cdev;
++ void *i_filterdata;
+
+ unsigned long i_dnotify_mask; /* Directory notify events */
+ struct dnotify_struct *i_dnotify; /* for directory notifications */
+@@ -542,6 +547,7 @@ struct file {
/* needed for tty driver, and maybe others */
void *private_data;
/* preallocated helper kiobuf to speedup O_DIRECT */
struct kiobuf *f_iobuf;
-@@ -661,6 +666,7 @@ struct nameidata {
+@@ -661,6 +667,7 @@ struct nameidata {
struct qstr last;
unsigned int flags;
int last_type;
};
#define DQUOT_USR_ENABLED 0x01 /* User diskquotas enabled */
-@@ -794,7 +800,8 @@ extern int vfs_symlink(struct inode *, s
+@@ -794,7 +801,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
-@@ -854,21 +861,32 @@ struct file_operations {
+@@ -854,21 +862,32 @@ struct file_operations {
struct inode_operations {
int (*create) (struct inode *,struct dentry *,int);
int (*revalidate) (struct dentry *);
+ int (*revalidate_it) (struct dentry *, struct lookup_intent *);
int (*setattr) (struct dentry *, struct iattr *);
-+ int (*setattr_raw) (struct inode *, struct iattr *);
++ int (*setattr_raw) (struct inode *, struct iattr *);
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);
-@@ -1070,10 +1088,14 @@ static inline int get_lease(struct inode
+@@ -1070,10 +1089,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 *);
-@@ -1335,6 +1357,7 @@ typedef int (*read_actor_t)(read_descrip
+@@ -1335,6 +1358,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 *));
-@@ -1346,6 +1369,8 @@ extern struct dentry * lookup_one_len(co
+@@ -1346,6 +1370,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 iput(struct inode *);
extern void force_delete(struct inode *);
-@@ -1455,6 +1480,8 @@ extern struct file_operations generic_ro
+@@ -1455,6 +1481,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_readlink(struct dentry *, char *, int);
extern int page_follow_link(struct dentry *, struct nameidata *);
extern struct inode_operations page_symlink_inode_operations;
-Index: lum/include/linux/fs_struct.h
-===================================================================
---- lum.orig/include/linux/fs_struct.h 2003-08-07 05:11:15.000000000 -0600
-+++ lum/include/linux/fs_struct.h 2003-08-30 07:20:56.000000000 -0600
+--- linux-2.4.20-vanilla/include/linux/fs_struct.h~vfs_intent-2.4.20-vanilla 2001-07-14 02:10:44.000000000 +0400
++++ linux-2.4.20-vanilla-alexey/include/linux/fs_struct.h 2003-09-17 21:05:04.000000000 +0400
@@ -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);
}
-Index: lum/kernel/ksyms.c
-===================================================================
---- lum.orig/kernel/ksyms.c 2003-08-30 07:20:55.000000000 -0600
-+++ lum/kernel/ksyms.c 2003-08-30 07:20:56.000000000 -0600
+--- linux-2.4.20-vanilla/kernel/ksyms.c~vfs_intent-2.4.20-vanilla 2003-09-17 21:05:03.000000000 +0400
++++ linux-2.4.20-vanilla-alexey/kernel/ksyms.c 2003-09-17 21:05:04.000000000 +0400
@@ -269,6 +269,7 @@ EXPORT_SYMBOL(read_cache_page);
EXPORT_SYMBOL(set_page_dirty);
EXPORT_SYMBOL(vfs_readlink);
EXPORT_SYMBOL(page_readlink);
EXPORT_SYMBOL(page_follow_link);
EXPORT_SYMBOL(page_symlink_inode_operations);
-Index: lum/kernel/fork.c
-===================================================================
---- lum.orig/kernel/fork.c 2003-08-07 05:11:15.000000000 -0600
-+++ lum/kernel/fork.c 2003-08-30 07:20:56.000000000 -0600
+--- linux-2.4.20-vanilla/kernel/fork.c~vfs_intent-2.4.20-vanilla 2003-05-16 05:29:15.000000000 +0400
++++ linux-2.4.20-vanilla-alexey/kernel/fork.c 2003-09-17 21:05:04.000000000 +0400
@@ -384,10 +384,13 @@ static inline struct fs_struct *__copy_f
fs->umask = old->umask;
read_lock(&old->lock);
fs->altrootmnt = mntget(old->altrootmnt);
fs->altroot = dget(old->altroot);
} else {
-Index: lum/kernel/exit.c
-===================================================================
---- lum.orig/kernel/exit.c 2003-08-07 05:11:15.000000000 -0600
-+++ lum/kernel/exit.c 2003-08-30 07:20:56.000000000 -0600
+--- linux-2.4.20-vanilla/kernel/exit.c~vfs_intent-2.4.20-vanilla 2003-05-16 05:29:15.000000000 +0400
++++ linux-2.4.20-vanilla-alexey/kernel/exit.c 2003-09-17 21:05:04.000000000 +0400
@@ -238,11 +238,14 @@ static inline void __put_fs_struct(struc
{
/* No need to hold fs->lock if we are killing it */
dput(fs->altroot);
mntput(fs->altrootmnt);
}
+
+_
fs/ext3/inode.c
fs/ext3/ioctl.c
include/linux/ext3_fs.h
+include/linux/dcache.h
fs/dcache.c
+fs/exec.c
fs/namei.c
-fs/nfsd/vfs.c
+fs/namespace.c
fs/open.c
+fs/proc/base.c
fs/stat.c
include/linux/dcache.h
include/linux/fs.h
+include/linux/fs_struct.h
kernel/ksyms.c
-fs/exec.c
-fs/proc/base.c
+kernel/fork.c
+kernel/exit.c
uml-patch-2.4.20-6.patch
+uml-2.4.20-do_mmap_pgoff-fix.patch
dev_read_only_2.4.20.patch
exports_2.4.20.patch
kmem_cache_validate_2.4.20.patch
if (rc && rc != EALREADY)
GOTO(out, rc);
+ /* XXX track this all the time? */
+ if (target->obd_recovering) {
+ target->obd_connected_clients++;
+ }
+
req->rq_repmsg->handle = conn;
/* If the client and the server are the same node, we will already
int target_handle_disconnect(struct ptlrpc_request *req)
{
- struct obd_export *export;
- struct obd_import *dlmimp;
int rc;
ENTRY;
if (rc)
RETURN(rc);
- /* Create an export reference to disconnect, so the rq_export
- * ref is not destroyed. See class_disconnect() for more info. */
- export = class_export_get(req->rq_export);
- req->rq_status = obd_disconnect(export, 0);
-
- dlmimp = req->rq_export->exp_ldlm_data.led_import;
- class_destroy_import(dlmimp);
-
- class_export_put(req->rq_export);
+ req->rq_status = obd_disconnect(req->rq_export, 0);
req->rq_export = NULL;
RETURN(0);
}
+void target_destroy_export(struct obd_export *exp)
+{
+ /* exports created from last_rcvd data, and "fake"
+ exports created by lctl don't have an import */
+ if (exp->exp_ldlm_data.led_import != NULL)
+ class_destroy_import(exp->exp_ldlm_data.led_import);
+}
+
/*
* Recovery functions
*/
}
obd->obd_recovering = obd->obd_abort_recovery = 0;
- obd->obd_recoverable_clients = 0;
wake_up(&obd->obd_next_transno_waitq);
target_cancel_recovery_timer(obd);
if (!recovering)
return;
- CERROR("timer will expire in %ld seconds\n", OBD_RECOVERY_TIMEOUT / HZ);
+ CERROR("timer will expire in %d seconds\n", OBD_RECOVERY_TIMEOUT / HZ);
mod_timer(&obd->obd_recovery_timer, jiffies + OBD_RECOVERY_TIMEOUT);
}
static int check_for_next_transno(struct obd_device *obd)
{
struct ptlrpc_request *req;
- int wake_up;
-
- /* XXX shouldn't we take obd->obd_processing_task_lock to check these
- flags and the recovery_queue? */
- if (obd->obd_abort_recovery || !obd->obd_recovering)
- return 1;
+ int wake_up = 0, connected, completed, queue_len, max;
+ __u64 next_transno, req_transno;
+ spin_lock_bh(&obd->obd_processing_task_lock);
req = list_entry(obd->obd_recovery_queue.next,
struct ptlrpc_request, rq_list);
- LASSERT(req->rq_reqmsg->transno >= obd->obd_next_recovery_transno);
-
- wake_up = req->rq_reqmsg->transno == obd->obd_next_recovery_transno;
- CDEBUG(D_HA, "check_for_next_transno: "LPD64" vs "LPD64", %d == %d\n",
- req->rq_reqmsg->transno, obd->obd_next_recovery_transno,
- obd->obd_recovering, wake_up);
+ max = obd->obd_max_recoverable_clients;
+ req_transno = req->rq_reqmsg->transno;
+ connected = obd->obd_connected_clients;
+ completed = max - obd->obd_recoverable_clients;
+ queue_len = obd->obd_requests_queued_for_recovery;
+ next_transno = obd->obd_next_recovery_transno;
+
+ if (obd->obd_abort_recovery) {
+ CDEBUG(D_HA, "waking for aborted recovery\n");
+ wake_up = 1;
+ } else if (!obd->obd_recovering) {
+ CDEBUG(D_HA, "waking for completed recovery (?)\n");
+ wake_up = 1;
+ } else if (req_transno == next_transno) {
+ CDEBUG(D_HA, "waking for next ("LPD64")\n", next_transno);
+ wake_up = 1;
+ } else if (queue_len + completed == max) {
+ CDEBUG(D_ERROR,
+ "waking for skipped transno (skip: "LPD64
+ ", ql: %d, comp: %d, conn: %d, next: "LPD64")\n",
+ next_transno, queue_len, completed, max, req_transno);
+ obd->obd_next_recovery_transno = req_transno;
+ wake_up = 1;
+ }
+ spin_unlock_bh(&obd->obd_processing_task_lock);
+ LASSERT(req->rq_reqmsg->transno >= next_transno);
return wake_up;
}
continue;
}
list_del_init(&req->rq_list);
+ obd->obd_requests_queued_for_recovery--;
spin_unlock_bh(&obd->obd_processing_task_lock);
- DEBUG_REQ(D_ERROR, req, "processing: ");
+ DEBUG_REQ(D_HA, req, "processing: ");
(void)obd->obd_recovery_handler(req);
+ obd->obd_replayed_requests++;
reset_recovery_timer(obd);
/* bug 1580: decide how to properly sync() in recovery */
//mds_fsync_super(mds->mds_sb);
list_add_tail(&req->rq_list, &obd->obd_recovery_queue);
}
+ obd->obd_requests_queued_for_recovery++;
+
if (obd->obd_processing_task != 0) {
/* Someone else is processing this queue, we'll leave it to
* them.
*/
- if (transno == obd->obd_next_recovery_transno)
- wake_up(&obd->obd_next_transno_waitq);
+ wake_up(&obd->obd_next_transno_waitq);
spin_unlock_bh(&obd->obd_processing_task_lock);
return 0;
}
} else {
CERROR("%s: %d recoverable clients remain\n",
obd->obd_name, obd->obd_recoverable_clients);
+ wake_up(&obd->obd_next_transno_waitq);
}
return 1;
void mdc_pack_req_body(struct ptlrpc_request *);
void mdc_pack_rep_body(struct ptlrpc_request *);
void mdc_readdir_pack(struct ptlrpc_request *req, __u64 offset, __u32 size,
- obd_id ino, int type);
+ struct ll_fid *mdc_fid);
void mdc_getattr_pack(struct ptlrpc_request *req, int valid, int offset,
int flags, struct mdc_op_data *data);
void mdc_setattr_pack(struct ptlrpc_request *req,
#include "mdc_internal.h"
void mdc_readdir_pack(struct ptlrpc_request *req, __u64 offset, __u32 size,
- obd_id ino, int type)
+ struct ll_fid *mdc_fid)
{
struct mds_body *b;
b->fsuid = current->fsuid;
b->fsgid = current->fsgid;
b->capability = current->cap_effective;
- b->fid1.id = ino;
- b->fid1.f_type = type;
+ b->fid1 = *mdc_fid;
b->size = offset; /* !! */
b->suppgid = -1;
b->nlink = size; /* !! */
void mdc_open_pack(struct ptlrpc_request *req, int offset,
struct mdc_op_data *op_data,
__u32 mode, __u64 rdev, __u64 time,
- __u32 flags, const void *data, int datalen)
+ __u32 flags, const void *lmm, int lmmlen)
{
struct mds_rec_create *rec;
char *tmp;
LOGL0(op_data->name, op_data->namelen, tmp);
}
- if (data) {
- tmp = lustre_msg_buf(req->rq_reqmsg, offset + 2, datalen);
- memcpy (tmp, data, datalen);
+ if (lmm) {
+ rec->cr_flags |= MDS_OPEN_HAS_EA;
+ tmp = lustre_msg_buf(req->rq_reqmsg, offset + 2, lmmlen);
+ memcpy (tmp, lmm, lmmlen);
}
}
else if ((iattr->ia_valid & ATTR_MODE) &&
in_group_p(iattr->ia_gid))
rec->sa_suppgid = data->ctxt.gid1;
+ else if ((iattr->ia_valid & (ATTR_MTIME|ATTR_CTIME)) &&
+ data->ctxt.gid1 != -1)
+ rec->sa_suppgid = data->ctxt.gid1;
}
if (ealen == 0)
/* Note that we can copy all of the fields, just some will not be "valid" */
void mds_pack_inode2body(struct mds_body *b, struct inode *inode)
{
- b->valid |= OBD_MD_FLID | OBD_MD_FLCTIME | OBD_MD_FLUID | OBD_MD_FLGID |
- OBD_MD_FLTYPE | OBD_MD_FLMODE | OBD_MD_FLNLINK | OBD_MD_FLGENER;
+ b->valid |= OBD_MD_FLID | OBD_MD_FLCTIME | OBD_MD_FLUID |
+ OBD_MD_FLGID | OBD_MD_FLFLAGS | OBD_MD_FLTYPE |
+ OBD_MD_FLMODE | OBD_MD_FLNLINK | OBD_MD_FLGENER |
+ OBD_MD_FLATIME | OBD_MD_FLMTIME; /* bug 2020 */
if (!S_ISREG(inode->i_mode))
b->valid |= OBD_MD_FLSIZE | OBD_MD_FLBLOCKS | OBD_MD_FLATIME |
# include <linux/lustre_net.h>
# include <linux/lustre_dlm.h>
# include <linux/lustre_lib.h>
+# include <linux/lustre_compat25.h>
/* convert a pathname into a kdev_t */
static kdev_t path2dev(char *path)