@@ -847,9 +847,8 @@ exp_get_fsid_key(svc_client *clp, int fsid)
847847 return exp_find_key (clp , FSID_NUM , fsidv , NULL );
848848}
849849
850- static svc_export * exp_get_by_name (svc_client * clp , struct vfsmount * mnt ,
851- struct dentry * dentry ,
852- struct cache_req * reqp )
850+ static svc_export * exp_get_by_name (svc_client * clp , const struct path * path ,
851+ struct cache_req * reqp )
853852{
854853 struct svc_export * exp , key ;
855854 int err ;
@@ -858,8 +857,7 @@ static svc_export *exp_get_by_name(svc_client *clp, struct vfsmount *mnt,
858857 return ERR_PTR (- ENOENT );
859858
860859 key .ex_client = clp ;
861- key .ex_path .mnt = mnt ;
862- key .ex_path .dentry = dentry ;
860+ key .ex_path = * path ;
863861
864862 exp = svc_export_lookup (& key );
865863 if (exp == NULL )
@@ -877,20 +875,19 @@ static struct svc_export *exp_parent(svc_client *clp, struct vfsmount *mnt,
877875 struct dentry * dentry ,
878876 struct cache_req * reqp )
879877{
878+ struct path path = {.mnt = mnt , .dentry = dentry };
880879 svc_export * exp ;
881880
882- dget (dentry );
883- exp = exp_get_by_name (clp , mnt , dentry , reqp );
884-
885- while (PTR_ERR (exp ) == - ENOENT && !IS_ROOT (dentry )) {
886- struct dentry * parent ;
881+ dget (path .dentry );
882+ exp = exp_get_by_name (clp , & path , reqp );
887883
888- parent = dget_parent (dentry );
889- dput (dentry );
890- dentry = parent ;
891- exp = exp_get_by_name (clp , mnt , dentry , reqp );
884+ while (PTR_ERR (exp ) == - ENOENT && !IS_ROOT (path .dentry )) {
885+ struct dentry * parent = dget_parent (path .dentry );
886+ dput (path .dentry );
887+ path .dentry = parent ;
888+ exp = exp_get_by_name (clp , & path , reqp );
892889 }
893- dput (dentry );
890+ dput (path . dentry );
894891 return exp ;
895892}
896893
@@ -1018,7 +1015,7 @@ exp_export(struct nfsctl_export *nxp)
10181015 goto out_put_clp ;
10191016 err = - EINVAL ;
10201017
1021- exp = exp_get_by_name (clp , path . mnt , path . dentry , NULL );
1018+ exp = exp_get_by_name (clp , & path , NULL );
10221019
10231020 memset (& new , 0 , sizeof (new ));
10241021
@@ -1135,7 +1132,7 @@ exp_unexport(struct nfsctl_export *nxp)
11351132 goto out_domain ;
11361133
11371134 err = - EINVAL ;
1138- exp = exp_get_by_name (dom , path . mnt , path . dentry , NULL );
1135+ exp = exp_get_by_name (dom , & path , NULL );
11391136 path_put (& path );
11401137 if (IS_ERR (exp ))
11411138 goto out_domain ;
@@ -1207,7 +1204,7 @@ static struct svc_export *exp_find(struct auth_domain *clp, int fsid_type,
12071204 if (IS_ERR (ek ))
12081205 return ERR_CAST (ek );
12091206
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 );
12111208 cache_put (& ek -> h , & svc_expkey_cache );
12121209
12131210 if (IS_ERR (exp ))
@@ -1251,12 +1248,13 @@ rqst_exp_get_by_name(struct svc_rqst *rqstp, struct vfsmount *mnt,
12511248 struct dentry * dentry )
12521249{
12531250 struct svc_export * gssexp , * exp = ERR_PTR (- ENOENT );
1251+ struct path path = {.mnt = mnt , .dentry = dentry };
12541252
12551253 if (rqstp -> rq_client == NULL )
12561254 goto gss ;
12571255
12581256 /* 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 ,
12601258 & rqstp -> rq_chandle );
12611259 if (PTR_ERR (exp ) == - ENOENT )
12621260 goto gss ;
@@ -1269,7 +1267,7 @@ rqst_exp_get_by_name(struct svc_rqst *rqstp, struct vfsmount *mnt,
12691267 /* Otherwise, try falling back on gss client */
12701268 if (rqstp -> rq_gssclient == NULL )
12711269 return exp ;
1272- gssexp = exp_get_by_name (rqstp -> rq_gssclient , mnt , dentry ,
1270+ gssexp = exp_get_by_name (rqstp -> rq_gssclient , & path ,
12731271 & rqstp -> rq_chandle );
12741272 if (PTR_ERR (gssexp ) == - ENOENT )
12751273 return exp ;
0 commit comments