aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2009-04-18 02:04:46 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2009-06-11 21:35:59 -0400
commit55430e2ecee574e729c12d4063b3ecabfa98fa82 (patch)
tree37a243110480207785cee25940538008b3e25859 /fs
parentdd5cae6e9772ecc62fd374f7a8ec10eb51c96c4d (diff)
nfsd struct path use: exp_get_by_name()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfsd/export.c38
1 files changed, 18 insertions, 20 deletions
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index 5839b229cd0e..3f6d51b8c3ef 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -847,9 +847,8 @@ exp_get_fsid_key(svc_client *clp, int fsid)
847 return exp_find_key(clp, FSID_NUM, fsidv, NULL); 847 return exp_find_key(clp, FSID_NUM, fsidv, NULL);
848} 848}
849 849
850static svc_export *exp_get_by_name(svc_client *clp, struct vfsmount *mnt, 850static svc_export *exp_get_by_name(svc_client *clp, const struct path *path,
851 struct dentry *dentry, 851 struct cache_req *reqp)
852 struct cache_req *reqp)
853{ 852{
854 struct svc_export *exp, key; 853 struct svc_export *exp, key;
855 int err; 854 int err;
@@ -858,8 +857,7 @@ static svc_export *exp_get_by_name(svc_client *clp, struct vfsmount *mnt,
858 return ERR_PTR(-ENOENT); 857 return ERR_PTR(-ENOENT);
859 858
860 key.ex_client = clp; 859 key.ex_client = clp;
861 key.ex_path.mnt = mnt; 860 key.ex_path = *path;
862 key.ex_path.dentry = dentry;
863 861
864 exp = svc_export_lookup(&key); 862 exp = svc_export_lookup(&key);
865 if (exp == NULL) 863 if (exp == NULL)
@@ -877,20 +875,19 @@ static struct svc_export *exp_parent(svc_client *clp, struct vfsmount *mnt,
877 struct dentry *dentry, 875 struct dentry *dentry,
878 struct cache_req *reqp) 876 struct cache_req *reqp)
879{ 877{
878 struct path path = {.mnt = mnt, .dentry = dentry};
880 svc_export *exp; 879 svc_export *exp;
881 880
882 dget(dentry); 881 dget(path.dentry);
883 exp = exp_get_by_name(clp, mnt, dentry, reqp); 882 exp = exp_get_by_name(clp, &path, reqp);
884
885 while (PTR_ERR(exp) == -ENOENT && !IS_ROOT(dentry)) {
886 struct dentry *parent;
887 883
888 parent = dget_parent(dentry); 884 while (PTR_ERR(exp) == -ENOENT && !IS_ROOT(path.dentry)) {
889 dput(dentry); 885 struct dentry *parent = dget_parent(path.dentry);
890 dentry = parent; 886 dput(path.dentry);
891 exp = exp_get_by_name(clp, mnt, dentry, reqp); 887 path.dentry = parent;
888 exp = exp_get_by_name(clp, &path, reqp);
892 } 889 }
893 dput(dentry); 890 dput(path.dentry);
894 return exp; 891 return exp;
895} 892}
896 893
@@ -1018,7 +1015,7 @@ exp_export(struct nfsctl_export *nxp)
1018 goto out_put_clp; 1015 goto out_put_clp;
1019 err = -EINVAL; 1016 err = -EINVAL;
1020 1017
1021 exp = exp_get_by_name(clp, path.mnt, path.dentry, NULL); 1018 exp = exp_get_by_name(clp, &path, NULL);
1022 1019
1023 memset(&new, 0, sizeof(new)); 1020 memset(&new, 0, sizeof(new));
1024 1021
@@ -1135,7 +1132,7 @@ exp_unexport(struct nfsctl_export *nxp)
1135 goto out_domain; 1132 goto out_domain;
1136 1133
1137 err = -EINVAL; 1134 err = -EINVAL;
1138 exp = exp_get_by_name(dom, path.mnt, path.dentry, NULL); 1135 exp = exp_get_by_name(dom, &path, NULL);
1139 path_put(&path); 1136 path_put(&path);
1140 if (IS_ERR(exp)) 1137 if (IS_ERR(exp))
1141 goto out_domain; 1138 goto out_domain;
@@ -1207,7 +1204,7 @@ static struct svc_export *exp_find(struct auth_domain *clp, int fsid_type,
1207 if (IS_ERR(ek)) 1204 if (IS_ERR(ek))
1208 return ERR_CAST(ek); 1205 return ERR_CAST(ek);
1209 1206
1210 exp = exp_get_by_name(clp, ek->ek_path.mnt, ek->ek_path.dentry, reqp); 1207 exp = exp_get_by_name(clp, &ek->ek_path, reqp);
1211 cache_put(&ek->h, &svc_expkey_cache); 1208 cache_put(&ek->h, &svc_expkey_cache);
1212 1209
1213 if (IS_ERR(exp)) 1210 if (IS_ERR(exp))
@@ -1251,12 +1248,13 @@ rqst_exp_get_by_name(struct svc_rqst *rqstp, struct vfsmount *mnt,
1251 struct dentry *dentry) 1248 struct dentry *dentry)
1252{ 1249{
1253 struct svc_export *gssexp, *exp = ERR_PTR(-ENOENT); 1250 struct svc_export *gssexp, *exp = ERR_PTR(-ENOENT);
1251 struct path path = {.mnt = mnt, .dentry = dentry};
1254 1252
1255 if (rqstp->rq_client == NULL) 1253 if (rqstp->rq_client == NULL)
1256 goto gss; 1254 goto gss;
1257 1255
1258 /* First try the auth_unix client: */ 1256 /* First try the auth_unix client: */
1259 exp = exp_get_by_name(rqstp->rq_client, mnt, dentry, 1257 exp = exp_get_by_name(rqstp->rq_client, &path,
1260 &rqstp->rq_chandle); 1258 &rqstp->rq_chandle);
1261 if (PTR_ERR(exp) == -ENOENT) 1259 if (PTR_ERR(exp) == -ENOENT)
1262 goto gss; 1260 goto gss;
@@ -1269,7 +1267,7 @@ gss:
1269 /* Otherwise, try falling back on gss client */ 1267 /* Otherwise, try falling back on gss client */
1270 if (rqstp->rq_gssclient == NULL) 1268 if (rqstp->rq_gssclient == NULL)
1271 return exp; 1269 return exp;
1272 gssexp = exp_get_by_name(rqstp->rq_gssclient, mnt, dentry, 1270 gssexp = exp_get_by_name(rqstp->rq_gssclient, &path,
1273 &rqstp->rq_chandle); 1271 &rqstp->rq_chandle);
1274 if (PTR_ERR(gssexp) == -ENOENT) 1272 if (PTR_ERR(gssexp) == -ENOENT)
1275 return exp; 1273 return exp;