]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] knfsd cleanups
authorAlexander Viro <viro@math.psu.edu>
Fri, 8 Feb 2002 07:47:42 +0000 (23:47 -0800)
committerLinus Torvalds <torvalds@home.transmeta.com>
Fri, 8 Feb 2002 07:47:42 +0000 (23:47 -0800)
new helper - exp_get_by_name(client, vfsmount, dentry).  Used
in places where we travers mountpoint.

fs/nfsd/export.c
fs/nfsd/vfs.c
include/linux/nfsd/export.h

index 76c0b485ed13755de7b861c7d96fe7c22eb6a587..5fde41eaa47f560a8bb7811772f635710cd9db68 100644 (file)
@@ -83,6 +83,22 @@ exp_get(svc_client *clp, kdev_t dev, ino_t ino)
        return exp;
 }
 
+svc_export *
+exp_get_by_name(svc_client *clp, struct vfsmount *mnt, struct dentry *dentry)
+{
+       int hash = EXPORT_HASH(mnt->mnt_sb->s_dev);
+       svc_export *exp;
+
+       if (!clp)
+               return NULL;
+
+       for (exp = clp->cl_export[hash]; exp; exp = exp->ex_next) {
+               if (exp->ex_dentry == dentry && exp->ex_mnt == mnt)
+                       break;
+       }
+       return exp;
+}
+
 /*
  * Find the export entry for a given dentry.  <gam3@acm.org>
  */
index af9bd34b282a8b159fccda1928c077b141043cd9..14290a603a1036b6d215ac7dd30b6d05c760c5ec 100644 (file)
@@ -132,7 +132,7 @@ nfsd_lookup(struct svc_rqst *rqstp, struct svc_fh *fhp, const char *name,
                                        dentry = dp;
                                        for ( ; exp2 == NULL && dp->d_parent != dp;
                                              dp=dp->d_parent)
-                                               exp2 = exp_get(exp->ex_client, dp->d_inode->i_dev, dp->d_inode->i_ino);
+                                               exp2 = exp_get_by_name(exp->ex_client, mnt, dp);
                                        if (exp2==NULL) {
                                                dput(dentry);
                                                dentry = dget(dparent);
@@ -159,9 +159,7 @@ nfsd_lookup(struct svc_rqst *rqstp, struct svc_fh *fhp, const char *name,
                        struct dentry *mounts = dget(dentry);
                        while (follow_down(&mnt,&mounts)&&d_mountpoint(mounts))
                                ;
-                       exp2 = exp_get(rqstp->rq_client,
-                                      mounts->d_inode->i_dev,
-                                      mounts->d_inode->i_ino);
+                       exp2 = exp_get_by_name(rqstp->rq_client, mnt, mounts);
                        if (exp2 && EX_CROSSMNT(exp2)) {
                                /* successfully crossed mount point */
                                exp = exp2;
index be9aa119d63e8d4b8f4e64f62e47146bf5801d73..4b3c95ffc05c5cc251a3ea9bfebf28d76af6acd5 100644 (file)
@@ -90,6 +90,9 @@ void                  exp_unlock(void);
 struct svc_client *    exp_getclient(struct sockaddr_in *sin);
 void                   exp_putclient(struct svc_client *clp);
 struct svc_export *    exp_get(struct svc_client *clp, kdev_t dev, ino_t ino);
+struct svc_export *    exp_get_by_name(struct svc_client *clp,
+                                       struct vfsmount *mnt,
+                                       struct dentry *dentry);
 int                    exp_rootfh(struct svc_client *, 
                                        char *path, struct knfsd_fh *, int maxsize);
 int                    nfserrno(int errno);