Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 309797
b: refs/heads/master
c: 2a75cfa
h: refs/heads/master
i:
  309795: 0afb8c8
v: v3
  • Loading branch information
Stanislav Kinsbursky authored and J. Bruce Fields committed Apr 12, 2012
1 parent f3980ae commit 6d19896
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b89109bef4a6a4a8ab5788778ee0addca0787870
refs/heads/master: 2a75cfa64e63502e54e40f99ba07411544bd3190
37 changes: 22 additions & 15 deletions trunk/fs/nfsd/export.c
Original file line number Diff line number Diff line change
Expand Up @@ -785,8 +785,8 @@ exp_find_key(struct cache_detail *cd, svc_client *clp, int fsid_type,
}


static svc_export *exp_get_by_name(svc_client *clp, const struct path *path,
struct cache_req *reqp)
static svc_export *exp_get_by_name(struct cache_detail *cd, svc_client *clp,
const struct path *path, struct cache_req *reqp)
{
struct svc_export *exp, key;
int err;
Expand All @@ -796,12 +796,12 @@ static svc_export *exp_get_by_name(svc_client *clp, const struct path *path,

key.ex_client = clp;
key.ex_path = *path;
key.cd = &svc_export_cache;
key.cd = cd;

exp = svc_export_lookup(&key);
if (exp == NULL)
return ERR_PTR(-ENOMEM);
err = cache_check(&svc_export_cache, &exp->h, reqp);
err = cache_check(cd, &exp->h, reqp);
if (err)
return ERR_PTR(err);
return exp;
Expand All @@ -810,16 +810,17 @@ static svc_export *exp_get_by_name(svc_client *clp, const struct path *path,
/*
* Find the export entry for a given dentry.
*/
static struct svc_export *exp_parent(svc_client *clp, struct path *path)
static struct svc_export *exp_parent(struct cache_detail *cd, svc_client *clp,
struct path *path)
{
struct dentry *saved = dget(path->dentry);
svc_export *exp = exp_get_by_name(clp, path, NULL);
svc_export *exp = exp_get_by_name(cd, clp, path, NULL);

while (PTR_ERR(exp) == -ENOENT && !IS_ROOT(path->dentry)) {
struct dentry *parent = dget_parent(path->dentry);
dput(path->dentry);
path->dentry = parent;
exp = exp_get_by_name(clp, path, NULL);
exp = exp_get_by_name(cd, clp, path, NULL);
}
dput(path->dentry);
path->dentry = saved;
Expand All @@ -834,13 +835,15 @@ static struct svc_export *exp_parent(svc_client *clp, struct path *path)
* since its harder to fool a kernel module than a user space program.
*/
int
exp_rootfh(svc_client *clp, char *name, struct knfsd_fh *f, int maxsize)
exp_rootfh(svc_client *clp, char *name,
struct knfsd_fh *f, int maxsize)
{
struct svc_export *exp;
struct path path;
struct inode *inode;
struct svc_fh fh;
int err;
struct cache_detail *cd = &svc_export_cache;

err = -EPERM;
/* NB: we probably ought to check that it's NUL-terminated */
Expand All @@ -853,7 +856,7 @@ exp_rootfh(svc_client *clp, char *name, struct knfsd_fh *f, int maxsize)
dprintk("nfsd: exp_rootfh(%s [%p] %s:%s/%ld)\n",
name, path.dentry, clp->name,
inode->i_sb->s_id, inode->i_ino);
exp = exp_parent(clp, &path);
exp = exp_parent(cd, clp, &path);
if (IS_ERR(exp)) {
err = PTR_ERR(exp);
goto out;
Expand All @@ -875,15 +878,16 @@ exp_rootfh(svc_client *clp, char *name, struct knfsd_fh *f, int maxsize)
return err;
}

static struct svc_export *exp_find(struct auth_domain *clp, int fsid_type,
static struct svc_export *exp_find(struct cache_detail *cd,
struct auth_domain *clp, int fsid_type,
u32 *fsidv, struct cache_req *reqp)
{
struct svc_export *exp;
struct svc_expkey *ek = exp_find_key(&svc_expkey_cache, clp, fsid_type, fsidv, reqp);
if (IS_ERR(ek))
return ERR_CAST(ek);

exp = exp_get_by_name(clp, &ek->ek_path, reqp);
exp = exp_get_by_name(cd, clp, &ek->ek_path, reqp);
cache_put(&ek->h, &svc_expkey_cache);

if (IS_ERR(exp))
Expand Down Expand Up @@ -926,12 +930,13 @@ struct svc_export *
rqst_exp_get_by_name(struct svc_rqst *rqstp, struct path *path)
{
struct svc_export *gssexp, *exp = ERR_PTR(-ENOENT);
struct cache_detail *cd = &svc_export_cache;

if (rqstp->rq_client == NULL)
goto gss;

/* First try the auth_unix client: */
exp = exp_get_by_name(rqstp->rq_client, path, &rqstp->rq_chandle);
exp = exp_get_by_name(cd, rqstp->rq_client, path, &rqstp->rq_chandle);
if (PTR_ERR(exp) == -ENOENT)
goto gss;
if (IS_ERR(exp))
Expand All @@ -943,7 +948,7 @@ rqst_exp_get_by_name(struct svc_rqst *rqstp, struct path *path)
/* Otherwise, try falling back on gss client */
if (rqstp->rq_gssclient == NULL)
return exp;
gssexp = exp_get_by_name(rqstp->rq_gssclient, path, &rqstp->rq_chandle);
gssexp = exp_get_by_name(cd, rqstp->rq_gssclient, path, &rqstp->rq_chandle);
if (PTR_ERR(gssexp) == -ENOENT)
return exp;
if (!IS_ERR(exp))
Expand All @@ -955,12 +960,14 @@ struct svc_export *
rqst_exp_find(struct svc_rqst *rqstp, int fsid_type, u32 *fsidv)
{
struct svc_export *gssexp, *exp = ERR_PTR(-ENOENT);
struct cache_detail *cd = &svc_export_cache;

if (rqstp->rq_client == NULL)
goto gss;

/* First try the auth_unix client: */
exp = exp_find(rqstp->rq_client, fsid_type, fsidv, &rqstp->rq_chandle);
exp = exp_find(cd, rqstp->rq_client, fsid_type,
fsidv, &rqstp->rq_chandle);
if (PTR_ERR(exp) == -ENOENT)
goto gss;
if (IS_ERR(exp))
Expand All @@ -972,7 +979,7 @@ rqst_exp_find(struct svc_rqst *rqstp, int fsid_type, u32 *fsidv)
/* Otherwise, try falling back on gss client */
if (rqstp->rq_gssclient == NULL)
return exp;
gssexp = exp_find(rqstp->rq_gssclient, fsid_type, fsidv,
gssexp = exp_find(cd, rqstp->rq_gssclient, fsid_type, fsidv,
&rqstp->rq_chandle);
if (PTR_ERR(gssexp) == -ENOENT)
return exp;
Expand Down

0 comments on commit 6d19896

Please sign in to comment.