Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 24263
b: refs/heads/master
c: eab7e2e
h: refs/heads/master
i:
  24261: f692323
  24259: 2cd465b
  24255: 305b267
v: v3
  • Loading branch information
NeilBrown authored and Linus Torvalds committed Mar 27, 2006
1 parent c05a20d commit ba5fcf7
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 37 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: efc36aa5608f5717338747e152c23f2cfdb14697
refs/heads/master: eab7e2e647c348b418e8715ecaca0177e1b473c7
60 changes: 40 additions & 20 deletions trunk/fs/nfsd/export.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,10 @@ void expkey_put(struct cache_head *item, struct cache_detail *cd)
if (cache_put(item, cd)) {
struct svc_expkey *key = container_of(item, struct svc_expkey, h);
if (test_bit(CACHE_VALID, &item->flags) &&
!test_bit(CACHE_NEGATIVE, &item->flags))
exp_put(key->ek_export);
!test_bit(CACHE_NEGATIVE, &item->flags)) {
dput(key->ek_dentry);
mntput(key->ek_mnt);
}
auth_domain_put(key->ek_client);
kfree(key);
}
Expand Down Expand Up @@ -164,26 +166,18 @@ static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen)
} else {
struct nameidata nd;
struct svc_expkey *ek;
struct svc_export *exp;
err = path_lookup(buf, 0, &nd);
if (err)
goto out;

dprintk("Found the path %s\n", buf);
exp = exp_get_by_name(dom, nd.mnt, nd.dentry, NULL);

err = -ENOENT;
if (!exp)
goto out_nd;
key.ek_export = exp;
dprintk("And found export\n");
key.ek_mnt = nd.mnt;
key.ek_dentry = nd.dentry;

ek = svc_expkey_lookup(&key, 1);
if (ek)
expkey_put(&ek->h, &svc_expkey_cache);
exp_put(exp);
err = 0;
out_nd:
path_release(&nd);
}
cache_flush();
Expand Down Expand Up @@ -214,7 +208,7 @@ static int expkey_show(struct seq_file *m,
if (test_bit(CACHE_VALID, &h->flags) &&
!test_bit(CACHE_NEGATIVE, &h->flags)) {
seq_printf(m, " ");
seq_path(m, ek->ek_export->ex_mnt, ek->ek_export->ex_dentry, "\\ \t\n");
seq_path(m, ek->ek_mnt, ek->ek_dentry, "\\ \t\n");
}
seq_printf(m, "\n");
return 0;
Expand Down Expand Up @@ -252,8 +246,8 @@ static inline void svc_expkey_init(struct svc_expkey *new, struct svc_expkey *it

static inline void svc_expkey_update(struct svc_expkey *new, struct svc_expkey *item)
{
cache_get(&item->ek_export->h);
new->ek_export = item->ek_export;
new->ek_mnt = mntget(item->ek_mnt);
new->ek_dentry = dget(item->ek_dentry);
}

static DefineSimpleCacheLookup(svc_expkey,0) /* no inplace updates */
Expand Down Expand Up @@ -519,7 +513,8 @@ static int exp_set_key(svc_client *clp, int fsid_type, u32 *fsidv,
key.ek_client = clp;
key.ek_fsidtype = fsid_type;
memcpy(key.ek_fsid, fsidv, key_len(fsid_type));
key.ek_export = exp;
key.ek_mnt = exp->ex_mnt;
key.ek_dentry = exp->ex_dentry;
key.h.expiry_time = NEVER;
key.h.flags = 0;

Expand Down Expand Up @@ -741,8 +736,8 @@ exp_export(struct nfsctl_export *nxp)
if ((nxp->ex_flags & NFSEXP_FSID) &&
(fsid_key = exp_get_fsid_key(clp, nxp->ex_dev)) &&
!IS_ERR(fsid_key) &&
fsid_key->ek_export &&
fsid_key->ek_export != exp)
fsid_key->ek_mnt &&
(fsid_key->ek_mnt != nd.mnt || fsid_key->ek_dentry != nd.dentry) )
goto finish;

if (exp) {
Expand Down Expand Up @@ -912,6 +907,24 @@ exp_rootfh(svc_client *clp, char *path, struct knfsd_fh *f, int maxsize)
return err;
}

struct svc_export *
exp_find(struct auth_domain *clp, int fsid_type, u32 *fsidv,
struct cache_req *reqp)
{
struct svc_export *exp;
struct svc_expkey *ek = exp_find_key(clp, fsid_type, fsidv, reqp);
if (!ek || IS_ERR(ek))
return ERR_PTR(PTR_ERR(ek));

exp = exp_get_by_name(clp, ek->ek_mnt, ek->ek_dentry, reqp);
expkey_put(&ek->h, &svc_expkey_cache);

if (!exp || IS_ERR(exp))
return ERR_PTR(PTR_ERR(exp));
return exp;
}


/*
* Called when we need the filehandle for the root of the pseudofs,
* for a given NFSv4 client. The root is defined to be the
Expand All @@ -922,6 +935,7 @@ exp_pseudoroot(struct auth_domain *clp, struct svc_fh *fhp,
struct cache_req *creq)
{
struct svc_expkey *fsid_key;
struct svc_export *exp;
int rv;
u32 fsidv[2];

Expand All @@ -933,8 +947,14 @@ exp_pseudoroot(struct auth_domain *clp, struct svc_fh *fhp,
if (!fsid_key || IS_ERR(fsid_key))
return nfserr_perm;

rv = fh_compose(fhp, fsid_key->ek_export,
fsid_key->ek_export->ex_dentry, NULL);
exp = exp_get_by_name(clp, fsid_key->ek_mnt, fsid_key->ek_dentry, creq);
if (exp == NULL)
rv = nfserr_perm;
else if (IS_ERR(exp))
rv = nfserrno(PTR_ERR(exp));
else
rv = fh_compose(fhp, exp,
fsid_key->ek_dentry, NULL);
expkey_put(&fsid_key->h, &svc_expkey_cache);
return rv;
}
Expand Down
20 changes: 4 additions & 16 deletions trunk/include/linux/nfsd/export.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ struct svc_expkey {
int ek_fsidtype;
u32 ek_fsid[3];

struct svc_export * ek_export;
struct vfsmount * ek_mnt;
struct dentry * ek_dentry;
};

#define EX_SECURE(exp) (!((exp)->ex_flags & NFSEXP_INSECURE_PORT))
Expand Down Expand Up @@ -114,22 +115,9 @@ static inline void exp_get(struct svc_export *exp)
{
cache_get(&exp->h);
}
static inline struct svc_export *
extern struct svc_export *
exp_find(struct auth_domain *clp, int fsid_type, u32 *fsidv,
struct cache_req *reqp)
{
struct svc_expkey *ek = exp_find_key(clp, fsid_type, fsidv, reqp);
if (ek && !IS_ERR(ek)) {
struct svc_export *exp = ek->ek_export;
int err;
exp_get(exp);
expkey_put(&ek->h, &svc_expkey_cache);
if ((err = cache_check(&svc_export_cache, &exp->h, reqp)))
exp = ERR_PTR(err);
return exp;
} else
return ERR_PTR(PTR_ERR(ek));
}
struct cache_req *reqp);

#endif /* __KERNEL__ */

Expand Down

0 comments on commit ba5fcf7

Please sign in to comment.