nfsproc.c (ebcd8e8b28535b643a4c06685bd363b3b73a96af) | nfsproc.c (8c293ef993c8df0b1bea9ecb0de6eb96dec3ac9d) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Process version 2 NFS requests. 4 * 5 * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de> 6 */ 7 8#include <linux/namei.h> --- 157 unchanged lines hidden (view full) --- 166 * Read a portion of a file. 167 * N.B. After this call resp->fh needs an fh_put 168 */ 169static __be32 170nfsd_proc_read(struct svc_rqst *rqstp) 171{ 172 struct nfsd_readargs *argp = rqstp->rq_argp; 173 struct nfsd_readres *resp = rqstp->rq_resp; | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Process version 2 NFS requests. 4 * 5 * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de> 6 */ 7 8#include <linux/namei.h> --- 157 unchanged lines hidden (view full) --- 166 * Read a portion of a file. 167 * N.B. After this call resp->fh needs an fh_put 168 */ 169static __be32 170nfsd_proc_read(struct svc_rqst *rqstp) 171{ 172 struct nfsd_readargs *argp = rqstp->rq_argp; 173 struct nfsd_readres *resp = rqstp->rq_resp; |
174 unsigned int len; |
|
174 u32 eof; | 175 u32 eof; |
176 int v; |
|
175 176 dprintk("nfsd: READ %s %d bytes at %d\n", 177 SVCFH_fmt(&argp->fh), 178 argp->count, argp->offset); 179 | 177 178 dprintk("nfsd: READ %s %d bytes at %d\n", 179 SVCFH_fmt(&argp->fh), 180 argp->count, argp->offset); 181 |
182 argp->count = min_t(u32, argp->count, NFSSVC_MAXBLKSIZE_V2); 183 184 v = 0; 185 len = argp->count; 186 while (len > 0) { 187 struct page *page = *(rqstp->rq_next_page++); 188 189 rqstp->rq_vec[v].iov_base = page_address(page); 190 rqstp->rq_vec[v].iov_len = min_t(unsigned int, len, PAGE_SIZE); 191 len -= rqstp->rq_vec[v].iov_len; 192 v++; 193 } 194 |
|
180 /* Obtain buffer pointer for payload. 19 is 1 word for 181 * status, 17 words for fattr, and 1 word for the byte count. 182 */ | 195 /* Obtain buffer pointer for payload. 19 is 1 word for 196 * status, 17 words for fattr, and 1 word for the byte count. 197 */ |
183 184 if (NFSSVC_MAXBLKSIZE_V2 < argp->count) { 185 char buf[RPC_MAX_ADDRBUFLEN]; 186 printk(KERN_NOTICE 187 "oversized read request from %s (%d bytes)\n", 188 svc_print_addr(rqstp, buf, sizeof(buf)), 189 argp->count); 190 argp->count = NFSSVC_MAXBLKSIZE_V2; 191 } | |
192 svc_reserve_auth(rqstp, (19<<2) + argp->count + 4); 193 194 resp->count = argp->count; | 198 svc_reserve_auth(rqstp, (19<<2) + argp->count + 4); 199 200 resp->count = argp->count; |
195 resp->status = nfsd_read(rqstp, fh_copy(&resp->fh, &argp->fh), 196 argp->offset, 197 rqstp->rq_vec, argp->vlen, 198 &resp->count, 199 &eof); | 201 fh_copy(&resp->fh, &argp->fh); 202 resp->status = nfsd_read(rqstp, &resp->fh, argp->offset, 203 rqstp->rq_vec, v, &resp->count, &eof); |
200 if (resp->status == nfs_ok) 201 resp->status = fh_getattr(&resp->fh, &resp->stat); 202 else if (resp->status == nfserr_jukebox) 203 return rpc_drop_reply; 204 return rpc_success; 205} 206 207/* Reserved */ --- 666 unchanged lines hidden --- | 204 if (resp->status == nfs_ok) 205 resp->status = fh_getattr(&resp->fh, &resp->stat); 206 else if (resp->status == nfserr_jukebox) 207 return rpc_drop_reply; 208 return rpc_success; 209} 210 211/* Reserved */ --- 666 unchanged lines hidden --- |