Commit 3227fa41abc191384fa81b3bcf52aa7fccb31536

Authored by J. Bruce Fields
1 parent 82ead7fe41

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>

Showing 3 changed files with 9 additions and 4 deletions Side-by-side Diff

... ... @@ -2196,11 +2196,14 @@
2196 2196 * we will not follow the cross mount and will fill the attribtutes
2197 2197 * directly from the mountpoint dentry.
2198 2198 */
2199   - if (d_mountpoint(dentry) && !attributes_need_mount(cd->rd_bmval))
2200   - ignore_crossmnt = 1;
2201   - else if (d_mountpoint(dentry)) {
  2199 + if (nfsd_mountpoint(dentry, exp)) {
2202 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 2208 * Why the heck aren't we just using nfsd_lookup??
2206 2209 * Different "."/".." handling? Something else?
... ... @@ -2216,6 +2219,7 @@
2216 2219 goto out_put;
2217 2220  
2218 2221 }
  2222 +out_encode:
2219 2223 nfserr = nfsd4_encode_fattr(NULL, exp, dentry, p, buflen, cd->rd_bmval,
2220 2224 cd->rd_rqstp, ignore_crossmnt);
2221 2225 out_put:
... ... @@ -170,7 +170,7 @@
170 170 * For nfsd purposes, we treat V4ROOT exports as though there was an
171 171 * export at *every* directory.
172 172 */
173   -static int nfsd_mountpoint(struct dentry *dentry, struct svc_export *exp)
  173 +int nfsd_mountpoint(struct dentry *dentry, struct svc_export *exp)
174 174 {
175 175 if (d_mountpoint(dentry))
176 176 return 1;
... ... @@ -40,6 +40,7 @@
40 40 struct svc_export **, struct dentry **);
41 41 __be32 nfsd_setattr(struct svc_rqst *, struct svc_fh *,
42 42 struct iattr *, int, time_t);
  43 +int nfsd_mountpoint(struct dentry *, struct svc_export *);
43 44 #ifdef CONFIG_NFSD_V4
44 45 __be32 nfsd4_set_nfs4_acl(struct svc_rqst *, struct svc_fh *,
45 46 struct nfs4_acl *);