aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4xdr.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfsd/nfs4xdr.c')
-rw-r--r--fs/nfsd/nfs4xdr.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 8ca6d17f6cf3..01168865dd37 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -2024,12 +2024,11 @@ static int get_parent_attributes(struct svc_export *exp, struct kstat *stat)
2024 * Note: @fhp can be NULL; in this case, we might have to compose the filehandle 2024 * Note: @fhp can be NULL; in this case, we might have to compose the filehandle
2025 * ourselves. 2025 * ourselves.
2026 * 2026 *
2027 * @countp is the buffer size in _words_; upon successful return this becomes 2027 * countp is the buffer size in _words_
2028 * replaced with the number of words written.
2029 */ 2028 */
2030__be32 2029__be32
2031nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp, 2030nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
2032 struct dentry *dentry, __be32 *buffer, int *countp, u32 *bmval, 2031 struct dentry *dentry, __be32 **buffer, int count, u32 *bmval,
2033 struct svc_rqst *rqstp, int ignore_crossmnt) 2032 struct svc_rqst *rqstp, int ignore_crossmnt)
2034{ 2033{
2035 u32 bmval0 = bmval[0]; 2034 u32 bmval0 = bmval[0];
@@ -2038,12 +2037,12 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
2038 struct kstat stat; 2037 struct kstat stat;
2039 struct svc_fh tempfh; 2038 struct svc_fh tempfh;
2040 struct kstatfs statfs; 2039 struct kstatfs statfs;
2041 int buflen = *countp << 2; 2040 int buflen = count << 2;
2042 __be32 *attrlenp; 2041 __be32 *attrlenp;
2043 u32 dummy; 2042 u32 dummy;
2044 u64 dummy64; 2043 u64 dummy64;
2045 u32 rdattr_err = 0; 2044 u32 rdattr_err = 0;
2046 __be32 *p = buffer; 2045 __be32 *p = *buffer;
2047 __be32 status; 2046 __be32 status;
2048 int err; 2047 int err;
2049 int aclsupport = 0; 2048 int aclsupport = 0;
@@ -2447,7 +2446,7 @@ out_acl:
2447 } 2446 }
2448 2447
2449 *attrlenp = htonl((char *)p - (char *)attrlenp - 4); 2448 *attrlenp = htonl((char *)p - (char *)attrlenp - 4);
2450 *countp = p - buffer; 2449 *buffer = p;
2451 status = nfs_ok; 2450 status = nfs_ok;
2452 2451
2453out: 2452out:
@@ -2459,7 +2458,6 @@ out_nfserr:
2459 status = nfserrno(err); 2458 status = nfserrno(err);
2460 goto out; 2459 goto out;
2461out_resource: 2460out_resource:
2462 *countp = 0;
2463 status = nfserr_resource; 2461 status = nfserr_resource;
2464 goto out; 2462 goto out;
2465out_serverfault: 2463out_serverfault:
@@ -2478,7 +2476,7 @@ static inline int attributes_need_mount(u32 *bmval)
2478 2476
2479static __be32 2477static __be32
2480nfsd4_encode_dirent_fattr(struct nfsd4_readdir *cd, 2478nfsd4_encode_dirent_fattr(struct nfsd4_readdir *cd,
2481 const char *name, int namlen, __be32 *p, int *buflen) 2479 const char *name, int namlen, __be32 **p, int buflen)
2482{ 2480{
2483 struct svc_export *exp = cd->rd_fhp->fh_export; 2481 struct svc_export *exp = cd->rd_fhp->fh_export;
2484 struct dentry *dentry; 2482 struct dentry *dentry;
@@ -2584,10 +2582,9 @@ nfsd4_encode_dirent(void *ccdv, const char *name, int namlen,
2584 p = xdr_encode_hyper(p, NFS_OFFSET_MAX); /* offset of next entry */ 2582 p = xdr_encode_hyper(p, NFS_OFFSET_MAX); /* offset of next entry */
2585 p = xdr_encode_array(p, name, namlen); /* name length & name */ 2583 p = xdr_encode_array(p, name, namlen); /* name length & name */
2586 2584
2587 nfserr = nfsd4_encode_dirent_fattr(cd, name, namlen, p, &buflen); 2585 nfserr = nfsd4_encode_dirent_fattr(cd, name, namlen, &p, buflen);
2588 switch (nfserr) { 2586 switch (nfserr) {
2589 case nfs_ok: 2587 case nfs_ok:
2590 p += buflen;
2591 break; 2588 break;
2592 case nfserr_resource: 2589 case nfserr_resource:
2593 nfserr = nfserr_toosmall; 2590 nfserr = nfserr_toosmall;
@@ -2714,10 +2711,8 @@ nfsd4_encode_getattr(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4
2714 2711
2715 buflen = resp->end - resp->p - (COMPOUND_ERR_SLACK_SPACE >> 2); 2712 buflen = resp->end - resp->p - (COMPOUND_ERR_SLACK_SPACE >> 2);
2716 nfserr = nfsd4_encode_fattr(fhp, fhp->fh_export, fhp->fh_dentry, 2713 nfserr = nfsd4_encode_fattr(fhp, fhp->fh_export, fhp->fh_dentry,
2717 resp->p, &buflen, getattr->ga_bmval, 2714 &resp->p, buflen, getattr->ga_bmval,
2718 resp->rqstp, 0); 2715 resp->rqstp, 0);
2719 if (!nfserr)
2720 resp->p += buflen;
2721 return nfserr; 2716 return nfserr;
2722} 2717}
2723 2718