Commit 20fa6233 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] knfsd cleanups

new helper - exp_get_by_name(client, vfsmount, dentry).  Used
in places where we travers mountpoint.
parent 76befc0e
...@@ -83,6 +83,22 @@ exp_get(svc_client *clp, kdev_t dev, ino_t ino) ...@@ -83,6 +83,22 @@ exp_get(svc_client *clp, kdev_t dev, ino_t ino)
return exp; 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> * Find the export entry for a given dentry. <gam3@acm.org>
*/ */
......
...@@ -132,7 +132,7 @@ nfsd_lookup(struct svc_rqst *rqstp, struct svc_fh *fhp, const char *name, ...@@ -132,7 +132,7 @@ nfsd_lookup(struct svc_rqst *rqstp, struct svc_fh *fhp, const char *name,
dentry = dp; dentry = dp;
for ( ; exp2 == NULL && dp->d_parent != dp; for ( ; exp2 == NULL && dp->d_parent != dp;
dp=dp->d_parent) 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) { if (exp2==NULL) {
dput(dentry); dput(dentry);
dentry = dget(dparent); dentry = dget(dparent);
...@@ -159,9 +159,7 @@ nfsd_lookup(struct svc_rqst *rqstp, struct svc_fh *fhp, const char *name, ...@@ -159,9 +159,7 @@ nfsd_lookup(struct svc_rqst *rqstp, struct svc_fh *fhp, const char *name,
struct dentry *mounts = dget(dentry); struct dentry *mounts = dget(dentry);
while (follow_down(&mnt,&mounts)&&d_mountpoint(mounts)) while (follow_down(&mnt,&mounts)&&d_mountpoint(mounts))
; ;
exp2 = exp_get(rqstp->rq_client, exp2 = exp_get_by_name(rqstp->rq_client, mnt, mounts);
mounts->d_inode->i_dev,
mounts->d_inode->i_ino);
if (exp2 && EX_CROSSMNT(exp2)) { if (exp2 && EX_CROSSMNT(exp2)) {
/* successfully crossed mount point */ /* successfully crossed mount point */
exp = exp2; exp = exp2;
......
...@@ -90,6 +90,9 @@ void exp_unlock(void); ...@@ -90,6 +90,9 @@ void exp_unlock(void);
struct svc_client * exp_getclient(struct sockaddr_in *sin); struct svc_client * exp_getclient(struct sockaddr_in *sin);
void exp_putclient(struct svc_client *clp); 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(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 *, int exp_rootfh(struct svc_client *,
char *path, struct knfsd_fh *, int maxsize); char *path, struct knfsd_fh *, int maxsize);
int nfserrno(int errno); int nfserrno(int errno);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment