aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4xdr.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-02-28 21:02:55 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-28 21:02:55 -0500
commitb6669737d3db7df79fad07180837c23dbe581db5 (patch)
tree671a9d13fe5ab00d6a3c7c5c5c466802ca96d38a /fs/nfsd/nfs4xdr.c
parent1cf0209c431fa7790253c532039d53b0773193aa (diff)
parentdc107402ae06286a9ed33c32daf3f35514a7cb8d (diff)
Merge branch 'for-3.9' of git://linux-nfs.org/~bfields/linux
Pull nfsd changes from J Bruce Fields: "Miscellaneous bugfixes, plus: - An overhaul of the DRC cache by Jeff Layton. The main effect is just to make it larger. This decreases the chances of intermittent errors especially in the UDP case. But we'll need to watch for any reports of performance regressions. - Containerized nfsd: with some limitations, we now support per-container nfs-service, thanks to extensive work from Stanislav Kinsbursky over the last year." Some notes about conflicts, since there were *two* non-data semantic conflicts here: - idr_remove_all() had been added by a memory leak fix, but has since become deprecated since idr_destroy() does it for us now. - xs_local_connect() had been added by this branch to make AF_LOCAL connections be synchronous, but in the meantime Trond had changed the calling convention in order to avoid a RCU dereference. There were a couple of more obvious actual source-level conflicts due to the hlist traversal changes and one just due to code changes next to each other, but those were trivial. * 'for-3.9' of git://linux-nfs.org/~bfields/linux: (49 commits) SUNRPC: make AF_LOCAL connect synchronous nfsd: fix compiler warning about ambiguous types in nfsd_cache_csum svcrpc: fix rpc server shutdown races svcrpc: make svc_age_temp_xprts enqueue under sv_lock lockd: nlmclnt_reclaim(): avoid stack overflow nfsd: enable NFSv4 state in containers nfsd: disable usermode helper client tracker in container nfsd: use proper net while reading "exports" file nfsd: containerize NFSd filesystem nfsd: fix comments on nfsd_cache_lookup SUNRPC: move cache_detail->cache_request callback call to cache_read() SUNRPC: remove "cache_request" argument in sunrpc_cache_pipe_upcall() function SUNRPC: rework cache upcall logic SUNRPC: introduce cache_detail->cache_request callback NFS: simplify and clean cache library NFS: use SUNRPC cache creation and destruction helper for DNS cache nfsd4: free_stid can be static nfsd: keep a checksum of the first 256 bytes of request sunrpc: trim off trailing checksum before returning decrypted or integrity authenticated buffer sunrpc: fix comment in struct xdr_buf definition ...
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