diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfsd/export.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c index 3f6d51b8c3ef..5149dabde555 100644 --- a/fs/nfsd/export.c +++ b/fs/nfsd/export.c | |||
@@ -871,23 +871,19 @@ static svc_export *exp_get_by_name(svc_client *clp, const struct path *path, | |||
871 | /* | 871 | /* |
872 | * Find the export entry for a given dentry. | 872 | * Find the export entry for a given dentry. |
873 | */ | 873 | */ |
874 | static struct svc_export *exp_parent(svc_client *clp, struct vfsmount *mnt, | 874 | static struct svc_export *exp_parent(svc_client *clp, struct path *path) |
875 | struct dentry *dentry, | ||
876 | struct cache_req *reqp) | ||
877 | { | 875 | { |
878 | struct path path = {.mnt = mnt, .dentry = dentry}; | 876 | struct dentry *saved = dget(path->dentry); |
879 | svc_export *exp; | 877 | svc_export *exp = exp_get_by_name(clp, path, NULL); |
880 | 878 | ||
881 | dget(path.dentry); | 879 | while (PTR_ERR(exp) == -ENOENT && !IS_ROOT(path->dentry)) { |
882 | exp = exp_get_by_name(clp, &path, reqp); | 880 | struct dentry *parent = dget_parent(path->dentry); |
883 | 881 | dput(path->dentry); | |
884 | while (PTR_ERR(exp) == -ENOENT && !IS_ROOT(path.dentry)) { | 882 | path->dentry = parent; |
885 | struct dentry *parent = dget_parent(path.dentry); | 883 | exp = exp_get_by_name(clp, path, NULL); |
886 | dput(path.dentry); | ||
887 | path.dentry = parent; | ||
888 | exp = exp_get_by_name(clp, &path, reqp); | ||
889 | } | 884 | } |
890 | dput(path.dentry); | 885 | dput(path->dentry); |
886 | path->dentry = saved; | ||
891 | return exp; | 887 | return exp; |
892 | } | 888 | } |
893 | 889 | ||
@@ -1174,7 +1170,7 @@ exp_rootfh(svc_client *clp, char *name, struct knfsd_fh *f, int maxsize) | |||
1174 | dprintk("nfsd: exp_rootfh(%s [%p] %s:%s/%ld)\n", | 1170 | dprintk("nfsd: exp_rootfh(%s [%p] %s:%s/%ld)\n", |
1175 | name, path.dentry, clp->name, | 1171 | name, path.dentry, clp->name, |
1176 | inode->i_sb->s_id, inode->i_ino); | 1172 | inode->i_sb->s_id, inode->i_ino); |
1177 | exp = exp_parent(clp, path.mnt, path.dentry, NULL); | 1173 | exp = exp_parent(clp, &path); |
1178 | if (IS_ERR(exp)) { | 1174 | if (IS_ERR(exp)) { |
1179 | err = PTR_ERR(exp); | 1175 | err = PTR_ERR(exp); |
1180 | goto out; | 1176 | goto out; |