aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/export.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2008-08-02 01:03:36 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2008-10-23 05:12:51 -0400
commita63bb99660d82dfe7c51588e1f9aadefb756ba51 (patch)
tree25417bd44a2646ecc2d314450afb13be9550d339 /fs/nfsd/export.c
parentc1a2a4756df01d72b6f7a0563218b23b63a6d4ed (diff)
[PATCH] switch nfsd to kern_path()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/nfsd/export.c')
-rw-r--r--fs/nfsd/export.c48
1 files changed, 23 insertions, 25 deletions
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index 2fa61f003fff..676201dbdf84 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -162,20 +162,18 @@ static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen)
162 cache_put(&ek->h, &svc_expkey_cache); 162 cache_put(&ek->h, &svc_expkey_cache);
163 else err = -ENOMEM; 163 else err = -ENOMEM;
164 } else { 164 } else {
165 struct nameidata nd; 165 err = kern_path(buf, 0, &key.ek_path);
166 err = path_lookup(buf, 0, &nd);
167 if (err) 166 if (err)
168 goto out; 167 goto out;
169 168
170 dprintk("Found the path %s\n", buf); 169 dprintk("Found the path %s\n", buf);
171 key.ek_path = nd.path;
172 170
173 ek = svc_expkey_update(&key, ek); 171 ek = svc_expkey_update(&key, ek);
174 if (ek) 172 if (ek)
175 cache_put(&ek->h, &svc_expkey_cache); 173 cache_put(&ek->h, &svc_expkey_cache);
176 else 174 else
177 err = -ENOMEM; 175 err = -ENOMEM;
178 path_put(&nd.path); 176 path_put(&key.ek_path);
179 } 177 }
180 cache_flush(); 178 cache_flush();
181 out: 179 out:
@@ -991,7 +989,7 @@ exp_export(struct nfsctl_export *nxp)
991 struct svc_export *exp = NULL; 989 struct svc_export *exp = NULL;
992 struct svc_export new; 990 struct svc_export new;
993 struct svc_expkey *fsid_key = NULL; 991 struct svc_expkey *fsid_key = NULL;
994 struct nameidata nd; 992 struct path path;
995 int err; 993 int err;
996 994
997 /* Consistency check */ 995 /* Consistency check */
@@ -1014,12 +1012,12 @@ exp_export(struct nfsctl_export *nxp)
1014 1012
1015 1013
1016 /* Look up the dentry */ 1014 /* Look up the dentry */
1017 err = path_lookup(nxp->ex_path, 0, &nd); 1015 err = kern_path(nxp->ex_path, 0, &path);
1018 if (err) 1016 if (err)
1019 goto out_put_clp; 1017 goto out_put_clp;
1020 err = -EINVAL; 1018 err = -EINVAL;
1021 1019
1022 exp = exp_get_by_name(clp, nd.path.mnt, nd.path.dentry, NULL); 1020 exp = exp_get_by_name(clp, path.mnt, path.dentry, NULL);
1023 1021
1024 memset(&new, 0, sizeof(new)); 1022 memset(&new, 0, sizeof(new));
1025 1023
@@ -1027,8 +1025,8 @@ exp_export(struct nfsctl_export *nxp)
1027 if ((nxp->ex_flags & NFSEXP_FSID) && 1025 if ((nxp->ex_flags & NFSEXP_FSID) &&
1028 (!IS_ERR(fsid_key = exp_get_fsid_key(clp, nxp->ex_dev))) && 1026 (!IS_ERR(fsid_key = exp_get_fsid_key(clp, nxp->ex_dev))) &&
1029 fsid_key->ek_path.mnt && 1027 fsid_key->ek_path.mnt &&
1030 (fsid_key->ek_path.mnt != nd.path.mnt || 1028 (fsid_key->ek_path.mnt != path.mnt ||
1031 fsid_key->ek_path.dentry != nd.path.dentry)) 1029 fsid_key->ek_path.dentry != path.dentry))
1032 goto finish; 1030 goto finish;
1033 1031
1034 if (!IS_ERR(exp)) { 1032 if (!IS_ERR(exp)) {
@@ -1044,7 +1042,7 @@ exp_export(struct nfsctl_export *nxp)
1044 goto finish; 1042 goto finish;
1045 } 1043 }
1046 1044
1047 err = check_export(nd.path.dentry->d_inode, nxp->ex_flags, NULL); 1045 err = check_export(path.dentry->d_inode, nxp->ex_flags, NULL);
1048 if (err) goto finish; 1046 if (err) goto finish;
1049 1047
1050 err = -ENOMEM; 1048 err = -ENOMEM;
@@ -1057,7 +1055,7 @@ exp_export(struct nfsctl_export *nxp)
1057 if (!new.ex_pathname) 1055 if (!new.ex_pathname)
1058 goto finish; 1056 goto finish;
1059 new.ex_client = clp; 1057 new.ex_client = clp;
1060 new.ex_path = nd.path; 1058 new.ex_path = path;
1061 new.ex_flags = nxp->ex_flags; 1059 new.ex_flags = nxp->ex_flags;
1062 new.ex_anon_uid = nxp->ex_anon_uid; 1060 new.ex_anon_uid = nxp->ex_anon_uid;
1063 new.ex_anon_gid = nxp->ex_anon_gid; 1061 new.ex_anon_gid = nxp->ex_anon_gid;
@@ -1083,7 +1081,7 @@ finish:
1083 exp_put(exp); 1081 exp_put(exp);
1084 if (fsid_key && !IS_ERR(fsid_key)) 1082 if (fsid_key && !IS_ERR(fsid_key))
1085 cache_put(&fsid_key->h, &svc_expkey_cache); 1083 cache_put(&fsid_key->h, &svc_expkey_cache);
1086 path_put(&nd.path); 1084 path_put(&path);
1087out_put_clp: 1085out_put_clp:
1088 auth_domain_put(clp); 1086 auth_domain_put(clp);
1089out_unlock: 1087out_unlock:
@@ -1114,7 +1112,7 @@ exp_unexport(struct nfsctl_export *nxp)
1114{ 1112{
1115 struct auth_domain *dom; 1113 struct auth_domain *dom;
1116 svc_export *exp; 1114 svc_export *exp;
1117 struct nameidata nd; 1115 struct path path;
1118 int err; 1116 int err;
1119 1117
1120 /* Consistency check */ 1118 /* Consistency check */
@@ -1131,13 +1129,13 @@ exp_unexport(struct nfsctl_export *nxp)
1131 goto out_unlock; 1129 goto out_unlock;
1132 } 1130 }
1133 1131
1134 err = path_lookup(nxp->ex_path, 0, &nd); 1132 err = kern_path(nxp->ex_path, 0, &path);
1135 if (err) 1133 if (err)
1136 goto out_domain; 1134 goto out_domain;
1137 1135
1138 err = -EINVAL; 1136 err = -EINVAL;
1139 exp = exp_get_by_name(dom, nd.path.mnt, nd.path.dentry, NULL); 1137 exp = exp_get_by_name(dom, path.mnt, path.dentry, NULL);
1140 path_put(&nd.path); 1138 path_put(&path);
1141 if (IS_ERR(exp)) 1139 if (IS_ERR(exp))
1142 goto out_domain; 1140 goto out_domain;
1143 1141
@@ -1159,26 +1157,26 @@ out_unlock:
1159 * since its harder to fool a kernel module than a user space program. 1157 * since its harder to fool a kernel module than a user space program.
1160 */ 1158 */
1161int 1159int
1162exp_rootfh(svc_client *clp, char *path, struct knfsd_fh *f, int maxsize) 1160exp_rootfh(svc_client *clp, char *name, struct knfsd_fh *f, int maxsize)
1163{ 1161{
1164 struct svc_export *exp; 1162 struct svc_export *exp;
1165 struct nameidata nd; 1163 struct path path;
1166 struct inode *inode; 1164 struct inode *inode;
1167 struct svc_fh fh; 1165 struct svc_fh fh;
1168 int err; 1166 int err;
1169 1167
1170 err = -EPERM; 1168 err = -EPERM;
1171 /* NB: we probably ought to check that it's NUL-terminated */ 1169 /* NB: we probably ought to check that it's NUL-terminated */
1172 if (path_lookup(path, 0, &nd)) { 1170 if (kern_path(name, 0, &path)) {
1173 printk("nfsd: exp_rootfh path not found %s", path); 1171 printk("nfsd: exp_rootfh path not found %s", name);
1174 return err; 1172 return err;
1175 } 1173 }
1176 inode = nd.path.dentry->d_inode; 1174 inode = path.dentry->d_inode;
1177 1175
1178 dprintk("nfsd: exp_rootfh(%s [%p] %s:%s/%ld)\n", 1176 dprintk("nfsd: exp_rootfh(%s [%p] %s:%s/%ld)\n",
1179 path, nd.path.dentry, clp->name, 1177 name, path.dentry, clp->name,
1180 inode->i_sb->s_id, inode->i_ino); 1178 inode->i_sb->s_id, inode->i_ino);
1181 exp = exp_parent(clp, nd.path.mnt, nd.path.dentry, NULL); 1179 exp = exp_parent(clp, path.mnt, path.dentry, NULL);
1182 if (IS_ERR(exp)) { 1180 if (IS_ERR(exp)) {
1183 err = PTR_ERR(exp); 1181 err = PTR_ERR(exp);
1184 goto out; 1182 goto out;
@@ -1188,7 +1186,7 @@ exp_rootfh(svc_client *clp, char *path, struct knfsd_fh *f, int maxsize)
1188 * fh must be initialized before calling fh_compose 1186 * fh must be initialized before calling fh_compose
1189 */ 1187 */
1190 fh_init(&fh, maxsize); 1188 fh_init(&fh, maxsize);
1191 if (fh_compose(&fh, exp, nd.path.dentry, NULL)) 1189 if (fh_compose(&fh, exp, path.dentry, NULL))
1192 err = -EINVAL; 1190 err = -EINVAL;
1193 else 1191 else
1194 err = 0; 1192 err = 0;
@@ -1196,7 +1194,7 @@ exp_rootfh(svc_client *clp, char *path, struct knfsd_fh *f, int maxsize)
1196 fh_put(&fh); 1194 fh_put(&fh);
1197 exp_put(exp); 1195 exp_put(exp);
1198out: 1196out:
1199 path_put(&nd.path); 1197 path_put(&path);
1200 return err; 1198 return err;
1201} 1199}
1202 1200