summaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-04-28 01:09:25 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-04-28 01:09:25 +0000
commitb9ba7aeb165cffecdffb60aec8c3fa8d590d9ca9 (patch)
tree42d07b0c7246ae2536a702e7c5de9e2732341116 /fs/nfsd
parent7406b0a326f2d70ade2671c37d1beef62249db97 (diff)
Merge with 2.3.99-pre6.
Diffstat (limited to 'fs/nfsd')
-rw-r--r--fs/nfsd/export.c79
-rw-r--r--fs/nfsd/nfs3xdr.c2
-rw-r--r--fs/nfsd/nfsproc.c2
-rw-r--r--fs/nfsd/vfs.c17
4 files changed, 22 insertions, 78 deletions
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index 53bfa0bea..6e98c1523 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -103,23 +103,6 @@ out:
return exp;
}
-
-/*
- * Look up the device of the parent fs.
- */
-static inline int
-nfsd_parentdev(kdev_t *devp)
-{
- struct super_block *sb;
-
- if (!(sb = get_super(*devp)) || !sb->s_root->d_covers)
- return 0;
- if (*devp == sb->s_root->d_covers->d_inode->i_dev)
- return 0;
- *devp = sb->s_root->d_covers->d_inode->i_dev;
- return 1;
-}
-
/*
* Find the export entry for a given dentry. <gam3@acm.org>
*/
@@ -127,36 +110,13 @@ static svc_export *
exp_parent(svc_client *clp, kdev_t dev, struct dentry *dentry)
{
svc_export *exp;
- kdev_t xdev = dev;
- struct dentry *xdentry = dentry;
- struct dentry *ndentry = NULL;
- if (clp == NULL || dentry == NULL)
+ if (clp == NULL)
return NULL;
- do {
- xdev = dev;
- do {
- exp = clp->cl_export[EXPORT_HASH(xdev)];
- if (exp)
- do {
- ndentry = exp->ex_dentry;
- if (ndentry == xdentry) {
-#ifdef NFSD_PARANOIA
-if (dev == xdev)
- dprintk("nfsd: exp_parent submount over mount.\n");
-else
- dprintk("nfsd: exp_parent found.\n");
-#endif
- goto out;
- }
- } while (NULL != (exp = exp->ex_next));
- } while (nfsd_parentdev(&xdev));
- if (IS_ROOT(xdentry))
+ for (exp = clp->cl_export[EXPORT_HASH(dev)]; exp; exp = exp->ex_next)
+ if (is_subdir(dentry, exp->ex_dentry))
break;
- } while ((xdentry = xdentry->d_parent));
- exp = NULL;
-out:
return exp;
}
@@ -169,30 +129,15 @@ static svc_export *
exp_child(svc_client *clp, kdev_t dev, struct dentry *dentry)
{
svc_export *exp;
- struct dentry *xdentry = dentry;
- struct dentry *ndentry = NULL;
- if (clp == NULL || dentry == NULL)
+ if (clp == NULL)
return NULL;
- exp = clp->cl_export[EXPORT_HASH(dev)];
- if (exp)
- do {
- ndentry = exp->ex_dentry;
- if (ndentry)
- while ((ndentry = ndentry->d_parent)) {
- if (ndentry == xdentry) {
-#ifdef NFSD_PARANOIA
-dprintk("nfsd: exp_child mount under submount.\n");
-#endif
- goto out;
- }
- if (IS_ROOT(ndentry))
- break;
- }
- } while (NULL != (exp = exp->ex_next));
- exp = NULL;
-out:
+ for (exp = clp->cl_export[EXPORT_HASH(dev)]; exp; exp = exp->ex_next) {
+ struct dentry *ndentry = exp->ex_dentry;
+ if (ndentry && is_subdir(ndentry->d_parent, dentry))
+ break;
+ }
return exp;
}
@@ -279,10 +224,8 @@ exp_export(struct nfsctl_export *nxp)
}
/* Is this is a sub-export, must be a proper subset of FS */
if ((parent = exp_parent(clp, dev, dentry)) != NULL) {
- if (dev == parent->ex_dev) {
- dprintk("exp_export: sub-export not valid (Rule 2).\n");
- goto finish;
- }
+ dprintk("exp_export: sub-export not valid (Rule 2).\n");
+ goto finish;
}
err = -ENOMEM;
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
index 61ee94a3e..97acf317e 100644
--- a/fs/nfsd/nfs3xdr.c
+++ b/fs/nfsd/nfs3xdr.c
@@ -731,7 +731,7 @@ encode_entry(struct readdir_cd *cd, const char *name,
dchild = dchild->d_parent;
dchild = dget(dchild);
} else
- dchild = lookup_one(name, dget(dparent));
+ dchild = lookup_one(name, dparent);
if (IS_ERR(dchild))
goto noexec;
if (fh_compose(&fh, exp, dchild) != 0 || !dchild->d_inode)
diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c
index 5c312b906..763970736 100644
--- a/fs/nfsd/nfsproc.c
+++ b/fs/nfsd/nfsproc.c
@@ -222,7 +222,7 @@ nfsd_proc_create(struct svc_rqst *rqstp, struct nfsd_createargs *argp,
if (isdotent(argp->name, argp->len))
goto done;
fh_lock(dirfhp);
- dchild = lookup_one(argp->name, dget(dirfhp->fh_dentry));
+ dchild = lookup_one(argp->name, dirfhp->fh_dentry);
if (IS_ERR(dchild)) {
nfserr = nfserrno(PTR_ERR(dchild));
goto out_unlock;
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 56da94aea..cb6134ca1 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -139,7 +139,8 @@ nfsd_lookup(struct svc_rqst *rqstp, struct svc_fh *fhp, const char *name,
} else {
nd.mnt = NULL;
nd.dentry = dget(dparent);
- err = walk_name(name, 0, &nd);
+ nd.flags = 0;
+ err = walk_name(name, &nd);
if (err)
goto out_nfserr;
/*
@@ -838,7 +839,7 @@ nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
if (!resfhp->fh_dverified) {
/* called from nfsd_proc_mkdir, or possibly nfsd3_proc_create */
fh_lock(fhp);
- dchild = lookup_one(fname, dget(dentry));
+ dchild = lookup_one(fname, dentry);
err = PTR_ERR(dchild);
if (IS_ERR(dchild))
goto out_nfserr;
@@ -961,7 +962,7 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
/*
* Compose the response file handle.
*/
- dchild = lookup_one(fname, dget(dentry));
+ dchild = lookup_one(fname, dentry);
err = PTR_ERR(dchild);
if(IS_ERR(dchild))
goto out_nfserr;
@@ -1108,7 +1109,7 @@ nfsd_symlink(struct svc_rqst *rqstp, struct svc_fh *fhp,
goto out;
fh_lock(fhp);
dentry = fhp->fh_dentry;
- dnew = lookup_one(fname, dget(dentry));
+ dnew = lookup_one(fname, dentry);
err = PTR_ERR(dnew);
if (IS_ERR(dnew))
goto out_nfserr;
@@ -1173,7 +1174,7 @@ nfsd_link(struct svc_rqst *rqstp, struct svc_fh *ffhp,
ddir = ffhp->fh_dentry;
dirp = ddir->d_inode;
- dnew = lookup_one(fname, dget(ddir));
+ dnew = lookup_one(fname, ddir);
err = PTR_ERR(dnew);
if (IS_ERR(dnew))
goto out_nfserr;
@@ -1238,7 +1239,7 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen,
goto out;
double_down(&tdir->i_sem, &fdir->i_sem);
- odentry = lookup_one(fname, dget(fdentry));
+ odentry = lookup_one(fname, fdentry);
err = PTR_ERR(odentry);
if (IS_ERR(odentry))
goto out_nfserr;
@@ -1247,7 +1248,7 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen,
if (!odentry->d_inode)
goto out_dput_old;
- ndentry = lookup_one(tname, dget(tdentry));
+ ndentry = lookup_one(tname, tdentry);
err = PTR_ERR(ndentry);
if (IS_ERR(ndentry))
goto out_dput_old;
@@ -1310,7 +1311,7 @@ nfsd_unlink(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
dentry = fhp->fh_dentry;
dirp = dentry->d_inode;
- rdentry = lookup_one(fname, dget(dentry));
+ rdentry = lookup_one(fname, dentry);
err = PTR_ERR(rdentry);
if (IS_ERR(rdentry))
goto out_nfserr;