Commit e64c390ca0b60fd2119331ef1fa888d7ea27e424
1 parent
91c9fa8f75
Exists in
master
and in
39 other branches
switch rqst_exp_parent()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Showing 3 changed files with 23 additions and 28 deletions Side-by-side Diff
fs/nfsd/export.c
... | ... | @@ -1299,24 +1299,19 @@ |
1299 | 1299 | } |
1300 | 1300 | |
1301 | 1301 | struct svc_export * |
1302 | -rqst_exp_parent(struct svc_rqst *rqstp, struct vfsmount *mnt, | |
1303 | - struct dentry *dentry) | |
1302 | +rqst_exp_parent(struct svc_rqst *rqstp, struct path *path) | |
1304 | 1303 | { |
1305 | - struct svc_export *exp; | |
1306 | - struct path path = {.mnt = mnt, .dentry = dentry}; | |
1304 | + struct dentry *saved = dget(path->dentry); | |
1305 | + struct svc_export *exp = rqst_exp_get_by_name(rqstp, path); | |
1307 | 1306 | |
1308 | - dget(dentry); | |
1309 | - exp = rqst_exp_get_by_name(rqstp, &path); | |
1310 | - | |
1311 | - while (PTR_ERR(exp) == -ENOENT && !IS_ROOT(dentry)) { | |
1312 | - struct dentry *parent; | |
1313 | - | |
1314 | - parent = dget_parent(dentry); | |
1315 | - dput(dentry); | |
1316 | - dentry = parent; | |
1317 | - exp = rqst_exp_get_by_name(rqstp, &path); | |
1307 | + while (PTR_ERR(exp) == -ENOENT && !IS_ROOT(path->dentry)) { | |
1308 | + struct dentry *parent = dget_parent(path->dentry); | |
1309 | + dput(path->dentry); | |
1310 | + path->dentry = parent; | |
1311 | + exp = rqst_exp_get_by_name(rqstp, path); | |
1318 | 1312 | } |
1319 | - dput(dentry); | |
1313 | + dput(path->dentry); | |
1314 | + path->dentry = saved; | |
1320 | 1315 | return exp; |
1321 | 1316 | } |
1322 | 1317 |
fs/nfsd/vfs.c
... | ... | @@ -169,28 +169,29 @@ |
169 | 169 | /* checking mountpoint crossing is very different when stepping up */ |
170 | 170 | struct svc_export *exp2 = NULL; |
171 | 171 | struct dentry *dp; |
172 | - struct vfsmount *mnt = mntget(exp->ex_path.mnt); | |
173 | - dentry = dget(dparent); | |
174 | - while(dentry == mnt->mnt_root && follow_up(&mnt, &dentry)) | |
172 | + struct path path = {.mnt = mntget(exp->ex_path.mnt), | |
173 | + .dentry = dget(dparent)}; | |
174 | + | |
175 | + while (path.dentry == path.mnt->mnt_root && | |
176 | + follow_up(&path.mnt, &path.dentry)) | |
175 | 177 | ; |
176 | - dp = dget_parent(dentry); | |
177 | - dput(dentry); | |
178 | - dentry = dp; | |
178 | + dp = dget_parent(path.dentry); | |
179 | + dput(path.dentry); | |
180 | + path.dentry = dp; | |
179 | 181 | |
180 | - exp2 = rqst_exp_parent(rqstp, mnt, dentry); | |
182 | + exp2 = rqst_exp_parent(rqstp, &path); | |
181 | 183 | if (PTR_ERR(exp2) == -ENOENT) { |
182 | - dput(dentry); | |
183 | 184 | dentry = dget(dparent); |
184 | 185 | } else if (IS_ERR(exp2)) { |
185 | 186 | host_err = PTR_ERR(exp2); |
186 | - dput(dentry); | |
187 | - mntput(mnt); | |
187 | + path_put(&path); | |
188 | 188 | goto out_nfserr; |
189 | 189 | } else { |
190 | + dentry = dget(path.dentry); | |
190 | 191 | exp_put(exp); |
191 | 192 | exp = exp2; |
192 | 193 | } |
193 | - mntput(mnt); | |
194 | + path_put(&path); | |
194 | 195 | } |
195 | 196 | } else { |
196 | 197 | fh_lock(fhp); |
include/linux/nfsd/export.h
... | ... | @@ -127,8 +127,7 @@ |
127 | 127 | struct svc_export * rqst_exp_get_by_name(struct svc_rqst *, |
128 | 128 | struct path *); |
129 | 129 | struct svc_export * rqst_exp_parent(struct svc_rqst *, |
130 | - struct vfsmount *mnt, | |
131 | - struct dentry *dentry); | |
130 | + struct path *); | |
132 | 131 | int exp_rootfh(struct auth_domain *, |
133 | 132 | char *path, struct knfsd_fh *, int maxsize); |
134 | 133 | __be32 exp_pseudoroot(struct svc_rqst *, struct svc_fh *); |