aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs3proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfsd/nfs3proc.c')
-rw-r--r--fs/nfsd/nfs3proc.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
index 7b755b7f785c..51c3b06e8036 100644
--- a/fs/nfsd/nfs3proc.c
+++ b/fs/nfsd/nfs3proc.c
@@ -147,6 +147,7 @@ nfsd3_proc_read(struct svc_rqst *rqstp, struct nfsd3_readargs *argp,
147{ 147{
148 __be32 nfserr; 148 __be32 nfserr;
149 u32 max_blocksize = svc_max_payload(rqstp); 149 u32 max_blocksize = svc_max_payload(rqstp);
150 unsigned long cnt = min(argp->count, max_blocksize);
150 151
151 dprintk("nfsd: READ(3) %s %lu bytes at %Lu\n", 152 dprintk("nfsd: READ(3) %s %lu bytes at %Lu\n",
152 SVCFH_fmt(&argp->fh), 153 SVCFH_fmt(&argp->fh),
@@ -157,7 +158,7 @@ nfsd3_proc_read(struct svc_rqst *rqstp, struct nfsd3_readargs *argp,
157 * 1 (status) + 22 (post_op_attr) + 1 (count) + 1 (eof) 158 * 1 (status) + 22 (post_op_attr) + 1 (count) + 1 (eof)
158 * + 1 (xdr opaque byte count) = 26 159 * + 1 (xdr opaque byte count) = 26
159 */ 160 */
160 resp->count = min(argp->count, max_blocksize); 161 resp->count = cnt;
161 svc_reserve_auth(rqstp, ((1 + NFS3_POST_OP_ATTR_WORDS + 3)<<2) + resp->count +4); 162 svc_reserve_auth(rqstp, ((1 + NFS3_POST_OP_ATTR_WORDS + 3)<<2) + resp->count +4);
162 163
163 fh_copy(&resp->fh, &argp->fh); 164 fh_copy(&resp->fh, &argp->fh);
@@ -167,8 +168,8 @@ nfsd3_proc_read(struct svc_rqst *rqstp, struct nfsd3_readargs *argp,
167 &resp->count); 168 &resp->count);
168 if (nfserr == 0) { 169 if (nfserr == 0) {
169 struct inode *inode = d_inode(resp->fh.fh_dentry); 170 struct inode *inode = d_inode(resp->fh.fh_dentry);
170 171 resp->eof = nfsd_eof_on_read(cnt, resp->count, argp->offset,
171 resp->eof = (argp->offset + resp->count) >= inode->i_size; 172 inode->i_size);
172 } 173 }
173 174
174 RETURN_STATUS(nfserr); 175 RETURN_STATUS(nfserr);