switch rqst_exp_parent()
authorAl Viro <viro@zeniv.linux.org.uk>
Sat, 18 Apr 2009 07:00:46 +0000 (03:00 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Fri, 12 Jun 2009 01:36:00 +0000 (21:36 -0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/nfsd/export.c
fs/nfsd/vfs.c
include/linux/nfsd/export.h

index 84f5e5cb0863704eb307dc04f72f03034fdfa0aa..8b1f8efb4690e2f9271adac75ad71a54c4198fe3 100644 (file)
@@ -1299,24 +1299,19 @@ gss:
 }
 
 struct svc_export *
-rqst_exp_parent(struct svc_rqst *rqstp, struct vfsmount *mnt,
-               struct dentry *dentry)
+rqst_exp_parent(struct svc_rqst *rqstp, struct path *path)
 {
-       struct svc_export *exp;
-       struct path path = {.mnt = mnt, .dentry = dentry};
-
-       dget(dentry);
-       exp = rqst_exp_get_by_name(rqstp, &path);
-
-       while (PTR_ERR(exp) == -ENOENT && !IS_ROOT(dentry)) {
-               struct dentry *parent;
+       struct dentry *saved = dget(path->dentry);
+       struct svc_export *exp = rqst_exp_get_by_name(rqstp, path);
 
-               parent = dget_parent(dentry);
-               dput(dentry);
-               dentry = parent;
-               exp = rqst_exp_get_by_name(rqstp, &path);
+       while (PTR_ERR(exp) == -ENOENT && !IS_ROOT(path->dentry)) {
+               struct dentry *parent = dget_parent(path->dentry);
+               dput(path->dentry);
+               path->dentry = parent;
+               exp = rqst_exp_get_by_name(rqstp, path);
        }
-       dput(dentry);
+       dput(path->dentry);
+       path->dentry = saved;
        return exp;
 }
 
index d84c4eaa526b5c5edfaa5cee0b3fd3f8de8c6c18..9f1ea3127f5d4ed8048c34becd7cc5591dac8dde 100644 (file)
@@ -169,28 +169,29 @@ nfsd_lookup_dentry(struct svc_rqst *rqstp, struct svc_fh *fhp,
                        /* checking mountpoint crossing is very different when stepping up */
                        struct svc_export *exp2 = NULL;
                        struct dentry *dp;
-                       struct vfsmount *mnt = mntget(exp->ex_path.mnt);
-                       dentry = dget(dparent);
-                       while(dentry == mnt->mnt_root && follow_up(&mnt, &dentry))
+                       struct path path = {.mnt = mntget(exp->ex_path.mnt),
+                                           .dentry = dget(dparent)};
+
+                       while (path.dentry == path.mnt->mnt_root &&
+                              follow_up(&path.mnt, &path.dentry))
                                ;
-                       dp = dget_parent(dentry);
-                       dput(dentry);
-                       dentry = dp;
+                       dp = dget_parent(path.dentry);
+                       dput(path.dentry);
+                       path.dentry = dp;
 
-                       exp2 = rqst_exp_parent(rqstp, mnt, dentry);
+                       exp2 = rqst_exp_parent(rqstp, &path);
                        if (PTR_ERR(exp2) == -ENOENT) {
-                               dput(dentry);
                                dentry = dget(dparent);
                        } else if (IS_ERR(exp2)) {
                                host_err = PTR_ERR(exp2);
-                               dput(dentry);
-                               mntput(mnt);
+                               path_put(&path);
                                goto out_nfserr;
                        } else {
+                               dentry = dget(path.dentry);
                                exp_put(exp);
                                exp = exp2;
                        }
-                       mntput(mnt);
+                       path_put(&path);
                }
        } else {
                fh_lock(fhp);
index 98f6fd584d537baa0561facd6df7bb4d1647360e..a6d9ef2bb34a9c4bb2f832ec5badea200b439678 100644 (file)
@@ -127,8 +127,7 @@ void                        exp_readunlock(void);
 struct svc_export *    rqst_exp_get_by_name(struct svc_rqst *,
                                             struct path *);
 struct svc_export *    rqst_exp_parent(struct svc_rqst *,
-                                       struct vfsmount *mnt,
-                                       struct dentry *dentry);
+                                       struct path *);
 int                    exp_rootfh(struct auth_domain *, 
                                        char *path, struct knfsd_fh *, int maxsize);
 __be32                 exp_pseudoroot(struct svc_rqst *, struct svc_fh *);