From 3cc1266ba20b18e2cc4b0734babe02290c63ff8a Mon Sep 17 00:00:00 2001 From: ericm Date: Sat, 4 Oct 2003 11:33:01 +0000 Subject: [PATCH] merge b_devel -> b_eq 20031004 kernel only --- .../patches/ext-2.4-patch-1-chaos.patch | 45 +- .../kernel_patches/patches/ext-2.4-patch-1.patch | 43 +- lustre/kernel_patches/patches/extN-wantedi.patch | 74 ++- .../kernel_patches/patches/htree-ext3-2.4.18.patch | 5 +- .../patches/vfs_intent-2.4.20-rh.patch | 713 +++++++++++++-------- .../patches/vfs_intent-2.4.20-vanilla.patch | 368 +++++------ lustre/kernel_patches/pc/extN-wantedi.pc | 1 + lustre/kernel_patches/pc/vfs_intent-2.4.20-rh.pc | 9 +- lustre/kernel_patches/series/vanilla-2.4.20 | 1 + lustre/ldlm/ldlm_lib.c | 79 ++- lustre/mdc/mdc_internal.h | 2 +- lustre/mdc/mdc_lib.c | 17 +- lustre/mds/mds_lib.c | 6 +- lustre/osc/osc_lib.c | 1 + 14 files changed, 808 insertions(+), 556 deletions(-) diff --git a/lustre/kernel_patches/patches/ext-2.4-patch-1-chaos.patch b/lustre/kernel_patches/patches/ext-2.4-patch-1-chaos.patch index b59cea2..31e499c 100644 --- a/lustre/kernel_patches/patches/ext-2.4-patch-1-chaos.patch +++ b/lustre/kernel_patches/patches/ext-2.4-patch-1-chaos.patch @@ -1190,28 +1190,28 @@ + +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); +} @@ -1381,7 +1381,7 @@ } 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]; } @@ -1642,7 +1642,8 @@ + 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; @@ -2192,7 +2193,7 @@ - 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; diff --git a/lustre/kernel_patches/patches/ext-2.4-patch-1.patch b/lustre/kernel_patches/patches/ext-2.4-patch-1.patch index 09caec1..6f9b884 100644 --- a/lustre/kernel_patches/patches/ext-2.4-patch-1.patch +++ b/lustre/kernel_patches/patches/ext-2.4-patch-1.patch @@ -1190,28 +1190,28 @@ + +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); +} @@ -1381,7 +1381,7 @@ } 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]; } @@ -1642,7 +1642,8 @@ + 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; diff --git a/lustre/kernel_patches/patches/extN-wantedi.patch b/lustre/kernel_patches/patches/extN-wantedi.patch index c5772fb..359dc63 100644 --- a/lustre/kernel_patches/patches/extN-wantedi.patch +++ b/lustre/kernel_patches/patches/extN-wantedi.patch @@ -1,54 +1,72 @@ - 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, @@ -174,11 +192,25 @@ 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). _ diff --git a/lustre/kernel_patches/patches/htree-ext3-2.4.18.patch b/lustre/kernel_patches/patches/htree-ext3-2.4.18.patch index a54e9ca..1bba90a 100644 --- a/lustre/kernel_patches/patches/htree-ext3-2.4.18.patch +++ b/lustre/kernel_patches/patches/htree-ext3-2.4.18.patch @@ -673,7 +673,7 @@ /* * ext3_add_entry() * -@@ -255,118 +849,278 @@ +@@ -255,118 +849,279 @@ struct inode *inode) { struct inode *dir = dentry->d_parent->d_inode; @@ -1006,7 +1006,8 @@ + 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; diff --git a/lustre/kernel_patches/patches/vfs_intent-2.4.20-rh.patch b/lustre/kernel_patches/patches/vfs_intent-2.4.20-rh.patch index 80fbf72..7334495 100644 --- a/lustre/kernel_patches/patches/vfs_intent-2.4.20-rh.patch +++ b/lustre/kernel_patches/patches/vfs_intent-2.4.20-rh.patch @@ -1,10 +1,21 @@ - 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; } @@ -18,7 +29,7 @@ Index: linux-2.4.20-rh/fs/dcache.c /* * 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. */ @@ -41,10 +52,71 @@ Index: linux-2.4.20-rh/fs/dcache.c } #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... */ @@ -59,7 +131,7 @@ Index: linux-2.4.20-rh/fs/namei.c /* 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 */ @@ -80,7 +152,7 @@ Index: linux-2.4.20-rh/fs/namei.c 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 */ @@ -90,13 +162,14 @@ Index: linux-2.4.20-rh/fs/namei.c { 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(); @@ -106,7 +179,7 @@ Index: linux-2.4.20-rh/fs/namei.c 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); } @@ -114,12 +187,15 @@ Index: linux-2.4.20-rh/fs/namei.c + 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. */ @@ -129,7 +205,7 @@ Index: linux-2.4.20-rh/fs/namei.c { 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); @@ -148,7 +224,7 @@ Index: linux-2.4.20-rh/fs/namei.c 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); } @@ -176,7 +252,7 @@ Index: linux-2.4.20-rh/fs/namei.c 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) { @@ -185,7 +261,7 @@ Index: linux-2.4.20-rh/fs/namei.c } 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; } @@ -194,7 +270,7 @@ Index: linux-2.4.20-rh/fs/namei.c ; } -@@ -449,7 +497,8 @@ +@@ -449,7 +501,8 @@ static inline void follow_dotdot(struct * * We expect 'base' to be positive and a directory. */ @@ -204,7 +280,7 @@ Index: linux-2.4.20-rh/fs/namei.c { 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.. */ @@ -227,7 +303,7 @@ Index: linux-2.4.20-rh/fs/namei.c 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) { @@ -236,7 +312,7 @@ Index: linux-2.4.20-rh/fs/namei.c 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; @@ -245,7 +321,7 @@ Index: linux-2.4.20-rh/fs/namei.c break; continue; /* here ends the main loop */ -@@ -592,22 +640,22 @@ +@@ -592,22 +644,22 @@ last_component: if (err < 0) break; } @@ -272,7 +348,7 @@ Index: linux-2.4.20-rh/fs/namei.c 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; @@ -282,11 +358,10 @@ Index: linux-2.4.20-rh/fs/namei.c 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)) { @@ -299,14 +374,17 @@ Index: linux-2.4.20-rh/fs/namei.c + &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; } @@ -336,7 +414,7 @@ Index: linux-2.4.20-rh/fs/namei.c } /* SMP-safe */ -@@ -751,6 +830,17 @@ +@@ -751,6 +836,17 @@ walk_init_root(const char *name, struct } /* SMP-safe */ @@ -354,7 +432,7 @@ Index: linux-2.4.20-rh/fs/namei.c 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; @@ -362,7 +440,7 @@ Index: linux-2.4.20-rh/fs/namei.c 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. */ @@ -372,7 +450,7 @@ Index: linux-2.4.20-rh/fs/namei.c { struct dentry * dentry; struct inode *inode; -@@ -802,13 +894,16 @@ +@@ -802,13 +900,16 @@ struct dentry * lookup_hash(struct qstr goto out; } @@ -390,7 +468,7 @@ Index: linux-2.4.20-rh/fs/namei.c dentry = inode->i_op->lookup(inode, new); unlock_kernel(); if (!dentry) -@@ -820,6 +915,12 @@ +@@ -820,6 +921,12 @@ out: return dentry; } @@ -403,7 +481,7 @@ Index: linux-2.4.20-rh/fs/namei.c /* 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); @@ -412,7 +490,7 @@ Index: linux-2.4.20-rh/fs/namei.c access: return ERR_PTR(-EACCES); } -@@ -872,6 +973,23 @@ +@@ -872,6 +979,23 @@ int __user_walk(const char *name, unsign return err; } @@ -436,7 +514,7 @@ Index: linux-2.4.20-rh/fs/namei.c /* * 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; } @@ -446,7 +524,7 @@ Index: linux-2.4.20-rh/fs/namei.c { 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? */ @@ -464,7 +542,7 @@ Index: linux-2.4.20-rh/fs/namei.c unlock_kernel(); exit_lock: up(&dir->i_zombie); -@@ -996,6 +1118,11 @@ +@@ -996,6 +1124,11 @@ exit_lock: return error; } @@ -476,7 +554,7 @@ Index: linux-2.4.20-rh/fs/namei.c /* * open_namei() * -@@ -1010,7 +1137,8 @@ +@@ -1010,7 +1143,8 @@ exit_lock: * for symlinks (where the permissions are checked later). * SMP-safe */ @@ -486,7 +564,14 @@ Index: linux-2.4.20-rh/fs/namei.c { 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)) { @@ -495,18 +580,18 @@ Index: linux-2.4.20-rh/fs/namei.c 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); @@ -515,7 +600,7 @@ Index: linux-2.4.20-rh/fs/namei.c do_last: error = PTR_ERR(dentry); -@@ -1058,10 +1190,11 @@ +@@ -1058,10 +1199,11 @@ do_last: goto exit; } @@ -529,7 +614,7 @@ Index: linux-2.4.20-rh/fs/namei.c 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; @@ -538,7 +623,7 @@ Index: linux-2.4.20-rh/fs/namei.c } error = -ENOENT; if (!dentry->d_inode) -@@ -1165,7 +1298,7 @@ +@@ -1165,7 +1307,7 @@ ok: if (!error) { DQUOT_INIT(inode); @@ -547,7 +632,7 @@ Index: linux-2.4.20-rh/fs/namei.c } put_write_access(inode); if (error) -@@ -1177,8 +1310,10 @@ +@@ -1177,8 +1319,10 @@ ok: return 0; exit_dput: @@ -558,7 +643,7 @@ Index: linux-2.4.20-rh/fs/namei.c 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); @@ -575,7 +660,7 @@ Index: linux-2.4.20-rh/fs/namei.c 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); @@ -598,7 +683,7 @@ Index: linux-2.4.20-rh/fs/namei.c { 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; @@ -607,7 +692,7 @@ Index: linux-2.4.20-rh/fs/namei.c 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; @@ -625,7 +710,7 @@ Index: linux-2.4.20-rh/fs/namei.c 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); @@ -633,23 +718,23 @@ Index: linux-2.4.20-rh/fs/namei.c 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); @@ -657,42 +742,42 @@ Index: linux-2.4.20-rh/fs/namei.c 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; @@ -718,7 +803,7 @@ Index: linux-2.4.20-rh/fs/namei.c 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; @@ -734,7 +819,7 @@ Index: linux-2.4.20-rh/fs/namei.c 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, @@ -743,7 +828,7 @@ Index: linux-2.4.20-rh/fs/namei.c { 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, @@ -752,18 +837,18 @@ Index: linux-2.4.20-rh/fs/namei.c { 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); @@ -772,7 +857,7 @@ Index: linux-2.4.20-rh/fs/namei.c 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; } @@ -791,7 +876,7 @@ Index: linux-2.4.20-rh/fs/namei.c dput(new_dentry); exit4: dput(old_dentry); -@@ -1965,20 +2173,28 @@ +@@ -1965,20 +2182,28 @@ out: } static inline int @@ -822,7 +907,7 @@ Index: linux-2.4.20-rh/fs/namei.c 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) { @@ -837,7 +922,7 @@ Index: linux-2.4.20-rh/fs/namei.c } /* 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); @@ -846,10 +931,123 @@ Index: linux-2.4.20-rh/fs/namei.c 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 @@ -859,7 +1057,7 @@ Index: linux-2.4.20-rh/fs/open.c 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); } @@ -871,7 +1069,7 @@ Index: linux-2.4.20-rh/fs/open.c 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; @@ -886,7 +1084,7 @@ Index: linux-2.4.20-rh/fs/open.c 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; @@ -901,7 +1099,7 @@ Index: linux-2.4.20-rh/fs/open.c 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); @@ -916,7 +1114,7 @@ Index: linux-2.4.20-rh/fs/open.c 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) @@ -925,7 +1123,7 @@ Index: linux-2.4.20-rh/fs/open.c 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; @@ -940,7 +1138,7 @@ Index: linux-2.4.20-rh/fs/open.c 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; @@ -967,7 +1165,7 @@ Index: linux-2.4.20-rh/fs/open.c 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; @@ -983,7 +1181,7 @@ Index: linux-2.4.20-rh/fs/open.c 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; @@ -1005,7 +1203,7 @@ Index: linux-2.4.20-rh/fs/open.c 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; @@ -1013,7 +1211,7 @@ Index: linux-2.4.20-rh/fs/open.c 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; @@ -1029,18 +1227,18 @@ Index: linux-2.4.20-rh/fs/open.c 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: @@ -1048,11 +1246,11 @@ Index: linux-2.4.20-rh/fs/open.c 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); @@ -1061,7 +1259,7 @@ Index: linux-2.4.20-rh/fs/open.c 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: @@ -1132,7 +1330,7 @@ Index: linux-2.4.20-rh/fs/open.c 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; @@ -1164,7 +1362,7 @@ Index: linux-2.4.20-rh/fs/open.c 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; @@ -1185,19 +1383,19 @@ Index: linux-2.4.20-rh/fs/open.c 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; @@ -1218,7 +1416,7 @@ Index: linux-2.4.20-rh/fs/open.c { 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) { @@ -1234,7 +1432,7 @@ Index: linux-2.4.20-rh/fs/open.c return f; cleanup_all: -@@ -715,11 +783,17 @@ +@@ -715,11 +783,17 @@ cleanup_all: cleanup_file: put_filp(f); cleanup_dentry: @@ -1252,11 +1450,21 @@ Index: linux-2.4.20-rh/fs/open.c /* * 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 @@ -1265,13 +1473,15 @@ Index: linux-2.4.20-rh/fs/stat.c { 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; } @@ -1287,37 +1497,37 @@ Index: linux-2.4.20-rh/fs/stat.c 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) { @@ -1326,7 +1536,7 @@ Index: linux-2.4.20-rh/fs/stat.c 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 && @@ -1335,11 +1545,9 @@ Index: linux-2.4.20-rh/fs/stat.c 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 #include #include @@ -1362,25 +1570,24 @@ Index: linux-2.4.20-rh/include/linux/dcache.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)); @@ -1392,7 +1599,7 @@ Index: linux-2.4.20-rh/include/linux/dcache.h /* * 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 *); @@ -1415,7 +1622,7 @@ Index: linux-2.4.20-rh/include/linux/dcache.h /* 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. */ @@ -1423,11 +1630,9 @@ Index: linux-2.4.20-rh/include/linux/dcache.h 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 @@ -1435,7 +1640,7 @@ Index: linux-2.4.20-rh/include/linux/fs.h #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 @@ -1445,7 +1650,15 @@ Index: linux-2.4.20-rh/include/linux/fs.h /* * 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; @@ -1453,7 +1666,7 @@ Index: linux-2.4.20-rh/include/linux/fs.h /* 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; @@ -1461,7 +1674,7 @@ Index: linux-2.4.20-rh/include/linux/fs.h }; /* -@@ -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 *); @@ -1471,7 +1684,7 @@ Index: linux-2.4.20-rh/include/linux/fs.h /* * File types -@@ -882,21 +889,32 @@ +@@ -882,21 +890,32 @@ struct file_operations { struct inode_operations { int (*create) (struct inode *,struct dentry *,int); @@ -1500,11 +1713,11 @@ Index: linux-2.4.20-rh/include/linux/fs.h 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 */ @@ -1520,7 +1733,7 @@ Index: linux-2.4.20-rh/include/linux/fs.h 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 *)); @@ -1528,7 +1741,7 @@ Index: linux-2.4.20-rh/include/linux/fs.h 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) @@ -1537,7 +1750,7 @@ Index: linux-2.4.20-rh/include/linux/fs.h 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 *); @@ -1546,11 +1759,37 @@ Index: linux-2.4.20-rh/include/linux/fs.h 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); @@ -1558,82 +1797,38 @@ Index: linux-2.4.20-rh/kernel/ksyms.c 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; - } + +_ diff --git a/lustre/kernel_patches/patches/vfs_intent-2.4.20-vanilla.patch b/lustre/kernel_patches/patches/vfs_intent-2.4.20-vanilla.patch index 434686d..3eca972 100644 --- a/lustre/kernel_patches/patches/vfs_intent-2.4.20-vanilla.patch +++ b/lustre/kernel_patches/patches/vfs_intent-2.4.20-vanilla.patch @@ -1,26 +1,24 @@ - 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); @@ -42,8 +40,8 @@ Index: lum/fs/exec.c 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); @@ -77,10 +75,8 @@ Index: lum/fs/exec.c 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; @@ -118,10 +114,8 @@ Index: lum/fs/dcache.c } #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; @@ -235,10 +229,8 @@ Index: lum/fs/namespace.c 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... */ @@ -284,10 +276,10 @@ Index: lum/fs/namei.c { 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 @@ -309,10 +301,10 @@ Index: lum/fs/namei.c + 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; @@ -411,7 +403,7 @@ Index: lum/fs/namei.c 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; @@ -427,13 +419,17 @@ Index: lum/fs/namei.c + &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; } @@ -463,7 +459,7 @@ Index: lum/fs/namei.c } /* 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 */ @@ -481,7 +477,7 @@ Index: lum/fs/namei.c 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; @@ -489,7 +485,7 @@ Index: lum/fs/namei.c 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. */ @@ -499,7 +495,7 @@ Index: lum/fs/namei.c { 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; } @@ -517,7 +513,7 @@ Index: lum/fs/namei.c dentry = inode->i_op->lookup(inode, new); unlock_kernel(); if (!dentry) -@@ -808,6 +889,12 @@ out: +@@ -808,6 +893,12 @@ out: return dentry; } @@ -530,7 +526,7 @@ Index: lum/fs/namei.c /* 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); @@ -539,7 +535,7 @@ Index: lum/fs/namei.c 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; } @@ -563,7 +559,7 @@ Index: lum/fs/namei.c /* * 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; } @@ -573,7 +569,7 @@ Index: lum/fs/namei.c { 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? */ @@ -591,7 +587,7 @@ Index: lum/fs/namei.c unlock_kernel(); exit_lock: up(&dir->i_zombie); -@@ -982,6 +1090,11 @@ exit_lock: +@@ -982,6 +1094,11 @@ exit_lock: return error; } @@ -603,7 +599,7 @@ Index: lum/fs/namei.c /* * open_namei() * -@@ -996,7 +1109,8 @@ exit_lock: +@@ -996,7 +1113,8 @@ exit_lock: * for symlinks (where the permissions are checked later). * SMP-safe */ @@ -613,12 +609,12 @@ Index: lum/fs/namei.c { 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. @@ -629,18 +625,18 @@ Index: lum/fs/namei.c 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); @@ -649,7 +645,7 @@ Index: lum/fs/namei.c do_last: error = PTR_ERR(dentry); -@@ -1044,10 +1165,11 @@ do_last: +@@ -1044,10 +1169,11 @@ do_last: goto exit; } @@ -663,7 +659,7 @@ Index: lum/fs/namei.c 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); @@ -672,7 +668,7 @@ Index: lum/fs/namei.c } put_write_access(inode); if (error) -@@ -1163,8 +1285,10 @@ ok: +@@ -1163,8 +1289,10 @@ ok: return 0; exit_dput: @@ -683,7 +679,7 @@ Index: lum/fs/namei.c 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); @@ -694,7 +690,7 @@ Index: lum/fs/namei.c 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); @@ -717,7 +713,7 @@ Index: lum/fs/namei.c { 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; @@ -726,7 +722,7 @@ Index: lum/fs/namei.c 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; @@ -744,7 +740,7 @@ Index: lum/fs/namei.c 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); @@ -752,23 +748,23 @@ Index: lum/fs/namei.c 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); @@ -776,42 +772,42 @@ Index: lum/fs/namei.c 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; @@ -837,7 +833,7 @@ Index: lum/fs/namei.c 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; @@ -853,7 +849,7 @@ Index: lum/fs/namei.c 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, @@ -862,7 +858,7 @@ Index: lum/fs/namei.c { 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, @@ -871,18 +867,18 @@ Index: lum/fs/namei.c { 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); @@ -891,7 +887,7 @@ Index: lum/fs/namei.c 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; } @@ -910,7 +906,7 @@ Index: lum/fs/namei.c dput(new_dentry); exit4: dput(old_dentry); -@@ -1951,20 +2142,26 @@ out: +@@ -1951,20 +2146,26 @@ out: } static inline int @@ -926,7 +922,7 @@ Index: lum/fs/namei.c + 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); @@ -939,7 +935,7 @@ Index: lum/fs/namei.c 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) { @@ -954,7 +950,7 @@ Index: lum/fs/namei.c } /* 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); @@ -963,10 +959,8 @@ Index: lum/fs/namei.c 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 @@ -1150,7 +1144,7 @@ Index: lum/fs/open.c { 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); @@ -1169,7 +1163,7 @@ Index: lum/fs/open.c { 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); @@ -1265,18 +1259,18 @@ Index: lum/fs/open.c - 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: @@ -1302,20 +1296,15 @@ Index: lum/fs/open.c 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; @@ -1336,7 +1325,7 @@ Index: lum/fs/open.c { 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) { @@ -1352,7 +1341,7 @@ Index: lum/fs/open.c return f; cleanup_all: -@@ -713,11 +782,17 @@ cleanup_all: +@@ -713,11 +781,17 @@ cleanup_all: cleanup_file: put_filp(f); cleanup_dentry: @@ -1370,11 +1359,9 @@ Index: lum/fs/open.c /* * 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 @@ -1383,13 +1370,15 @@ Index: lum/fs/stat.c { 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; @@ -1407,7 +1396,7 @@ Index: lum/fs/stat.c 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; @@ -1425,7 +1414,7 @@ Index: lum/fs/stat.c 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; @@ -1443,7 +1432,7 @@ Index: lum/fs/stat.c 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; @@ -1461,7 +1450,7 @@ Index: lum/fs/stat.c 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; @@ -1470,7 +1459,7 @@ Index: lum/fs/stat.c 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; @@ -1479,7 +1468,7 @@ Index: lum/fs/stat.c 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 && @@ -1488,7 +1477,7 @@ Index: lum/fs/stat.c 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; @@ -1505,7 +1494,7 @@ Index: lum/fs/stat.c 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; @@ -1522,7 +1511,7 @@ Index: lum/fs/stat.c 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; @@ -1531,14 +1520,14 @@ Index: lum/fs/stat.c 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 #include #include - ++#include ++ +#define IT_OPEN 0x0001 +#define IT_CREAT 0x0002 +#define IT_READDIR 0x0004 @@ -1556,24 +1545,24 @@ Index: lum/include/linux/dcache.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)); @@ -1582,11 +1571,10 @@ Index: lum/include/linux/dcache.h + 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 *); @@ -1609,7 +1597,7 @@ Index: lum/include/linux/dcache.h /* 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. */ @@ -1617,10 +1605,8 @@ Index: lum/include/linux/dcache.h 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 @@ -1639,7 +1625,15 @@ Index: lum/include/linux/fs.h /* * 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; @@ -1647,7 +1641,7 @@ Index: lum/include/linux/fs.h /* 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; @@ -1655,7 +1649,7 @@ Index: lum/include/linux/fs.h }; #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 *); @@ -1665,7 +1659,7 @@ Index: lum/include/linux/fs.h /* * 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); @@ -1694,11 +1688,11 @@ Index: lum/include/linux/fs.h 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 */ @@ -1714,7 +1708,7 @@ Index: lum/include/linux/fs.h 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 *)); @@ -1722,7 +1716,7 @@ Index: lum/include/linux/fs.h 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) @@ -1731,7 +1725,7 @@ Index: lum/include/linux/fs.h 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 *); @@ -1740,10 +1734,8 @@ Index: lum/include/linux/fs.h 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; @@ -1770,10 +1762,8 @@ Index: lum/include/linux/fs_struct.h 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); @@ -1782,10 +1772,8 @@ Index: lum/kernel/ksyms.c 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); @@ -1800,10 +1788,8 @@ Index: lum/kernel/fork.c 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 */ @@ -1819,3 +1805,5 @@ Index: lum/kernel/exit.c dput(fs->altroot); mntput(fs->altrootmnt); } + +_ diff --git a/lustre/kernel_patches/pc/extN-wantedi.pc b/lustre/kernel_patches/pc/extN-wantedi.pc index 6ad2589..345f113 100644 --- a/lustre/kernel_patches/pc/extN-wantedi.pc +++ b/lustre/kernel_patches/pc/extN-wantedi.pc @@ -3,3 +3,4 @@ fs/ext3/ialloc.c fs/ext3/inode.c fs/ext3/ioctl.c include/linux/ext3_fs.h +include/linux/dcache.h diff --git a/lustre/kernel_patches/pc/vfs_intent-2.4.20-rh.pc b/lustre/kernel_patches/pc/vfs_intent-2.4.20-rh.pc index fbe6ff1..07cb1b3 100644 --- a/lustre/kernel_patches/pc/vfs_intent-2.4.20-rh.pc +++ b/lustre/kernel_patches/pc/vfs_intent-2.4.20-rh.pc @@ -1,10 +1,13 @@ 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 diff --git a/lustre/kernel_patches/series/vanilla-2.4.20 b/lustre/kernel_patches/series/vanilla-2.4.20 index e3f4bd1..78a6820 100644 --- a/lustre/kernel_patches/series/vanilla-2.4.20 +++ b/lustre/kernel_patches/series/vanilla-2.4.20 @@ -1,4 +1,5 @@ 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 diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index b5e6be5..c760e45 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -298,6 +298,11 @@ int target_handle_connect(struct ptlrpc_request *req, svc_handler_t handler) 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 @@ -352,8 +357,6 @@ out: int target_handle_disconnect(struct ptlrpc_request *req) { - struct obd_export *export; - struct obd_import *dlmimp; int rc; ENTRY; @@ -361,19 +364,19 @@ int target_handle_disconnect(struct ptlrpc_request *req) 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 */ @@ -437,7 +440,6 @@ void target_abort_recovery(void *data) } 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); @@ -473,7 +475,7 @@ static void reset_recovery_timer(struct obd_device *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); } @@ -499,21 +501,38 @@ void target_start_recovery_timer(struct obd_device *obd, svc_handler_t handler) 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; } @@ -548,10 +567,12 @@ static void process_recovery_queue(struct obd_device *obd) 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); @@ -640,12 +661,13 @@ int target_queue_recovery_request(struct ptlrpc_request *req, 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; } @@ -725,6 +747,7 @@ int target_queue_final_reply(struct ptlrpc_request *req, int rc) } else { CERROR("%s: %d recoverable clients remain\n", obd->obd_name, obd->obd_recoverable_clients); + wake_up(&obd->obd_next_transno_waitq); } return 1; diff --git a/lustre/mdc/mdc_internal.h b/lustre/mdc/mdc_internal.h index 620a202..353e39d 100644 --- a/lustre/mdc/mdc_internal.h +++ b/lustre/mdc/mdc_internal.h @@ -1,7 +1,7 @@ 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, diff --git a/lustre/mdc/mdc_lib.c b/lustre/mdc/mdc_lib.c index 103a43a..148b883 100644 --- a/lustre/mdc/mdc_lib.c +++ b/lustre/mdc/mdc_lib.c @@ -30,7 +30,7 @@ #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; @@ -38,8 +38,7 @@ void mdc_readdir_pack(struct ptlrpc_request *req, __u64 offset, __u32 size, 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; /* !! */ @@ -94,7 +93,7 @@ void mdc_create_pack(struct ptlrpc_request *req, int offset, 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; @@ -120,9 +119,10 @@ void mdc_open_pack(struct ptlrpc_request *req, int offset, 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); } } @@ -154,6 +154,9 @@ void mdc_setattr_pack(struct ptlrpc_request *req, 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) diff --git a/lustre/mds/mds_lib.c b/lustre/mds/mds_lib.c index a9b6f3f..54dd14b 100644 --- a/lustre/mds/mds_lib.c +++ b/lustre/mds/mds_lib.c @@ -59,8 +59,10 @@ void mds_pack_inode2fid(struct ll_fid *fid, struct inode *inode) /* 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 | diff --git a/lustre/osc/osc_lib.c b/lustre/osc/osc_lib.c index e4219b0..1a50314 100644 --- a/lustre/osc/osc_lib.c +++ b/lustre/osc/osc_lib.c @@ -31,6 +31,7 @@ # include # include # include +# include /* convert a pathname into a kdev_t */ static kdev_t path2dev(char *path) -- 1.8.3.1