Commit 82ead7fe authored by J. Bruce Fields's avatar J. Bruce Fields

nfsd: filter lookup results in V4ROOT case

We treat every object as a mountpoint and pretend it doesn't exist if
it isn't exported.
Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
parent 3b6cee7b
...@@ -166,6 +166,19 @@ static int nfsd_lookup_parent(struct svc_rqst *rqstp, struct dentry *dparent, st ...@@ -166,6 +166,19 @@ static int nfsd_lookup_parent(struct svc_rqst *rqstp, struct dentry *dparent, st
return 0; return 0;
} }
/*
* For nfsd purposes, we treat V4ROOT exports as though there was an
* export at *every* directory.
*/
static int nfsd_mountpoint(struct dentry *dentry, struct svc_export *exp)
{
if (d_mountpoint(dentry))
return 1;
if (!(exp->ex_flags & NFSEXP_V4ROOT))
return 0;
return dentry->d_inode != NULL;
}
__be32 __be32
nfsd_lookup_dentry(struct svc_rqst *rqstp, struct svc_fh *fhp, nfsd_lookup_dentry(struct svc_rqst *rqstp, struct svc_fh *fhp,
const char *name, unsigned int len, const char *name, unsigned int len,
...@@ -211,7 +224,7 @@ nfsd_lookup_dentry(struct svc_rqst *rqstp, struct svc_fh *fhp, ...@@ -211,7 +224,7 @@ nfsd_lookup_dentry(struct svc_rqst *rqstp, struct svc_fh *fhp,
/* /*
* check if we have crossed a mount point ... * check if we have crossed a mount point ...
*/ */
if (d_mountpoint(dentry)) { if (nfsd_mountpoint(dentry, exp)) {
if ((host_err = nfsd_cross_mnt(rqstp, &dentry, &exp))) { if ((host_err = nfsd_cross_mnt(rqstp, &dentry, &exp))) {
dput(dentry); dput(dentry);
goto out_nfserr; goto out_nfserr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment