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 0dc11586682f..fcb5bed99c33 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -2006,12 +2006,11 @@ static int get_parent_attributes(struct svc_export *exp, struct kstat *stat)
2006 * Note: @fhp can be NULL; in this case, we might have to compose the filehandle 2006 * Note: @fhp can be NULL; in this case, we might have to compose the filehandle
2007 * ourselves. 2007 * ourselves.
2008 * 2008 *
2009 * @countp is the buffer size in _words_; upon successful return this becomes 2009 * countp is the buffer size in _words_
2010 * replaced with the number of words written.
2011 */ 2010 */
2012__be32 2011__be32
2013nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp, 2012nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
2014 struct dentry *dentry, __be32 *buffer, int *countp, u32 *bmval, 2013 struct dentry *dentry, __be32 **buffer, int count, u32 *bmval,
2015 struct svc_rqst *rqstp, int ignore_crossmnt) 2014 struct svc_rqst *rqstp, int ignore_crossmnt)
2016{ 2015{
2017 u32 bmval0 = bmval[0]; 2016 u32 bmval0 = bmval[0];
@@ -2020,12 +2019,12 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
2020 struct kstat stat; 2019 struct kstat stat;
2021 struct svc_fh tempfh; 2020 struct svc_fh tempfh;
2022 struct kstatfs statfs; 2021 struct kstatfs statfs;
2023 int buflen = *countp << 2; 2022 int buflen = count << 2;
2024 __be32 *attrlenp; 2023 __be32 *attrlenp;
2025 u32 dummy; 2024 u32 dummy;
2026 u64 dummy64; 2025 u64 dummy64;
2027 u32 rdattr_err = 0; 2026 u32 rdattr_err = 0;
2028 __be32 *p = buffer; 2027 __be32 *p = *buffer;
2029 __be32 status; 2028 __be32 status;
2030 int err; 2029 int err;
2031 int aclsupport = 0; 2030 int aclsupport = 0;
@@ -2431,7 +2430,7 @@ out_acl:
2431 } 2430 }
2432 2431
2433 *attrlenp = htonl((char *)p - (char *)attrlenp - 4); 2432 *attrlenp = htonl((char *)p - (char *)attrlenp - 4);
2434 *countp = p - buffer; 2433 *buffer = p;
2435 status = nfs_ok; 2434 status = nfs_ok;
2436 2435
2437out: 2436out:
@@ -2443,7 +2442,6 @@ out_nfserr:
2443 status = nfserrno(err); 2442 status = nfserrno(err);
2444 goto out; 2443 goto out;
2445out_resource: 2444out_resource:
2446 *countp = 0;
2447 status = nfserr_resource; 2445 status = nfserr_resource;
2448 goto out; 2446 goto out;
2449out_serverfault: 2447out_serverfault:
@@ -2462,7 +2460,7 @@ static inline int attributes_need_mount(u32 *bmval)
2462 2460
2463static __be32 2461static __be32
2464nfsd4_encode_dirent_fattr(struct nfsd4_readdir *cd, 2462nfsd4_encode_dirent_fattr(struct nfsd4_readdir *cd,
2465 const char *name, int namlen, __be32 *p, int *buflen) 2463 const char *name, int namlen, __be32 **p, int buflen)
2466{ 2464{
2467 struct svc_export *exp = cd->rd_fhp->fh_export; 2465 struct svc_export *exp = cd->rd_fhp->fh_export;
2468 struct dentry *dentry; 2466 struct dentry *dentry;
@@ -2568,10 +2566,9 @@ nfsd4_encode_dirent(void *ccdv, const char *name, int namlen,
2568 p = xdr_encode_hyper(p, NFS_OFFSET_MAX); /* offset of next entry */ 2566 p = xdr_encode_hyper(p, NFS_OFFSET_MAX); /* offset of next entry */
2569 p = xdr_encode_array(p, name, namlen); /* name length & name */ 2567 p = xdr_encode_array(p, name, namlen); /* name length & name */
2570 2568
2571 nfserr = nfsd4_encode_dirent_fattr(cd, name, namlen, p, &buflen); 2569 nfserr = nfsd4_encode_dirent_fattr(cd, name, namlen, &p, buflen);
2572 switch (nfserr) { 2570 switch (nfserr) {
2573 case nfs_ok: 2571 case nfs_ok:
2574 p += buflen;
2575 break; 2572 break;
2576 case nfserr_resource: 2573 case nfserr_resource:
2577 nfserr = nfserr_toosmall; 2574 nfserr = nfserr_toosmall;
@@ -2698,10 +2695,8 @@ nfsd4_encode_getattr(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4
2698 2695
2699 buflen = resp->end - resp->p - (COMPOUND_ERR_SLACK_SPACE >> 2); 2696 buflen = resp->end - resp->p - (COMPOUND_ERR_SLACK_SPACE >> 2);
2700 nfserr = nfsd4_encode_fattr(fhp, fhp->fh_export, fhp->fh_dentry, 2697 nfserr = nfsd4_encode_fattr(fhp, fhp->fh_export, fhp->fh_dentry,
2701 resp->p, &buflen, getattr->ga_bmval, 2698 &resp->p, buflen, getattr->ga_bmval,
2702 resp->rqstp, 0); 2699 resp->rqstp, 0);
2703 if (!nfserr)
2704 resp->p += buflen;
2705 return nfserr; 2700 return nfserr;
2706} 2701}
2707 2702