aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@citi.umich.edu>2009-10-25 21:43:01 -0400
committerJ. Bruce Fields <bfields@citi.umich.edu>2009-12-15 14:07:24 -0500
commit3227fa41abc191384fa81b3bcf52aa7fccb31536 (patch)
treef50512f2feecfc2fde13b0843cbbfb87728e2442 /fs/nfsd
parent82ead7fe41da960ed80652d13d5a1072f85f5aca (diff)
nfsd: filter readdir results in V4ROOT case
As with lookup, we treat every boject as a mountpoint and pretend it doesn't exist if it isn't exported. The preexisting code here is confusing, but I haven't yet figured out how to make it clearer. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'fs/nfsd')
-rw-r--r--fs/nfsd/nfs4xdr.c10
-rw-r--r--fs/nfsd/vfs.c2
-rw-r--r--fs/nfsd/vfs.h1
3 files changed, 9 insertions, 4 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index cab978031100..a8587e90fd5a 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -2196,11 +2196,14 @@ nfsd4_encode_dirent_fattr(struct nfsd4_readdir *cd,
2196 * we will not follow the cross mount and will fill the attribtutes 2196 * we will not follow the cross mount and will fill the attribtutes
2197 * directly from the mountpoint dentry. 2197 * directly from the mountpoint dentry.
2198 */ 2198 */
2199 if (d_mountpoint(dentry) && !attributes_need_mount(cd->rd_bmval)) 2199 if (nfsd_mountpoint(dentry, exp)) {
2200 ignore_crossmnt = 1;
2201 else if (d_mountpoint(dentry)) {
2202 int err; 2200 int err;
2203 2201
2202 if (!(exp->ex_flags & NFSEXP_V4ROOT)
2203 && !attributes_need_mount(cd->rd_bmval)) {
2204 ignore_crossmnt = 1;
2205 goto out_encode;
2206 }
2204 /* 2207 /*
2205 * Why the heck aren't we just using nfsd_lookup?? 2208 * Why the heck aren't we just using nfsd_lookup??
2206 * Different "."/".." handling? Something else? 2209 * Different "."/".." handling? Something else?
@@ -2216,6 +2219,7 @@ nfsd4_encode_dirent_fattr(struct nfsd4_readdir *cd,
2216 goto out_put; 2219 goto out_put;
2217 2220
2218 } 2221 }
2222out_encode:
2219 nfserr = nfsd4_encode_fattr(NULL, exp, dentry, p, buflen, cd->rd_bmval, 2223 nfserr = nfsd4_encode_fattr(NULL, exp, dentry, p, buflen, cd->rd_bmval,
2220 cd->rd_rqstp, ignore_crossmnt); 2224 cd->rd_rqstp, ignore_crossmnt);
2221out_put: 2225out_put:
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index eaf2f0dca12a..a0015a958aef 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -170,7 +170,7 @@ static int nfsd_lookup_parent(struct svc_rqst *rqstp, struct dentry *dparent, st
170 * For nfsd purposes, we treat V4ROOT exports as though there was an 170 * For nfsd purposes, we treat V4ROOT exports as though there was an
171 * export at *every* directory. 171 * export at *every* directory.
172 */ 172 */
173static int nfsd_mountpoint(struct dentry *dentry, struct svc_export *exp) 173int nfsd_mountpoint(struct dentry *dentry, struct svc_export *exp)
174{ 174{
175 if (d_mountpoint(dentry)) 175 if (d_mountpoint(dentry))
176 return 1; 176 return 1;
diff --git a/fs/nfsd/vfs.h b/fs/nfsd/vfs.h
index b8011fd2fcab..f4fa6d351bbd 100644
--- a/fs/nfsd/vfs.h
+++ b/fs/nfsd/vfs.h
@@ -40,6 +40,7 @@ __be32 nfsd_lookup_dentry(struct svc_rqst *, struct svc_fh *,
40 struct svc_export **, struct dentry **); 40 struct svc_export **, struct dentry **);
41__be32 nfsd_setattr(struct svc_rqst *, struct svc_fh *, 41__be32 nfsd_setattr(struct svc_rqst *, struct svc_fh *,
42 struct iattr *, int, time_t); 42 struct iattr *, int, time_t);
43int nfsd_mountpoint(struct dentry *, struct svc_export *);
43#ifdef CONFIG_NFSD_V4 44#ifdef CONFIG_NFSD_V4
44__be32 nfsd4_set_nfs4_acl(struct svc_rqst *, struct svc_fh *, 45__be32 nfsd4_set_nfs4_acl(struct svc_rqst *, struct svc_fh *,
45 struct nfs4_acl *); 46 struct nfs4_acl *);