diff options
author | NeilBrown <neilb@suse.de> | 2006-10-04 05:15:47 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-04 10:55:15 -0400 |
commit | 3cc03b164cf01c6f36e64720b58610d292fb26f7 (patch) | |
tree | b558e11a087945ad5b9a1a25483aa2acc8d93fbb /fs/nfsd/nfs4xdr.c | |
parent | 4452435948424e5322c2a2fefbdc2cf3732cc45d (diff) |
[PATCH] knfsd: Avoid excess stack usage in svc_tcp_recvfrom
.. by allocating the array of 'kvec' in 'struct svc_rqst'.
As we plan to increase RPCSVC_MAXPAGES from 8 upto 256, we can no longer
allocate an array of this size on the stack. So we allocate it in 'struct
svc_rqst'.
However svc_rqst contains (indirectly) an array of the same type and size
(actually several, but they are in a union). So rather than waste space, we
move those arrays out of the separately allocated union and into svc_rqst to
share with the kvec moved out of svc_tcp_recvfrom (various arrays are used at
different times, so there is no conflict).
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/nfsd/nfs4xdr.c')
-rw-r--r-- | fs/nfsd/nfs4xdr.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 9f30c53ac0ed..df341956254e 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
@@ -926,26 +926,26 @@ nfsd4_decode_write(struct nfsd4_compoundargs *argp, struct nfsd4_write *write) | |||
926 | printk(KERN_NOTICE "xdr error! (%s:%d)\n", __FILE__, __LINE__); | 926 | printk(KERN_NOTICE "xdr error! (%s:%d)\n", __FILE__, __LINE__); |
927 | goto xdr_error; | 927 | goto xdr_error; |
928 | } | 928 | } |
929 | write->wr_vec[0].iov_base = p; | 929 | argp->rqstp->rq_vec[0].iov_base = p; |
930 | write->wr_vec[0].iov_len = avail; | 930 | argp->rqstp->rq_vec[0].iov_len = avail; |
931 | v = 0; | 931 | v = 0; |
932 | len = write->wr_buflen; | 932 | len = write->wr_buflen; |
933 | while (len > write->wr_vec[v].iov_len) { | 933 | while (len > argp->rqstp->rq_vec[v].iov_len) { |
934 | len -= write->wr_vec[v].iov_len; | 934 | len -= argp->rqstp->rq_vec[v].iov_len; |
935 | v++; | 935 | v++; |
936 | write->wr_vec[v].iov_base = page_address(argp->pagelist[0]); | 936 | argp->rqstp->rq_vec[v].iov_base = page_address(argp->pagelist[0]); |
937 | argp->pagelist++; | 937 | argp->pagelist++; |
938 | if (argp->pagelen >= PAGE_SIZE) { | 938 | if (argp->pagelen >= PAGE_SIZE) { |
939 | write->wr_vec[v].iov_len = PAGE_SIZE; | 939 | argp->rqstp->rq_vec[v].iov_len = PAGE_SIZE; |
940 | argp->pagelen -= PAGE_SIZE; | 940 | argp->pagelen -= PAGE_SIZE; |
941 | } else { | 941 | } else { |
942 | write->wr_vec[v].iov_len = argp->pagelen; | 942 | argp->rqstp->rq_vec[v].iov_len = argp->pagelen; |
943 | argp->pagelen -= len; | 943 | argp->pagelen -= len; |
944 | } | 944 | } |
945 | } | 945 | } |
946 | argp->end = (u32*) (write->wr_vec[v].iov_base + write->wr_vec[v].iov_len); | 946 | argp->end = (u32*) (argp->rqstp->rq_vec[v].iov_base + argp->rqstp->rq_vec[v].iov_len); |
947 | argp->p = (u32*) (write->wr_vec[v].iov_base + (XDR_QUADLEN(len) << 2)); | 947 | argp->p = (u32*) (argp->rqstp->rq_vec[v].iov_base + (XDR_QUADLEN(len) << 2)); |
948 | write->wr_vec[v].iov_len = len; | 948 | argp->rqstp->rq_vec[v].iov_len = len; |
949 | write->wr_vlen = v+1; | 949 | write->wr_vlen = v+1; |
950 | 950 | ||
951 | DECODE_TAIL; | 951 | DECODE_TAIL; |
@@ -2063,9 +2063,9 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, int nfserr, | |||
2063 | v = 0; | 2063 | v = 0; |
2064 | while (len > 0) { | 2064 | while (len > 0) { |
2065 | pn = resp->rqstp->rq_resused++; | 2065 | pn = resp->rqstp->rq_resused++; |
2066 | read->rd_iov[v].iov_base = | 2066 | resp->rqstp->rq_vec[v].iov_base = |
2067 | page_address(resp->rqstp->rq_respages[pn]); | 2067 | page_address(resp->rqstp->rq_respages[pn]); |
2068 | read->rd_iov[v].iov_len = | 2068 | resp->rqstp->rq_vec[v].iov_len = |
2069 | len < PAGE_SIZE ? len : PAGE_SIZE; | 2069 | len < PAGE_SIZE ? len : PAGE_SIZE; |
2070 | v++; | 2070 | v++; |
2071 | len -= PAGE_SIZE; | 2071 | len -= PAGE_SIZE; |
@@ -2073,7 +2073,7 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, int nfserr, | |||
2073 | read->rd_vlen = v; | 2073 | read->rd_vlen = v; |
2074 | 2074 | ||
2075 | nfserr = nfsd_read(read->rd_rqstp, read->rd_fhp, read->rd_filp, | 2075 | nfserr = nfsd_read(read->rd_rqstp, read->rd_fhp, read->rd_filp, |
2076 | read->rd_offset, read->rd_iov, read->rd_vlen, | 2076 | read->rd_offset, resp->rqstp->rq_vec, read->rd_vlen, |
2077 | &maxcount); | 2077 | &maxcount); |
2078 | 2078 | ||
2079 | if (nfserr == nfserr_symlink) | 2079 | if (nfserr == nfserr_symlink) |