Skip to content

Commit 91c9fa8

Browse files
author
Al Viro
committed
switch rqst_exp_get_by_name()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 5bf3bd2 commit 91c9fa8

3 files changed

Lines changed: 23 additions & 27 deletions

File tree

‎fs/nfsd/export.c‎

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,18 +1240,15 @@ __be32 check_nfsd_access(struct svc_export *exp, struct svc_rqst *rqstp)
12401240
* use exp_get_by_name() or exp_find().
12411241
*/
12421242
struct svc_export *
1243-
rqst_exp_get_by_name(struct svc_rqst *rqstp, struct vfsmount *mnt,
1244-
struct dentry *dentry)
1243+
rqst_exp_get_by_name(struct svc_rqst *rqstp, struct path *path)
12451244
{
12461245
struct svc_export *gssexp, *exp = ERR_PTR(-ENOENT);
1247-
struct path path = {.mnt = mnt, .dentry = dentry};
12481246

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

12521250
/* First try the auth_unix client: */
1253-
exp = exp_get_by_name(rqstp->rq_client, &path,
1254-
&rqstp->rq_chandle);
1251+
exp = exp_get_by_name(rqstp->rq_client, path, &rqstp->rq_chandle);
12551252
if (PTR_ERR(exp) == -ENOENT)
12561253
goto gss;
12571254
if (IS_ERR(exp))
@@ -1263,8 +1260,7 @@ rqst_exp_get_by_name(struct svc_rqst *rqstp, struct vfsmount *mnt,
12631260
/* Otherwise, try falling back on gss client */
12641261
if (rqstp->rq_gssclient == NULL)
12651262
return exp;
1266-
gssexp = exp_get_by_name(rqstp->rq_gssclient, &path,
1267-
&rqstp->rq_chandle);
1263+
gssexp = exp_get_by_name(rqstp->rq_gssclient, path, &rqstp->rq_chandle);
12681264
if (PTR_ERR(gssexp) == -ENOENT)
12691265
return exp;
12701266
if (!IS_ERR(exp))
@@ -1307,17 +1303,18 @@ rqst_exp_parent(struct svc_rqst *rqstp, struct vfsmount *mnt,
13071303
struct dentry *dentry)
13081304
{
13091305
struct svc_export *exp;
1306+
struct path path = {.mnt = mnt, .dentry = dentry};
13101307

13111308
dget(dentry);
1312-
exp = rqst_exp_get_by_name(rqstp, mnt, dentry);
1309+
exp = rqst_exp_get_by_name(rqstp, &path);
13131310

13141311
while (PTR_ERR(exp) == -ENOENT && !IS_ROOT(dentry)) {
13151312
struct dentry *parent;
13161313

13171314
parent = dget_parent(dentry);
13181315
dput(dentry);
13191316
dentry = parent;
1320-
exp = rqst_exp_get_by_name(rqstp, mnt, dentry);
1317+
exp = rqst_exp_get_by_name(rqstp, &path);
13211318
}
13221319
dput(dentry);
13231320
return exp;

‎fs/nfsd/vfs.c‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -101,36 +101,36 @@ nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp,
101101
{
102102
struct svc_export *exp = *expp, *exp2 = NULL;
103103
struct dentry *dentry = *dpp;
104-
struct vfsmount *mnt = mntget(exp->ex_path.mnt);
105-
struct dentry *mounts = dget(dentry);
104+
struct path path = {.mnt = mntget(exp->ex_path.mnt),
105+
.dentry = dget(dentry)};
106106
int err = 0;
107107

108-
while (follow_down(&mnt,&mounts)&&d_mountpoint(mounts));
108+
while (follow_down(&path.mnt, &path.dentry) &&
109+
d_mountpoint(path.dentry))
110+
;
109111

110-
exp2 = rqst_exp_get_by_name(rqstp, mnt, mounts);
112+
exp2 = rqst_exp_get_by_name(rqstp, &path);
111113
if (IS_ERR(exp2)) {
112114
if (PTR_ERR(exp2) != -ENOENT)
113115
err = PTR_ERR(exp2);
114-
dput(mounts);
115-
mntput(mnt);
116+
path_put(&path);
116117
goto out;
117118
}
118119
if ((exp->ex_flags & NFSEXP_CROSSMOUNT) || EX_NOHIDE(exp2)) {
119120
/* successfully crossed mount point */
120121
/*
121-
* This is subtle: dentry is *not* under mnt at this point.
122-
* The only reason we are safe is that original mnt is pinned
123-
* down by exp, so we should dput before putting exp.
122+
* This is subtle: path.dentry is *not* on path.mnt
123+
* at this point. The only reason we are safe is that
124+
* original mnt is pinned down by exp, so we should
125+
* put path *before* putting exp
124126
*/
125-
dput(dentry);
126-
*dpp = mounts;
127-
exp_put(exp);
127+
*dpp = path.dentry;
128+
path.dentry = dentry;
128129
*expp = exp2;
129-
} else {
130-
exp_put(exp2);
131-
dput(mounts);
130+
exp2 = exp;
132131
}
133-
mntput(mnt);
132+
path_put(&path);
133+
exp_put(exp2);
134134
out:
135135
return err;
136136
}

‎include/linux/nfsd/export.h‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,7 @@ void nfsd_export_flush(void);
125125
void exp_readlock(void);
126126
void exp_readunlock(void);
127127
struct svc_export * rqst_exp_get_by_name(struct svc_rqst *,
128-
struct vfsmount *,
129-
struct dentry *);
128+
struct path *);
130129
struct svc_export * rqst_exp_parent(struct svc_rqst *,
131130
struct vfsmount *mnt,
132131
struct dentry *dentry);

0 commit comments

Comments
 (0)