--- /dev/null
+
+--- linux-2.4.18/fs/ext3/inode.c~ext3-o_direct-1-2.4.18-chaos Mon Jul 28 14:13:05 2003
++++ linux-2.4.18-alexey/fs/ext3/inode.c Mon Jul 28 15:50:14 2003
+@@ -27,6 +27,7 @@
+ #include <linux/ext3_jbd.h>
+ #include <linux/jbd.h>
+ #include <linux/locks.h>
++#include <linux/iobuf.h>
+ #include <linux/smp_lock.h>
+ #include <linux/highuid.h>
+ #include <linux/quotaops.h>
+@@ -733,9 +734,9 @@ err_out:
+ * The BKL may not be held on entry here. Be sure to take it early.
+ */
+
+-static int ext3_get_block_handle(handle_t *handle, struct inode *inode,
+- long iblock,
+- struct buffer_head *bh_result, int create)
++static int
++ext3_get_block_handle(handle_t *handle, struct inode *inode, long iblock,
++ struct buffer_head *bh_result, int create, int extend_disksize)
+ {
+ int err = -EIO;
+ int offsets[4];
+@@ -816,16 +817,18 @@ out:
+ if (err)
+ goto cleanup;
+
+- new_size = inode->i_size;
+- /*
+- * This is not racy against ext3_truncate's modification of i_disksize
+- * because VM/VFS ensures that the file cannot be extended while
+- * truncate is in progress. It is racy between multiple parallel
+- * instances of get_block, but we have the BKL.
+- */
+- if (new_size > ei->i_disksize)
+- ei->i_disksize = new_size;
+-
++ if (extend_disksize) {
++ /*
++ * This is not racy against ext3_truncate's modification of
++ * i_disksize because VM/VFS ensures that the file cannot be
++ * extended while truncate is in progress. It is racy between
++ * multiple parallel instances of get_block, but we have BKL.
++ */
++ struct ext3_inode_info *ei = EXT3_I(inode);
++ new_size = inode->i_size;
++ if (new_size > ei->i_disksize)
++ ei->i_disksize = new_size;
++ }
+ bh_result->b_state |= (1UL << BH_New);
+ goto got_it;
+
+@@ -852,7 +855,38 @@ static int ext3_get_block(struct inode *
+ handle = ext3_journal_current_handle();
+ J_ASSERT(handle != 0);
+ }
+- ret = ext3_get_block_handle(handle, inode, iblock, bh_result, create);
++ ret = ext3_get_block_handle(handle, inode, iblock,
++ bh_result, create, 1);
++ return ret;
++}
++
++#define DIO_CREDITS (EXT3_RESERVE_TRANS_BLOCKS + 32)
++
++static int
++ext3_direct_io_get_block(struct inode *inode, long iblock,
++ struct buffer_head *bh_result, int create)
++{
++ handle_t *handle = journal_current_handle();
++ int ret = 0;
++
++ lock_kernel();
++ if (handle && handle->h_buffer_credits <= EXT3_RESERVE_TRANS_BLOCKS) {
++ /*
++ * Getting low on buffer credits...
++ */
++ if (!ext3_journal_extend(handle, DIO_CREDITS)) {
++ /*
++ * Couldn't extend the transaction. Start a new one
++ */
++ ret = ext3_journal_restart(handle, DIO_CREDITS);
++ }
++ }
++ if (ret == 0)
++ ret = ext3_get_block_handle(handle, inode, iblock,
++ bh_result, create, 0);
++ if (ret == 0)
++ bh_result->b_size = (1 << inode->i_blkbits);
++ unlock_kernel();
+ return ret;
+ }
+
+@@ -870,7 +904,7 @@ struct buffer_head *ext3_getblk(handle_t
+ dummy.b_state = 0;
+ dummy.b_blocknr = -1000;
+ buffer_trace_init(&dummy.b_history);
+- *errp = ext3_get_block_handle(handle, inode, block, &dummy, create);
++ *errp = ext3_get_block_handle(handle, inode, block, &dummy, create, 1);
+ if (!*errp && buffer_mapped(&dummy)) {
+ struct buffer_head *bh;
+ bh = sb_getblk(inode->i_sb, dummy.b_blocknr);
+@@ -1380,6 +1414,67 @@ static int ext3_releasepage(struct page
+ return journal_try_to_free_buffers(journal, page, wait);
+ }
+
++static int
++ext3_direct_IO(int rw, struct inode *inode, struct kiobuf *iobuf,
++ unsigned long blocknr, int blocksize)
++{
++ struct ext3_inode_info *ei = EXT3_I(inode);
++ handle_t *handle = NULL;
++ int ret;
++ int orphan = 0;
++ loff_t offset = blocknr << inode->i_blkbits; /* ugh */
++ ssize_t count = iobuf->length; /* ditto */
++
++ if (rw == WRITE) {
++ loff_t final_size = offset + count;
++
++ lock_kernel();
++ handle = ext3_journal_start(inode, DIO_CREDITS);
++ unlock_kernel();
++ if (IS_ERR(handle)) {
++ ret = PTR_ERR(handle);
++ goto out;
++ }
++ if (final_size > inode->i_size) {
++ lock_kernel();
++ ret = ext3_orphan_add(handle, inode);
++ unlock_kernel();
++ if (ret)
++ goto out_stop;
++ orphan = 1;
++ ei->i_disksize = inode->i_size;
++ }
++ }
++
++ ret = generic_direct_IO(rw, inode, iobuf, blocknr,
++ blocksize, ext3_direct_io_get_block);
++
++out_stop:
++ if (handle) {
++ int err;
++
++ lock_kernel();
++ if (orphan)
++ ext3_orphan_del(handle, inode);
++ if (orphan && ret > 0) {
++ loff_t end = offset + ret;
++ if (end > inode->i_size) {
++ ei->i_disksize = end;
++ inode->i_size = end;
++ err = ext3_mark_inode_dirty(handle, inode);
++ if (!ret)
++ ret = err;
++ }
++ }
++ err = ext3_journal_stop(handle, inode);
++ if (ret == 0)
++ ret = err;
++ unlock_kernel();
++ }
++out:
++ return ret;
++
++}
+
+ struct address_space_operations ext3_aops = {
+ readpage: ext3_readpage, /* BKL not held. Don't need */
+@@ -1390,6 +1485,7 @@ struct address_space_operations ext3_aop
+ bmap: ext3_bmap, /* BKL held */
+ flushpage: ext3_flushpage, /* BKL not held. Don't need */
+ releasepage: ext3_releasepage, /* BKL not held. Don't need */
++ direct_IO: ext3_direct_IO, /* BKL not held. Don't need */
+ };
+
+ /*
+@@ -2987,7 +3083,7 @@ int ext3_prep_san_write(struct inode *in
+ /* alloc blocks one by one */
+ for (i = 0; i < nblocks; i++) {
+ ret = ext3_get_block_handle(handle, inode, blocks[i],
+- &bh_tmp, 1);
++ &bh_tmp, 1, 1);
+ if (ret)
+ break;
+
+@@ -3047,7 +3143,7 @@ int ext3_map_inode_page(struct inode *in
+ if (blocks[i] != 0)
+ continue;
+
+- rc = ext3_get_block_handle(handle, inode, iblock, &dummy, 1);
++ rc = ext3_get_block_handle(handle, inode, iblock, &dummy, 1, 1);
+ if (rc) {
+ printk(KERN_INFO "ext3_map_inode_page: error reading "
+ "block %ld\n", iblock);
+
+_
0 files changed
---- linux-2.4.20/fs/dcache.c~vfs_intent-2.4.20-rh 2003-07-17 08:32:59.000000000 -0700
-+++ linux-2.4.20-mmonroe/fs/dcache.c 2003-07-17 08:35:22.000000000 -0700
-@@ -186,6 +186,13 @@ int d_invalidate(struct dentry * dentry)
+Index: linux-2.4.20-rh/fs/dcache.c
+===================================================================
+--- linux-2.4.20-rh.orig/fs/dcache.c 2003-07-29 11:36:40.000000000 +0800
++++ linux-2.4.20-rh/fs/dcache.c 2003-07-30 17:56:16.000000000 +0800
+@@ -186,6 +186,13 @@
spin_unlock(&dcache_lock);
return 0;
}
/*
* Check whether to do a partial shrink_dcache
* to get rid of unused child entries.
-@@ -839,13 +846,19 @@ void d_delete(struct dentry * dentry)
+@@ -841,13 +848,19 @@
* Adds a dentry to the hash according to its name.
*/
}
#define do_switch(x,y) do { \
---- linux-2.4.20/fs/namei.c~vfs_intent-2.4.20-rh 2003-07-17 08:32:47.000000000 -0700
-+++ linux-2.4.20-mmonroe/fs/namei.c 2003-07-17 08:35:22.000000000 -0700
+Index: linux-2.4.20-rh/fs/namei.c
+===================================================================
+--- linux-2.4.20-rh.orig/fs/namei.c 2003-07-29 11:36:22.000000000 +0800
++++ linux-2.4.20-rh/fs/namei.c 2003-07-30 18:00:29.000000000 +0800
@@ -94,6 +94,13 @@
* XEmacs seems to be relying on it...
*/
/* In order to reduce some races, while at the same time doing additional
* checking and hopefully speeding things up, we copy filenames to the
* kernel data space before using them..
-@@ -260,10 +267,19 @@ void path_release(struct nameidata *nd)
+@@ -260,10 +267,19 @@
* Internal lookup() using the new generic dcache.
* SMP-safe
*/
if (dentry && dentry->d_op && dentry->d_op->d_revalidate) {
if (!dentry->d_op->d_revalidate(dentry, flags) && !d_invalidate(dentry)) {
dput(dentry);
-@@ -281,11 +297,14 @@ static struct dentry * cached_lookup(str
+@@ -281,11 +297,14 @@
* make sure that nobody added the entry to the dcache in the meantime..
* SMP-safe
*/
down(&dir->i_sem);
/*
* First re-do the cached lookup just in case it was created
-@@ -300,6 +319,9 @@ static struct dentry * real_lookup(struc
+@@ -300,6 +319,9 @@
result = ERR_PTR(-ENOMEM);
if (dentry) {
lock_kernel();
result = dir->i_op->lookup(dir, dentry);
unlock_kernel();
if (result)
-@@ -321,6 +343,12 @@ static struct dentry * real_lookup(struc
+@@ -321,6 +343,12 @@
dput(result);
result = ERR_PTR(-ENOENT);
}
}
return result;
}
-@@ -334,7 +362,8 @@ int max_recursive_link = 5;
+@@ -334,7 +362,8 @@
* Without that kind of total limit, nasty chains of consecutive
* symlinks can cause almost arbitrarily long lookups.
*/
{
int err;
if (current->link_count >= max_recursive_link)
-@@ -348,10 +377,18 @@ static inline int do_follow_link(struct
+@@ -348,10 +377,18 @@
current->link_count++;
current->total_link_count++;
UPDATE_ATIME(dentry->d_inode);
-+ nd->it = it;
++ nd->intent = it;
err = dentry->d_inode->i_op->follow_link(dentry, nd);
-+ if (!err && it != NULL && !(it->it_int_flags & IT_FL_FOLLOWED)) {
++ if (!err && it != NULL && !(it->d.lustre.it_int_flags & IT_FL_FOLLOWED)) {
+ /* vfs_follow_link was never called */
+ intent_release(it);
+ path_release(nd);
path_release(nd);
return -ELOOP;
}
-@@ -381,15 +418,26 @@ int follow_up(struct vfsmount **mnt, str
+@@ -381,15 +418,26 @@
return __follow_up(mnt, dentry);
}
spin_unlock(&dcache_lock);
+ if (it) {
+ opc = it->it_op;
-+ mode = it->it_mode;
++ mode = it->it_create_mode;
+ }
+ intent_release(it);
+ if (it) {
+ it->it_op = opc;
-+ it->it_mode = mode;
++ it->it_create_mode = mode;
+ }
dput(*dentry);
mntput(mounted->mnt_parent);
*dentry = dget(mounted->mnt_root);
-@@ -401,7 +449,7 @@ static inline int __follow_down(struct v
+@@ -401,7 +449,7 @@
int follow_down(struct vfsmount **mnt, struct dentry **dentry)
{
}
static inline void follow_dotdot(struct nameidata *nd)
-@@ -437,7 +485,7 @@ static inline void follow_dotdot(struct
+@@ -437,7 +485,7 @@
mntput(nd->mnt);
nd->mnt = parent;
}
;
}
-@@ -449,7 +497,8 @@ static inline void follow_dotdot(struct
+@@ -449,7 +497,8 @@
*
* We expect 'base' to be positive and a directory.
*/
{
struct dentry *dentry;
struct inode *inode;
-@@ -526,19 +575,18 @@ int link_path_walk(const char * name, st
+@@ -526,19 +575,18 @@
break;
}
/* This does the actual lookups.. */
err = -ENOENT;
inode = dentry->d_inode;
-@@ -549,7 +597,7 @@ int link_path_walk(const char * name, st
+@@ -549,7 +597,7 @@
goto out_dput;
if (inode->i_op->follow_link) {
dput(dentry);
if (err)
goto return_err;
-@@ -565,7 +613,7 @@ int link_path_walk(const char * name, st
+@@ -565,7 +613,7 @@
nd->dentry = dentry;
}
err = -ENOTDIR;
break;
continue;
/* here ends the main loop */
-@@ -592,22 +640,22 @@ last_component:
+@@ -592,22 +640,22 @@
if (err < 0)
break;
}
dput(dentry);
if (err)
goto return_err;
-@@ -621,7 +669,8 @@ last_component:
+@@ -621,7 +669,8 @@
goto no_inode;
if (lookup_flags & LOOKUP_DIRECTORY) {
err = -ENOTDIR;
break;
}
goto return_base;
-@@ -645,6 +694,23 @@ return_reval:
+@@ -645,6 +694,23 @@
* Check the cached dentry for staleness.
*/
dentry = nd->dentry;
if (dentry && dentry->d_op && dentry->d_op->d_revalidate) {
err = -ESTALE;
if (!dentry->d_op->d_revalidate(dentry, 0)) {
-@@ -658,15 +724,28 @@ out_dput:
+@@ -658,15 +724,28 @@
dput(dentry);
break;
}
}
/* SMP-safe */
-@@ -751,6 +830,17 @@ walk_init_root(const char *name, struct
+@@ -751,6 +830,17 @@
}
/* SMP-safe */
int path_lookup(const char *path, unsigned flags, struct nameidata *nd)
{
int error = 0;
-@@ -765,6 +855,7 @@ int path_init(const char *name, unsigned
+@@ -765,6 +855,7 @@
{
nd->last_type = LAST_ROOT; /* if there are only slashes... */
nd->flags = flags;
-+ nd->it = NULL;
++ nd->intent = NULL;
if (*name=='/')
return walk_init_root(name,nd);
read_lock(¤t->fs->lock);
-@@ -779,7 +870,8 @@ int path_init(const char *name, unsigned
+@@ -779,7 +870,8 @@
* needs parent already locked. Doesn't follow mounts.
* SMP-safe.
*/
{
struct dentry * dentry;
struct inode *inode;
-@@ -802,13 +894,16 @@ struct dentry * lookup_hash(struct qstr
+@@ -802,13 +894,16 @@
goto out;
}
dentry = inode->i_op->lookup(inode, new);
unlock_kernel();
if (!dentry)
-@@ -820,6 +915,12 @@ out:
+@@ -820,6 +915,12 @@
return dentry;
}
/* SMP-safe */
struct dentry * lookup_one_len(const char * name, struct dentry * base, int len)
{
-@@ -841,7 +942,7 @@ struct dentry * lookup_one_len(const cha
+@@ -841,7 +942,7 @@
}
this.hash = end_name_hash(hash);
access:
return ERR_PTR(-EACCES);
}
-@@ -872,6 +973,23 @@ int __user_walk(const char *name, unsign
+@@ -872,6 +973,23 @@
return err;
}
/*
* It's inline, so penalty for filesystems that don't use sticky bit is
* minimal.
-@@ -969,7 +1087,8 @@ static inline int lookup_flags(unsigned
+@@ -969,7 +1087,8 @@
return retval;
}
{
int error;
-@@ -982,12 +1101,15 @@ int vfs_create(struct inode *dir, struct
+@@ -982,12 +1101,15 @@
goto exit_lock;
error = -EACCES; /* shouldn't it be ENOSYS? */
unlock_kernel();
exit_lock:
up(&dir->i_zombie);
-@@ -996,6 +1118,11 @@ exit_lock:
+@@ -996,6 +1118,11 @@
return error;
}
/*
* open_namei()
*
-@@ -1010,7 +1137,8 @@ exit_lock:
+@@ -1010,7 +1137,8 @@
* for symlinks (where the permissions are checked later).
* SMP-safe
*/
{
int acc_mode, error = 0;
struct inode *inode;
-@@ -1024,7 +1152,7 @@ int open_namei(const char * pathname, in
+@@ -1024,7 +1152,7 @@
* The simplest case - just a plain lookup.
*/
if (!(flag & O_CREAT)) {
if (error)
return error;
dentry = nd->dentry;
-@@ -1034,6 +1162,10 @@ int open_namei(const char * pathname, in
+@@ -1034,6 +1162,10 @@
/*
* Create - we need to know the parent.
*/
+ if (it) {
-+ it->it_mode = mode;
++ 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 @@ int open_namei(const char * pathname, in
+@@ -1049,7 +1181,7 @@
dir = nd->dentry;
down(&dir->d_inode->i_sem);
do_last:
error = PTR_ERR(dentry);
-@@ -1058,10 +1190,11 @@ do_last:
+@@ -1058,10 +1190,11 @@
goto exit;
}
-+ it->it_mode = mode;
++ it->it_create_mode = mode;
/* Negative dentry, just create the file */
if (!dentry->d_inode) {
- error = vfs_create(dir->d_inode, dentry,
up(&dir->d_inode->i_sem);
dput(nd->dentry);
nd->dentry = dentry;
-@@ -1086,7 +1219,7 @@ do_last:
+@@ -1086,7 +1219,7 @@
error = -ELOOP;
if (flag & O_NOFOLLOW)
goto exit_dput;
}
error = -ENOENT;
if (!dentry->d_inode)
-@@ -1165,7 +1298,7 @@ ok:
+@@ -1165,7 +1298,7 @@
if (!error) {
DQUOT_INIT(inode);
}
put_write_access(inode);
if (error)
-@@ -1177,8 +1310,10 @@ ok:
+@@ -1177,8 +1310,10 @@
return 0;
exit_dput:
path_release(nd);
return error;
-@@ -1197,7 +1332,16 @@ do_link:
+@@ -1197,7 +1332,16 @@
* are done. Procfs-like symlinks just set LAST_BIND.
*/
UPDATE_ATIME(dentry->d_inode);
-+ nd->it = it;
++ nd->intent = it;
error = dentry->d_inode->i_op->follow_link(dentry, nd);
+ if (error) {
+ intent_release(it);
-+ } else if (it != NULL && !(it->it_int_flags & IT_FL_FOLLOWED)) {
++ } else if (it != NULL && !(it->d.lustre.it_int_flags & IT_FL_FOLLOWED)) {
+ /* vfs_follow_link was never called */
+ intent_release(it);
+ path_release(nd);
dput(dentry);
if (error)
return error;
-@@ -1219,13 +1363,20 @@ do_link:
+@@ -1219,13 +1363,20 @@
}
dir = nd->dentry;
down(&dir->d_inode->i_sem);
{
struct dentry *dentry;
-@@ -1233,7 +1384,7 @@ static struct dentry *lookup_create(stru
+@@ -1233,7 +1384,7 @@
dentry = ERR_PTR(-EEXIST);
if (nd->last_type != LAST_NORM)
goto fail;
if (IS_ERR(dentry))
goto fail;
if (!is_dir && nd->last.name[nd->last.len] && !dentry->d_inode)
-@@ -1289,7 +1440,16 @@ asmlinkage long sys_mknod(const char * f
+@@ -1289,7 +1440,16 @@
error = path_lookup(tmp, LOOKUP_PARENT, &nd);
if (error)
goto out;
error = PTR_ERR(dentry);
mode &= ~current->fs->umask;
-@@ -1310,6 +1470,7 @@ asmlinkage long sys_mknod(const char * f
+@@ -1310,6 +1470,7 @@
dput(dentry);
}
up(&nd.dentry->d_inode->i_sem);
path_release(&nd);
out:
putname(tmp);
-@@ -1357,7 +1518,14 @@ asmlinkage long sys_mkdir(const char * p
+@@ -1357,7 +1518,14 @@
error = path_lookup(tmp, LOOKUP_PARENT, &nd);
if (error)
goto out;
error = PTR_ERR(dentry);
if (!IS_ERR(dentry)) {
error = vfs_mkdir(nd.dentry->d_inode, dentry,
-@@ -1365,6 +1533,7 @@ asmlinkage long sys_mkdir(const char * p
+@@ -1365,6 +1533,7 @@
dput(dentry);
}
up(&nd.dentry->d_inode->i_sem);
path_release(&nd);
out:
putname(tmp);
-@@ -1465,8 +1634,16 @@ asmlinkage long sys_rmdir(const char * p
+@@ -1465,8 +1634,16 @@
error = -EBUSY;
goto exit1;
}
error = PTR_ERR(dentry);
if (!IS_ERR(dentry)) {
error = vfs_rmdir(nd.dentry->d_inode, dentry);
-@@ -1524,8 +1701,15 @@ asmlinkage long sys_unlink(const char *
+@@ -1524,8 +1701,15 @@
error = -EISDIR;
if (nd.last_type != LAST_NORM)
goto exit1;
error = PTR_ERR(dentry);
if (!IS_ERR(dentry)) {
/* Why not before? Because we want correct error value */
-@@ -1592,15 +1776,23 @@ asmlinkage long sys_symlink(const char *
+@@ -1592,15 +1776,23 @@
error = path_lookup(to, LOOKUP_PARENT, &nd);
if (error)
goto out;
putname(to);
}
putname(from);
-@@ -1676,7 +1868,14 @@ asmlinkage long sys_link(const char * ol
+@@ -1676,7 +1868,14 @@
error = -EXDEV;
if (old_nd.mnt != nd.mnt)
goto out_release;
error = PTR_ERR(new_dentry);
if (!IS_ERR(new_dentry)) {
error = vfs_link(old_nd.dentry, nd.dentry->d_inode, new_dentry);
-@@ -1720,7 +1919,7 @@ exit:
+@@ -1720,7 +1919,7 @@
* locking].
*/
int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry,
{
int error;
struct inode *target;
-@@ -1799,7 +1998,7 @@ out_unlock:
+@@ -1799,7 +1998,7 @@
}
int vfs_rename_other(struct inode *old_dir, struct dentry *old_dentry,
{
int error;
-@@ -1887,9 +2086,18 @@ static inline int do_rename(const char *
+@@ -1887,9 +2086,18 @@
if (newnd.last_type != LAST_NORM)
goto exit2;
error = PTR_ERR(old_dentry);
if (IS_ERR(old_dentry))
goto exit3;
-@@ -1905,16 +2113,16 @@ static inline int do_rename(const char *
+@@ -1905,16 +2113,16 @@
if (newnd.last.name[newnd.last.len])
goto exit4;
}
dput(new_dentry);
exit4:
dput(old_dentry);
-@@ -1965,20 +2173,28 @@ out:
+@@ -1965,20 +2173,28 @@
}
static inline int
goto fail;
+ if (it == NULL)
-+ it = nd->it;
-+ else if (it != nd->it)
-+ printk("it != nd->it: tell phil@clusterfs.com\n");
++ it = nd->intent;
++ else if (it != nd->intent)
++ printk("it != nd->intent: tell phil@clusterfs.com\n");
+ if (it != NULL)
-+ it->it_int_flags |= IT_FL_FOLLOWED;
++ it->d.lustre.it_int_flags |= IT_FL_FOLLOWED;
+
if (*link == '/') {
path_release(nd);
out:
if (current->link_count || res || nd->last_type!=LAST_NORM)
return res;
-@@ -2002,7 +2218,13 @@ fail:
+@@ -2002,7 +2218,13 @@
int vfs_follow_link(struct nameidata *nd, const char *link)
{
}
/* get the link contents into pagecache */
-@@ -2044,7 +2266,7 @@ int page_follow_link(struct dentry *dent
+@@ -2044,7 +2266,7 @@
{
struct page *page = NULL;
char *s = page_getlink(dentry, &page);
if (page) {
kunmap(page);
page_cache_release(page);
---- linux-2.4.20/fs/open.c~vfs_intent-2.4.20-rh 2003-07-17 08:32:45.000000000 -0700
-+++ linux-2.4.20-mmonroe/fs/open.c 2003-07-17 08:35:22.000000000 -0700
+Index: linux-2.4.20-rh/fs/open.c
+===================================================================
+--- linux-2.4.20-rh.orig/fs/open.c 2003-07-29 11:36:22.000000000 +0800
++++ linux-2.4.20-rh/fs/open.c 2003-07-30 17:56:16.000000000 +0800
@@ -19,6 +19,8 @@
#include <asm/uaccess.h>
int vfs_statfs(struct super_block *sb, struct statfs *buf)
{
-@@ -95,9 +97,10 @@ void fd_install(unsigned int fd, struct
+@@ -95,9 +97,10 @@
write_unlock(&files->file_lock);
}
int error;
struct iattr newattrs;
-@@ -108,7 +111,13 @@ int do_truncate(struct dentry *dentry, l
+@@ -108,7 +111,13 @@
down(&inode->i_sem);
newattrs.ia_size = length;
newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
up(&inode->i_sem);
return error;
}
-@@ -118,12 +127,13 @@ static inline long do_sys_truncate(const
+@@ -118,12 +127,13 @@
struct nameidata nd;
struct inode * inode;
int error;
if (error)
goto out;
inode = nd.dentry->d_inode;
-@@ -163,11 +173,13 @@ static inline long do_sys_truncate(const
+@@ -163,11 +173,13 @@
error = locks_verify_truncate(inode, NULL, length);
if (!error) {
DQUOT_INIT(inode);
path_release(&nd);
out:
return error;
-@@ -215,7 +227,7 @@ static inline long do_sys_ftruncate(unsi
+@@ -215,7 +227,7 @@
error = locks_verify_truncate(inode, file, length);
if (!error)
out_putf:
fput(file);
out:
-@@ -260,11 +272,13 @@ asmlinkage long sys_utime(char * filenam
+@@ -260,11 +272,13 @@
struct inode * inode;
struct iattr newattrs;
error = -EROFS;
if (IS_RDONLY(inode))
goto dput_and_out;
-@@ -279,11 +293,25 @@ asmlinkage long sys_utime(char * filenam
+@@ -279,11 +293,25 @@
goto dput_and_out;
newattrs.ia_valid |= ATTR_ATIME_SET | ATTR_MTIME_SET;
error = notify_change(nd.dentry, &newattrs);
dput_and_out:
path_release(&nd);
-@@ -304,12 +332,14 @@ asmlinkage long sys_utimes(char * filena
+@@ -304,12 +332,14 @@
struct inode * inode;
struct iattr newattrs;
error = -EROFS;
if (IS_RDONLY(inode))
goto dput_and_out;
-@@ -324,7 +354,20 @@ asmlinkage long sys_utimes(char * filena
+@@ -324,7 +354,20 @@
newattrs.ia_atime = times[0].tv_sec;
newattrs.ia_mtime = times[1].tv_sec;
newattrs.ia_valid |= ATTR_ATIME_SET | ATTR_MTIME_SET;
if (current->fsuid != inode->i_uid &&
(error = permission(inode,MAY_WRITE)) != 0)
goto dput_and_out;
-@@ -347,6 +390,7 @@ asmlinkage long sys_access(const char *
+@@ -347,6 +390,7 @@
int old_fsuid, old_fsgid;
kernel_cap_t old_cap;
int res;
if (mode & ~S_IRWXO) /* where's F_OK, X_OK, W_OK, R_OK? */
return -EINVAL;
-@@ -364,13 +408,14 @@ asmlinkage long sys_access(const char *
+@@ -364,13 +408,14 @@
else
current->cap_effective = current->cap_permitted;
path_release(&nd);
}
-@@ -385,8 +430,9 @@ asmlinkage long sys_chdir(const char * f
+@@ -385,8 +430,9 @@
{
int error;
struct nameidata nd;
if (error)
goto out;
-@@ -397,6 +443,7 @@ asmlinkage long sys_chdir(const char * f
+@@ -397,6 +443,7 @@
set_fs_pwd(current->fs, nd.mnt, nd.dentry);
dput_and_out:
path_release(&nd);
out:
return error;
-@@ -436,9 +483,10 @@ asmlinkage long sys_chroot(const char *
+@@ -436,9 +483,10 @@
{
int error;
struct nameidata nd;
if (error)
goto out;
-@@ -454,6 +502,7 @@ asmlinkage long sys_chroot(const char *
+@@ -454,6 +502,7 @@
set_fs_altroot();
error = 0;
dput_and_out:
path_release(&nd);
out:
return error;
-@@ -508,6 +557,18 @@ asmlinkage long sys_chmod(const char * f
+@@ -508,6 +557,18 @@
if (IS_RDONLY(inode))
goto dput_and_out;
error = -EPERM;
if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
goto dput_and_out;
-@@ -538,6 +599,20 @@ static int chown_common(struct dentry *
+@@ -538,6 +599,20 @@
error = -EROFS;
if (IS_RDONLY(inode))
goto out;
error = -EPERM;
if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
goto out;
-@@ -642,8 +717,9 @@ struct file *filp_open(const char * file
+@@ -642,8 +717,9 @@
{
int namei_flags, error;
struct nameidata nd;
namei_flags = flags;
if ((namei_flags+1) & O_ACCMODE)
-@@ -651,14 +727,15 @@ struct file *filp_open(const char * file
+@@ -651,14 +727,15 @@
if (namei_flags & O_TRUNC)
namei_flags |= 2;
{
struct file * f;
struct inode *inode;
-@@ -695,12 +772,15 @@ struct file *dentry_open(struct dentry *
+@@ -695,12 +772,15 @@
}
if (f->f_op && f->f_op->open) {
return f;
cleanup_all:
-@@ -715,11 +795,17 @@ cleanup_all:
+@@ -715,11 +795,17 @@
cleanup_file:
put_filp(f);
cleanup_dentry:
/*
* Find an empty file descriptor entry, and mark it busy.
*/
---- linux-2.4.20/fs/stat.c~vfs_intent-2.4.20-rh 2003-07-17 08:33:05.000000000 -0700
-+++ linux-2.4.20-mmonroe/fs/stat.c 2003-07-17 08:51:33.000000000 -0700
+Index: linux-2.4.20-rh/fs/stat.c
+===================================================================
+--- linux-2.4.20-rh.orig/fs/stat.c 2003-07-29 11:36:40.000000000 +0800
++++ linux-2.4.20-rh/fs/stat.c 2003-07-30 17:56:16.000000000 +0800
@@ -17,10 +17,12 @@
* Revalidate the inode. This is required for proper NFS attribute caching.
*/
return inode->i_op->revalidate(dentry);
return 0;
}
-@@ -32,13 +34,13 @@ static inline nlink_t user_nlink(struct
+@@ -32,13 +34,13 @@
return inode->i_nlink;
}
if (res)
return res;
-@@ -111,10 +113,12 @@ int vfs_stat(char *name, struct kstat *s
+@@ -111,10 +113,12 @@
{
struct nameidata nd;
int error;
path_release(&nd);
}
return error;
-@@ -124,10 +128,12 @@ int vfs_lstat(char *name, struct kstat *
+@@ -124,10 +128,12 @@
{
struct nameidata nd;
int error;
path_release(&nd);
}
return error;
-@@ -139,7 +145,7 @@ int vfs_fstat(unsigned int fd, struct ks
+@@ -139,7 +145,7 @@
int error = -EBADF;
if (f) {
fput(f);
}
return error;
-@@ -286,7 +292,7 @@ asmlinkage long sys_readlink(const char
+@@ -286,7 +292,7 @@
error = -EINVAL;
if (inode->i_op && inode->i_op->readlink &&
UPDATE_ATIME(inode);
error = inode->i_op->readlink(nd.dentry, buf, bufsiz);
}
---- linux-2.4.20/include/linux/dcache.h~vfs_intent-2.4.20-rh 2003-07-17 08:32:48.000000000 -0700
-+++ linux-2.4.20-mmonroe/include/linux/dcache.h 2003-07-17 08:35:22.000000000 -0700
-@@ -6,6 +6,45 @@
+Index: linux-2.4.20-rh/include/linux/dcache.h
+===================================================================
+--- linux-2.4.20-rh.orig/include/linux/dcache.h 2003-07-29 11:36:22.000000000 +0800
++++ linux-2.4.20-rh/include/linux/dcache.h 2003-07-30 17:58:24.000000000 +0800
+@@ -6,6 +6,52 @@
#include <asm/atomic.h>
#include <linux/mount.h>
#include <linux/kernel.h>
+
+#define INTENT_MAGIC 0x19620323
+
-+struct lookup_intent {
-+ int it_op;
-+ void (*it_op_release)(struct lookup_intent *);
-+ int it_magic;
-+ int it_mode;
-+ int it_flags;
-+ int it_disposition;
-+ int it_status;
++
++struct lustre_intent_data {
++ int it_disposition;
++ int it_status;
++ __u64 it_lock_handle;
++ void *it_data;
++ int it_lock_mode;
+ int it_int_flags;
-+ __u64 it_lock_handle[2];
-+ int it_lock_mode;
-+ void *it_data;
+};
++struct lookup_intent {
++ 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;
++};
++
+
+static inline void intent_init(struct lookup_intent *it, int op, int flags)
+{
/*
* linux/include/linux/dcache.h
-@@ -96,8 +135,22 @@ struct dentry_operations {
+@@ -96,8 +142,22 @@
int (*d_delete)(struct dentry *);
void (*d_release)(struct dentry *);
void (*d_iput)(struct dentry *, struct inode *);
/* the dentry parameter passed to d_hash and d_compare is the parent
* directory of the entries to be compared. It is used in case these
* functions need any directory specific information for determining
-@@ -129,6 +182,7 @@ d_iput: no no yes
+@@ -129,6 +189,7 @@
* s_nfsd_free_path semaphore will be down
*/
#define DCACHE_REFERENCED 0x0008 /* Recently used, don't discard. */
extern spinlock_t dcache_lock;
---- linux-2.4.20/include/linux/fs.h~vfs_intent-2.4.20-rh 2003-07-17 08:34:44.000000000 -0700
-+++ linux-2.4.20-mmonroe/include/linux/fs.h 2003-07-17 08:35:22.000000000 -0700
-@@ -337,6 +337,9 @@ extern void set_bh_page(struct buffer_he
+Index: linux-2.4.20-rh/include/linux/fs.h
+===================================================================
+--- linux-2.4.20-rh.orig/include/linux/fs.h 2003-07-30 17:56:12.000000000 +0800
++++ linux-2.4.20-rh/include/linux/fs.h 2003-07-30 17:57:05.000000000 +0800
+@@ -338,6 +338,9 @@
#define ATTR_MTIME_SET 256
#define ATTR_FORCE 512 /* Not a change, but a change it */
#define ATTR_ATTR_FLAG 1024
/*
* This is the Inode Attributes structure, used for notify_change(). It
-@@ -574,6 +577,7 @@ struct file {
+@@ -575,6 +578,7 @@
/* needed for tty driver, and maybe others */
void *private_data;
/* preallocated helper kiobuf to speedup O_DIRECT */
struct kiobuf *f_iobuf;
-@@ -701,6 +705,7 @@ struct nameidata {
+@@ -702,6 +706,7 @@
struct qstr last;
unsigned int flags;
int last_type;
-+ struct lookup_intent *it;
++ struct lookup_intent *intent;
};
/*
-@@ -821,7 +826,8 @@ extern int vfs_symlink(struct inode *, s
+@@ -822,7 +827,8 @@
extern int vfs_link(struct dentry *, struct inode *, struct dentry *);
extern int vfs_rmdir(struct inode *, struct dentry *);
extern int vfs_unlink(struct inode *, struct dentry *);
/*
* File types
-@@ -881,21 +887,32 @@ struct file_operations {
+@@ -882,21 +888,32 @@
struct inode_operations {
int (*create) (struct inode *,struct dentry *,int);
int (*getattr) (struct dentry *, struct iattr *);
int (*setxattr) (struct dentry *, const char *, void *, size_t, int);
ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
-@@ -1091,10 +1108,14 @@ static inline int get_lease(struct inode
+@@ -1092,10 +1109,14 @@
asmlinkage long sys_open(const char *, int, int);
asmlinkage long sys_close(unsigned int); /* yes, it's really unsigned */
extern int filp_close(struct file *, fl_owner_t id);
extern char * getname(const char *);
-@@ -1385,6 +1406,7 @@ typedef int (*read_actor_t)(read_descrip
+@@ -1386,6 +1407,7 @@
extern loff_t default_llseek(struct file *file, loff_t offset, int origin);
extern int FASTCALL(__user_walk(const char *, unsigned, struct nameidata *));
extern int FASTCALL(path_init(const char *, unsigned, struct nameidata *));
extern int FASTCALL(path_walk(const char *, struct nameidata *));
extern int FASTCALL(path_lookup(const char *, unsigned, struct nameidata *));
-@@ -1396,6 +1418,8 @@ extern struct dentry * lookup_one_len(co
+@@ -1397,6 +1419,8 @@
extern struct dentry * lookup_hash(struct qstr *, struct dentry *);
#define user_path_walk(name,nd) __user_walk(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, nd)
#define user_path_walk_link(name,nd) __user_walk(name, LOOKUP_POSITIVE, nd)
extern void inode_init_once(struct inode *);
extern void iput(struct inode *);
-@@ -1497,6 +1521,8 @@ extern struct file_operations generic_ro
+@@ -1504,6 +1528,8 @@
extern int vfs_readlink(struct dentry *, char *, int, const char *);
extern int vfs_follow_link(struct nameidata *, const char *);
extern int page_readlink(struct dentry *, char *, int);
extern int page_follow_link(struct dentry *, struct nameidata *);
extern struct inode_operations page_symlink_inode_operations;
---- linux-2.4.20/kernel/ksyms.c~vfs_intent-2.4.20-rh 2003-07-17 08:34:45.000000000 -0700
-+++ linux-2.4.20-mmonroe/kernel/ksyms.c 2003-07-17 08:35:22.000000000 -0700
-@@ -298,6 +298,7 @@ EXPORT_SYMBOL(read_cache_page);
+Index: linux-2.4.20-rh/kernel/ksyms.c
+===================================================================
+--- linux-2.4.20-rh.orig/kernel/ksyms.c 2003-07-30 17:56:14.000000000 +0800
++++ linux-2.4.20-rh/kernel/ksyms.c 2003-07-30 17:56:17.000000000 +0800
+@@ -298,6 +298,7 @@
EXPORT_SYMBOL(set_page_dirty);
EXPORT_SYMBOL(vfs_readlink);
EXPORT_SYMBOL(vfs_follow_link);
EXPORT_SYMBOL(page_readlink);
EXPORT_SYMBOL(page_follow_link);
EXPORT_SYMBOL(page_symlink_inode_operations);
---- linux-2.4.20/fs/exec.c~vfs_intent-2.4.20-rh 2003-07-17 08:33:09.000000000 -0700
-+++ linux-2.4.20-mmonroe/fs/exec.c 2003-07-17 08:35:22.000000000 -0700
-@@ -114,8 +114,9 @@ asmlinkage long sys_uselib(const char *
+Index: linux-2.4.20-rh/fs/exec.c
+===================================================================
+--- linux-2.4.20-rh.orig/fs/exec.c 2003-07-29 11:36:40.000000000 +0800
++++ linux-2.4.20-rh/fs/exec.c 2003-07-30 17:56:17.000000000 +0800
+@@ -114,8 +114,9 @@
struct file * file;
struct nameidata nd;
int error;
if (error)
goto out;
-@@ -127,7 +128,8 @@ asmlinkage long sys_uselib(const char *
+@@ -127,7 +128,8 @@
if (error)
goto exit;
error = PTR_ERR(file);
if (IS_ERR(file))
goto out;
-@@ -382,8 +384,9 @@ struct file *open_exec(const char *name)
+@@ -382,8 +384,9 @@
struct inode *inode;
struct file *file;
int err = 0;
file = ERR_PTR(err);
if (!err) {
inode = nd.dentry->d_inode;
-@@ -395,7 +398,8 @@ struct file *open_exec(const char *name)
+@@ -395,7 +398,8 @@
err = -EACCES;
file = ERR_PTR(err);
if (!err) {
if (!IS_ERR(file)) {
err = deny_write_access(file);
if (err) {
-@@ -407,6 +411,7 @@ out:
+@@ -407,6 +411,7 @@
return file;
}
}
path_release(&nd);
}
goto out;
-@@ -1283,7 +1288,7 @@ int do_coredump(long signr, int exit_cod
+@@ -1296,7 +1301,7 @@
goto close_fail;
if (!file->f_op->write)
goto close_fail;
goto close_fail;
retval = binfmt->core_dump(signr, regs, file);
---- linux-2.4.20/fs/proc/base.c~vfs_intent-2.4.20-rh 2003-07-17 08:33:05.000000000 -0700
-+++ linux-2.4.20-mmonroe/fs/proc/base.c 2003-07-17 08:35:22.000000000 -0700
-@@ -464,6 +464,9 @@ static int proc_pid_follow_link(struct d
+Index: linux-2.4.20-rh/fs/proc/base.c
+===================================================================
+--- linux-2.4.20-rh.orig/fs/proc/base.c 2003-07-29 11:36:40.000000000 +0800
++++ linux-2.4.20-rh/fs/proc/base.c 2003-07-30 17:56:17.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->it != NULL)
-+ nd->it->it_int_flags |= IT_FL_FOLLOWED;
++ if (nd->intent != NULL)
++ nd->intent->d.lustre.it_int_flags |= IT_FL_FOLLOWED;
out:
return error;
}
-
-_