-diff -urN linux/fs/file_table.c linux-2.4.20/fs/file_table.c
---- linux/fs/file_table.c Fri Nov 29 05:23:15 2002
-+++ linux-2.4.20/fs/file_table.c Mon Aug 18 22:05:59 2003
-@@ -82,7 +82,7 @@
+diff -uprN linux-2.4.20/fs/file_table.c linux-2.4.20c/fs/file_table.c
+--- linux-2.4.20/fs/file_table.c 2002-11-29 05:23:15.000000000 +0530
++++ linux-2.4.20c/fs/file_table.c 2003-09-03 18:57:54.000000000 +0530
+@@ -82,7 +82,7 @@ struct file * get_empty_filp(void)
* and call the open function (if any). The caller must verify that
* inode->i_fop is not NULL.
*/
{
memset(filp, 0, sizeof(*filp));
filp->f_mode = mode;
-@@ -90,6 +90,8 @@
+@@ -90,6 +90,8 @@ int init_private_file(struct file *filp,
filp->f_dentry = dentry;
filp->f_uid = current->fsuid;
filp->f_gid = current->fsgid;
filp->f_op = dentry->d_inode->i_fop;
if (filp->f_op->open)
return filp->f_op->open(dentry->d_inode, filp);
-@@ -97,6 +99,11 @@
+@@ -97,6 +99,11 @@ int init_private_file(struct file *filp,
return 0;
}
void fput(struct file * file)
{
struct dentry * dentry = file->f_dentry;
-diff -urN linux/fs/inode.c linux-2.4.20/fs/inode.c
---- linux/fs/inode.c Mon Aug 18 21:55:12 2003
-+++ linux-2.4.20/fs/inode.c Mon Aug 18 22:07:46 2003
-@@ -970,9 +970,9 @@
+diff -uprN linux-2.4.20/fs/inode.c linux-2.4.20c/fs/inode.c
+--- linux-2.4.20/fs/inode.c 2003-09-03 19:01:57.000000000 +0530
++++ linux-2.4.20c/fs/inode.c 2003-09-03 18:57:54.000000000 +0530
+@@ -970,9 +970,9 @@ struct inode *igrab(struct inode *inode)
}
struct inode * inode;
spin_lock(&inode_lock);
-@@ -985,6 +985,22 @@
+@@ -985,6 +985,22 @@ struct inode *iget4(struct super_block *
}
spin_unlock(&inode_lock);
/*
* get_new_inode() will do the right thing, re-trying the search
* in case it had to block at any point.
-diff -urN linux/fs/namei.c linux-2.4.20/fs/namei.c
---- linux/fs/namei.c Mon Aug 18 21:55:11 2003
-+++ linux-2.4.20/fs/namei.c Mon Aug 18 22:05:59 2003
-@@ -894,7 +894,7 @@
+diff -uprN linux-2.4.20/fs/namei.c linux-2.4.20c/fs/namei.c
+--- linux-2.4.20/fs/namei.c 2003-09-04 11:57:55.000000000 +0530
++++ linux-2.4.20c/fs/namei.c 2003-09-03 18:57:54.000000000 +0530
+@@ -894,7 +894,7 @@ struct dentry * lookup_hash(struct qstr
/* SMP-safe */
{
unsigned long hash;
struct qstr this;
-@@ -914,11 +914,16 @@
+@@ -914,11 +914,16 @@ struct dentry * lookup_one_len(const cha
}
this.hash = end_name_hash(hash);
/*
* namei()
*
-diff -urN linux/fs/nfsd/nfsfh.c linux-2.4.20/fs/nfsd/nfsfh.c
---- linux/fs/nfsd/nfsfh.c Fri Nov 29 05:23:15 2002
-+++ linux-2.4.20/fs/nfsd/nfsfh.c Mon Aug 18 22:05:59 2003
-@@ -36,6 +36,11 @@
+diff -uprN linux-2.4.20/fs/nfsd/nfsfh.c linux-2.4.20c/fs/nfsd/nfsfh.c
+--- linux-2.4.20/fs/nfsd/nfsfh.c 2002-11-29 05:23:15.000000000 +0530
++++ linux-2.4.20c/fs/nfsd/nfsfh.c 2003-09-03 18:57:55.000000000 +0530
+@@ -36,6 +36,15 @@ struct nfsd_getdents_callback {
int sequence; /* sequence counter */
};
+static struct dentry *lookup_it(struct inode *inode, struct dentry * dentry)
+{
-+ return inode->i_op->lookup_it(inode, dentry, NULL, 0);
++ if (inode->i_op->lookup_it)
++ return inode->i_op->lookup_it(inode, dentry, NULL, 0);
++ else
++ return inode->i_op->lookup(inode, dentry);
++
+}
+
/*
* A rather strange filldir function to capture
* the name matching the specified inode number.
-@@ -75,6 +80,8 @@
+@@ -75,6 +84,8 @@ static int nfsd_get_name(struct dentry *
int error;
struct file file;
struct nfsd_getdents_callback buffer;
error = -ENOTDIR;
if (!dir || !S_ISDIR(dir->i_mode))
-@@ -85,9 +92,36 @@
+@@ -85,9 +96,35 @@ static int nfsd_get_name(struct dentry *
/*
* Open the directory ...
*/
- error = init_private_file(&file, dentry, FMODE_READ);
- if (error)
+ if (dentry->d_op && dentry->d_op->d_revalidate_it) {
-+ if ( (dentry->d_flags & DCACHE_NFSD_DISCONNECTED) &&
-+ (dentry->d_parent == dentry) ) {
++ if ((dentry->d_flags & DCACHE_NFSD_DISCONNECTED) &&
++ (dentry->d_parent == dentry) ) {
+ it.it_op_release = NULL;
+ /* XXX Temporary Hack: Simulating init_private_file without f_op->open
-+ for disconnected dentry Since we don't have actual dentry->d_name to revalidate
-+ in open_it() */
++ for disconnected dentry Since we don't have actual dentry->d_name to
++ revalidate in revalidate_it() */
+ filp = &file;
+ memset(filp, 0, sizeof(*filp));
+ filp->f_mode = FMODE_READ;
+ atomic_set(&filp->f_count, 1);
+ filp->f_dentry = dentry;
-+ filp->f_uid = current->fsuid;
-+ filp->f_gid = current->fsgid;
-+ filp->f_op = dentry->d_inode->i_fop;
++ filp->f_uid = current->fsuid;
++ filp->f_gid = current->fsgid;
++ filp->f_op = dentry->d_inode->i_fop;
+ error = 0;
+ } else {
+ intent_init(&it, IT_OPEN, 0);
-+ extern int open_it(struct dentry *dentry, struct lookup_intent *it);
-+ error = open_it(dentry, &it);
++ error = revalidate_it(dentry, &it);
+ if (error)
+ goto out;
+ error = init_private_file_it(&file, dentry, FMODE_READ, &it);
error = -EINVAL;
if (!file.f_op->readdir)
goto out_close;
-@@ -113,9 +147,13 @@
+@@ -113,9 +150,13 @@ static int nfsd_get_name(struct dentry *
}
out_close:
return error;
}
-@@ -274,7 +312,10 @@
+@@ -274,7 +315,7 @@ struct dentry *nfsd_findparent(struct de
* it is well connected. But nobody returns different dentrys do they?
*/
down(&child->d_inode->i_sem);
- pdentry = child->d_inode->i_op->lookup(child->d_inode, tdentry);
-+ if (child->d_inode->i_op->lookup_it)
-+ pdentry = lookup_it(child->d_inode, tdentry);
-+ else
-+ pdentry = child->d_inode->i_op->lookup(child->d_inode, tdentry);
++ pdentry = lookup_it(child->d_inode, tdentry);
up(&child->d_inode->i_sem);
d_drop(tdentry); /* we never want ".." hashed */
if (!pdentry && tdentry->d_inode == NULL) {
-@@ -306,6 +347,8 @@
+@@ -306,6 +347,8 @@ struct dentry *nfsd_findparent(struct de
igrab(tdentry->d_inode);
pdentry->d_flags |= DCACHE_NFSD_DISCONNECTED;
}
}
if (pdentry == NULL)
pdentry = ERR_PTR(-ENOMEM);
-@@ -463,6 +506,8 @@
+@@ -463,6 +506,8 @@ find_fh_dentry(struct super_block *sb, _
struct dentry *pdentry;
struct inode *parent;
pdentry = nfsd_findparent(dentry);
err = PTR_ERR(pdentry);
if (IS_ERR(pdentry))
-@@ -662,6 +707,11 @@
+@@ -662,6 +707,11 @@ fh_verify(struct svc_rqst *rqstp, struct
inode = dentry->d_inode;
/* Type check. The correct error return for type mismatches
* does not seem to be generally agreed upon. SunOS seems to
* use EISDIR if file isn't S_IFREG; a comment in the NFSv3
-@@ -900,8 +950,9 @@
+@@ -900,8 +950,9 @@ out_negative:
dentry->d_parent->d_name.name, dentry->d_name.name);
goto out;
out_uptodate:
goto out;
}
-diff -urN linux/fs/nfsd/vfs.c linux-2.4.20/fs/nfsd/vfs.c
---- linux/fs/nfsd/vfs.c Fri Nov 29 05:23:15 2002
-+++ linux-2.4.20/fs/nfsd/vfs.c Mon Aug 18 22:05:59 2003
-@@ -77,6 +77,122 @@
+diff -uprN linux-2.4.20/fs/nfsd/vfs.c linux-2.4.20c/fs/nfsd/vfs.c
+--- linux-2.4.20/fs/nfsd/vfs.c 2002-11-29 05:23:15.000000000 +0530
++++ linux-2.4.20c/fs/nfsd/vfs.c 2003-09-04 11:58:54.000000000 +0530
+@@ -77,6 +77,122 @@ struct raparms {
static struct raparms * raparml;
static struct raparms * raparm_cache;
+ return err;
+}
+
-+int open_it(struct dentry *dentry, struct lookup_intent *it)
++int revalidate_it(struct dentry *dentry, struct lookup_intent *it)
+{
+ int err = 0;
+
/*
* Look up one component of a pathname.
* N.B. After this call _both_ fhp and resfh need an fh_put
-@@ -300,7 +416,10 @@
+@@ -300,7 +416,10 @@ nfsd_setattr(struct svc_rqst *rqstp, str
}
err = nfserr_notsync;
if (!check_guard || guardtime == inode->i_ctime) {
err = nfserrno(err);
}
if (size_change) {
-@@ -473,6 +592,15 @@
+@@ -473,6 +592,15 @@ nfsd_open(struct svc_rqst *rqstp, struct
filp->f_mode = FMODE_READ;
}
+ struct lookup_intent it;
+ intent_init(&it, IT_OPEN, filp->f_flags);
+
-+ err = open_it(dentry, &it);
++ err = revalidate_it(dentry, &it);
+ if (err)
+ goto out_nfserr;
+
err = 0;
if (filp->f_op && filp->f_op->open) {
err = filp->f_op->open(inode, filp);
-@@ -487,7 +615,11 @@
+@@ -487,7 +615,11 @@ nfsd_open(struct svc_rqst *rqstp, struct
atomic_dec(&filp->f_count);
}
}
if (err)
err = nfserrno(err);
out:
-@@ -818,7 +950,7 @@
+@@ -818,7 +950,7 @@ nfsd_create(struct svc_rqst *rqstp, stru
{
struct dentry *dentry, *dchild;
struct inode *dirp;
err = nfserr_perm;
if (!flen)
-@@ -834,8 +966,24 @@
+@@ -834,8 +966,24 @@ nfsd_create(struct svc_rqst *rqstp, stru
dentry = fhp->fh_dentry;
dirp = dentry->d_inode;
goto out;
/*
* Check whether the response file handle has been verified yet.
-@@ -868,10 +1016,12 @@
+@@ -868,10 +1016,12 @@ nfsd_create(struct svc_rqst *rqstp, stru
* Make sure the child dentry is still negative ...
*/
err = nfserr_exist;
}
if (!(iap->ia_valid & ATTR_MODE))
-@@ -887,13 +1037,15 @@
+@@ -887,13 +1037,15 @@ nfsd_create(struct svc_rqst *rqstp, stru
err = vfs_create(dirp, dchild, iap->ia_mode);
break;
case S_IFDIR:
break;
default:
printk("nfsd: bad file type %o in nfsd_create\n", type);
-@@ -943,6 +1095,8 @@
+@@ -943,6 +1095,8 @@ nfsd_create_v3(struct svc_rqst *rqstp, s
int err;
__u32 v_mtime=0, v_atime=0;
int v_mode=0;
+ struct lookup_intent it;
-+ intent_init(&it, IT_CREAT, 0);
++ intent_init(&it, IT_LOOKUP, 0);
err = nfserr_perm;
if (!flen)
-@@ -962,14 +1116,18 @@
+@@ -962,14 +1116,20 @@ nfsd_create_v3(struct svc_rqst *rqstp, s
/* Get all the sanity checks out of the way before
* we lock the parent. */
err = nfserr_notdir;
- if(!dirp->i_op || !dirp->i_op->lookup)
++ if (dirp->i_op->mknod_raw)
++ err = mknod_raw(dentry, fname, flen, iap->ia_mode, 0);
++
+ if(!dirp->i_op || !(dirp->i_op->lookup || dirp->i_op->lookup_it))
goto out;
fh_lock(fhp);
* Compose the response file handle.
*/
- dchild = lookup_one_len(fname, dentry, flen);
-+ if (dirp->i_op->lookup_it) {
-+ it.it_create_mode = iap->ia_mode;
++ if (dirp->i_op->lookup_it)
+ dchild = lookup_one_len_it(fname, dentry, flen, &it);
-+ } else
++ else
+ dchild = lookup_one_len(fname, dentry, flen);
err = PTR_ERR(dchild);
if (IS_ERR(dchild))
goto out_nfserr;
-@@ -1013,6 +1171,8 @@
+@@ -1013,6 +1173,8 @@ nfsd_create_v3(struct svc_rqst *rqstp, s
case NFS3_CREATE_GUARDED:
err = nfserr_exist;
}
-+ if(dirp->i_op->lookup_it)
++ if(dirp->i_op->mknod_raw)
+ err = 0;
goto out;
}
-@@ -1053,6 +1213,9 @@
- err = nfsd_setattr(rqstp, resfhp, iap, 0, (time_t)0);
-
- out:
-+ if (dirp->i_op->lookup_it && it.it_op_release) {
-+ intent_release(&it);
-+ }
- fh_unlock(fhp);
- return err;
-
-@@ -1119,7 +1282,7 @@
+@@ -1119,7 +1281,7 @@ nfsd_symlink(struct svc_rqst *rqstp, str
struct iattr *iap)
{
struct dentry *dentry, *dnew;
err = nfserr_noent;
if (!flen || !plen)
-@@ -1133,12 +1296,18 @@
+@@ -1133,12 +1295,18 @@ nfsd_symlink(struct svc_rqst *rqstp, str
goto out;
fh_lock(fhp);
dentry = fhp->fh_dentry;
if (!err) {
if (EX_ISSYNC(fhp->fh_export))
nfsd_sync_dir(dentry);
-@@ -1206,7 +1375,10 @@
+@@ -1206,7 +1374,10 @@ nfsd_link(struct svc_rqst *rqstp, struct
dold = tfhp->fh_dentry;
dest = dold->d_inode;
if (!err) {
if (EX_ISSYNC(ffhp->fh_export)) {
nfsd_sync_dir(ddir);
-@@ -1291,7 +1463,10 @@
+@@ -1291,7 +1462,10 @@ nfsd_rename(struct svc_rqst *rqstp, stru
err = nfserr_perm;
} else
#endif
if (!err && EX_ISSYNC(tfhp->fh_export)) {
nfsd_sync_dir(tdentry);
nfsd_sync_dir(fdentry);
-@@ -1312,7 +1487,7 @@
+@@ -1312,7 +1486,7 @@ nfsd_rename(struct svc_rqst *rqstp, stru
fill_post_wcc(tfhp);
double_up(&tdir->i_sem, &fdir->i_sem);
ffhp->fh_locked = tfhp->fh_locked = 0;
out:
return err;
}
-@@ -1358,9 +1533,15 @@
+@@ -1358,9 +1532,15 @@ nfsd_unlink(struct svc_rqst *rqstp, stru
err = nfserr_perm;
} else
#endif
}
dput(rdentry);
-diff -urN linux/fs/super.c linux-2.4.20/fs/super.c
---- linux/fs/super.c Mon Aug 18 21:55:11 2003
-+++ linux-2.4.20/fs/super.c Mon Aug 18 22:05:59 2003
+diff -uprN linux-2.4.20/fs/super.c linux-2.4.20c/fs/super.c
+--- linux-2.4.20/fs/super.c 2003-09-03 19:01:57.000000000 +0530
++++ linux-2.4.20c/fs/super.c 2003-09-03 18:57:54.000000000 +0530
@@ -27,6 +27,7 @@
#include <linux/devfs_fs_kernel.h>
#include <linux/major.h>
#include <asm/uaccess.h>
-@@ -51,7 +52,7 @@
+@@ -51,7 +52,7 @@ spinlock_t sb_lock = SPIN_LOCK_UNLOCKED;
*/
static struct file_system_type *file_systems;
/* WARNING: This can be used only if we _already_ own a reference */
static void get_filesystem(struct file_system_type *fs)
-diff -urN linux/include/linux/fs.h linux-2.4.20/include/linux/fs.h
---- linux/include/linux/fs.h Mon Aug 18 21:55:16 2003
-+++ linux-2.4.20/include/linux/fs.h Mon Aug 18 22:10:54 2003
-@@ -1366,6 +1366,7 @@
+diff -uprN linux-2.4.20/include/linux/fs.h linux-2.4.20c/include/linux/fs.h
+--- linux-2.4.20/include/linux/fs.h 2003-09-03 19:01:58.000000000 +0530
++++ linux-2.4.20c/include/linux/fs.h 2003-09-03 19:18:18.000000000 +0530
+@@ -1096,6 +1096,7 @@ extern int open_namei_it(const char *fil
+ struct nameidata *nd, struct lookup_intent *it);
+ extern struct file *dentry_open_it(struct dentry *dentry, struct vfsmount *mnt,
+ int flags, struct lookup_intent *it);
++extern int revalidate_it(struct dentry *dentry, struct lookup_intent *it);
+ extern int filp_close(struct file *, fl_owner_t id);
+ extern char * getname(const char *);
+
+@@ -1366,6 +1367,7 @@ extern void path_release(struct nameidat
extern int follow_down(struct vfsmount **, struct dentry **);
extern int follow_up(struct vfsmount **, struct dentry **);
extern struct dentry * lookup_one_len(const char *, struct dentry *, int);
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)
-@@ -1379,6 +1380,7 @@
+@@ -1379,6 +1381,7 @@ extern ino_t iunique(struct super_block
typedef int (*find_inode_t)(struct inode *, unsigned long, void *);
extern struct inode * iget4(struct super_block *, unsigned long, find_inode_t, void *);
static inline struct inode *iget(struct super_block *sb, unsigned long ino)
{
return iget4(sb, ino, NULL, NULL);
-@@ -1494,6 +1496,7 @@
+@@ -1494,6 +1497,7 @@ extern int dcache_dir_fsync(struct file
extern int dcache_readdir(struct file *, void *, filldir_t);
extern struct file_operations dcache_dir_ops;
extern struct file_system_type *get_fs_type(const char *name);
extern struct super_block *get_super(kdev_t);
extern void drop_super(struct super_block *sb);
-diff -urN linux/kernel/ksyms.c linux-2.4.20/kernel/ksyms.c
---- linux/kernel/ksyms.c Mon Aug 18 21:55:16 2003
-+++ linux-2.4.20/kernel/ksyms.c Mon Aug 18 22:11:17 2003
-@@ -146,6 +146,7 @@
+diff -uprN linux-2.4.20/kernel/ksyms.c linux-2.4.20c/kernel/ksyms.c
+--- linux-2.4.20/kernel/ksyms.c 2003-09-03 19:01:58.000000000 +0530
++++ linux-2.4.20c/kernel/ksyms.c 2003-09-03 18:57:56.000000000 +0530
+@@ -146,6 +146,7 @@ EXPORT_SYMBOL(fget);
EXPORT_SYMBOL(igrab);
EXPORT_SYMBOL(iunique);
EXPORT_SYMBOL(iget4);
EXPORT_SYMBOL(iput);
EXPORT_SYMBOL(force_delete);
EXPORT_SYMBOL(follow_up);
-@@ -156,6 +157,7 @@
+@@ -156,6 +157,7 @@ EXPORT_SYMBOL(path_walk);
EXPORT_SYMBOL(path_release);
EXPORT_SYMBOL(__user_walk);
EXPORT_SYMBOL(lookup_one_len);
EXPORT_SYMBOL(lookup_hash);
EXPORT_SYMBOL(sys_close);
EXPORT_SYMBOL(dcache_lock);
-@@ -590,3 +592,4 @@
+@@ -590,3 +592,4 @@ EXPORT_SYMBOL(pidhash);
/* debug */
EXPORT_SYMBOL(dump_stack);