diff options
Diffstat (limited to 'fs/nfsd/nfs3xdr.c')
-rw-r--r-- | fs/nfsd/nfs3xdr.c | 182 |
1 files changed, 90 insertions, 92 deletions
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c index 243d94b9653a..b4baca3053c3 100644 --- a/fs/nfsd/nfs3xdr.c +++ b/fs/nfsd/nfs3xdr.c | |||
@@ -42,23 +42,23 @@ static u32 nfs3_ftypes[] = { | |||
42 | /* | 42 | /* |
43 | * XDR functions for basic NFS types | 43 | * XDR functions for basic NFS types |
44 | */ | 44 | */ |
45 | static inline u32 * | 45 | static inline __be32 * |
46 | encode_time3(u32 *p, struct timespec *time) | 46 | encode_time3(__be32 *p, struct timespec *time) |
47 | { | 47 | { |
48 | *p++ = htonl((u32) time->tv_sec); *p++ = htonl(time->tv_nsec); | 48 | *p++ = htonl((u32) time->tv_sec); *p++ = htonl(time->tv_nsec); |
49 | return p; | 49 | return p; |
50 | } | 50 | } |
51 | 51 | ||
52 | static inline u32 * | 52 | static inline __be32 * |
53 | decode_time3(u32 *p, struct timespec *time) | 53 | decode_time3(__be32 *p, struct timespec *time) |
54 | { | 54 | { |
55 | time->tv_sec = ntohl(*p++); | 55 | time->tv_sec = ntohl(*p++); |
56 | time->tv_nsec = ntohl(*p++); | 56 | time->tv_nsec = ntohl(*p++); |
57 | return p; | 57 | return p; |
58 | } | 58 | } |
59 | 59 | ||
60 | static inline u32 * | 60 | static inline __be32 * |
61 | decode_fh(u32 *p, struct svc_fh *fhp) | 61 | decode_fh(__be32 *p, struct svc_fh *fhp) |
62 | { | 62 | { |
63 | unsigned int size; | 63 | unsigned int size; |
64 | fh_init(fhp, NFS3_FHSIZE); | 64 | fh_init(fhp, NFS3_FHSIZE); |
@@ -72,13 +72,13 @@ decode_fh(u32 *p, struct svc_fh *fhp) | |||
72 | } | 72 | } |
73 | 73 | ||
74 | /* Helper function for NFSv3 ACL code */ | 74 | /* Helper function for NFSv3 ACL code */ |
75 | u32 *nfs3svc_decode_fh(u32 *p, struct svc_fh *fhp) | 75 | __be32 *nfs3svc_decode_fh(__be32 *p, struct svc_fh *fhp) |
76 | { | 76 | { |
77 | return decode_fh(p, fhp); | 77 | return decode_fh(p, fhp); |
78 | } | 78 | } |
79 | 79 | ||
80 | static inline u32 * | 80 | static inline __be32 * |
81 | encode_fh(u32 *p, struct svc_fh *fhp) | 81 | encode_fh(__be32 *p, struct svc_fh *fhp) |
82 | { | 82 | { |
83 | unsigned int size = fhp->fh_handle.fh_size; | 83 | unsigned int size = fhp->fh_handle.fh_size; |
84 | *p++ = htonl(size); | 84 | *p++ = htonl(size); |
@@ -91,8 +91,8 @@ encode_fh(u32 *p, struct svc_fh *fhp) | |||
91 | * Decode a file name and make sure that the path contains | 91 | * Decode a file name and make sure that the path contains |
92 | * no slashes or null bytes. | 92 | * no slashes or null bytes. |
93 | */ | 93 | */ |
94 | static inline u32 * | 94 | static inline __be32 * |
95 | decode_filename(u32 *p, char **namp, int *lenp) | 95 | decode_filename(__be32 *p, char **namp, int *lenp) |
96 | { | 96 | { |
97 | char *name; | 97 | char *name; |
98 | int i; | 98 | int i; |
@@ -107,8 +107,8 @@ decode_filename(u32 *p, char **namp, int *lenp) | |||
107 | return p; | 107 | return p; |
108 | } | 108 | } |
109 | 109 | ||
110 | static inline u32 * | 110 | static inline __be32 * |
111 | decode_sattr3(u32 *p, struct iattr *iap) | 111 | decode_sattr3(__be32 *p, struct iattr *iap) |
112 | { | 112 | { |
113 | u32 tmp; | 113 | u32 tmp; |
114 | 114 | ||
@@ -153,8 +153,8 @@ decode_sattr3(u32 *p, struct iattr *iap) | |||
153 | return p; | 153 | return p; |
154 | } | 154 | } |
155 | 155 | ||
156 | static inline u32 * | 156 | static inline __be32 * |
157 | encode_fattr3(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp, | 157 | encode_fattr3(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp, |
158 | struct kstat *stat) | 158 | struct kstat *stat) |
159 | { | 159 | { |
160 | struct dentry *dentry = fhp->fh_dentry; | 160 | struct dentry *dentry = fhp->fh_dentry; |
@@ -186,8 +186,8 @@ encode_fattr3(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp, | |||
186 | return p; | 186 | return p; |
187 | } | 187 | } |
188 | 188 | ||
189 | static inline u32 * | 189 | static inline __be32 * |
190 | encode_saved_post_attr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp) | 190 | encode_saved_post_attr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp) |
191 | { | 191 | { |
192 | struct inode *inode = fhp->fh_dentry->d_inode; | 192 | struct inode *inode = fhp->fh_dentry->d_inode; |
193 | 193 | ||
@@ -224,8 +224,8 @@ encode_saved_post_attr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp) | |||
224 | * The inode may be NULL if the call failed because of a stale file | 224 | * The inode may be NULL if the call failed because of a stale file |
225 | * handle. In this case, no attributes are returned. | 225 | * handle. In this case, no attributes are returned. |
226 | */ | 226 | */ |
227 | static u32 * | 227 | static __be32 * |
228 | encode_post_op_attr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp) | 228 | encode_post_op_attr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp) |
229 | { | 229 | { |
230 | struct dentry *dentry = fhp->fh_dentry; | 230 | struct dentry *dentry = fhp->fh_dentry; |
231 | if (dentry && dentry->d_inode != NULL) { | 231 | if (dentry && dentry->d_inode != NULL) { |
@@ -243,8 +243,8 @@ encode_post_op_attr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp) | |||
243 | } | 243 | } |
244 | 244 | ||
245 | /* Helper for NFSv3 ACLs */ | 245 | /* Helper for NFSv3 ACLs */ |
246 | u32 * | 246 | __be32 * |
247 | nfs3svc_encode_post_op_attr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp) | 247 | nfs3svc_encode_post_op_attr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp) |
248 | { | 248 | { |
249 | return encode_post_op_attr(rqstp, p, fhp); | 249 | return encode_post_op_attr(rqstp, p, fhp); |
250 | } | 250 | } |
@@ -252,8 +252,8 @@ nfs3svc_encode_post_op_attr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp) | |||
252 | /* | 252 | /* |
253 | * Enocde weak cache consistency data | 253 | * Enocde weak cache consistency data |
254 | */ | 254 | */ |
255 | static u32 * | 255 | static __be32 * |
256 | encode_wcc_data(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp) | 256 | encode_wcc_data(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp) |
257 | { | 257 | { |
258 | struct dentry *dentry = fhp->fh_dentry; | 258 | struct dentry *dentry = fhp->fh_dentry; |
259 | 259 | ||
@@ -278,7 +278,7 @@ encode_wcc_data(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp) | |||
278 | * XDR decode functions | 278 | * XDR decode functions |
279 | */ | 279 | */ |
280 | int | 280 | int |
281 | nfs3svc_decode_fhandle(struct svc_rqst *rqstp, u32 *p, struct nfsd_fhandle *args) | 281 | nfs3svc_decode_fhandle(struct svc_rqst *rqstp, __be32 *p, struct nfsd_fhandle *args) |
282 | { | 282 | { |
283 | if (!(p = decode_fh(p, &args->fh))) | 283 | if (!(p = decode_fh(p, &args->fh))) |
284 | return 0; | 284 | return 0; |
@@ -286,7 +286,7 @@ nfs3svc_decode_fhandle(struct svc_rqst *rqstp, u32 *p, struct nfsd_fhandle *args | |||
286 | } | 286 | } |
287 | 287 | ||
288 | int | 288 | int |
289 | nfs3svc_decode_sattrargs(struct svc_rqst *rqstp, u32 *p, | 289 | nfs3svc_decode_sattrargs(struct svc_rqst *rqstp, __be32 *p, |
290 | struct nfsd3_sattrargs *args) | 290 | struct nfsd3_sattrargs *args) |
291 | { | 291 | { |
292 | if (!(p = decode_fh(p, &args->fh)) | 292 | if (!(p = decode_fh(p, &args->fh)) |
@@ -303,7 +303,7 @@ nfs3svc_decode_sattrargs(struct svc_rqst *rqstp, u32 *p, | |||
303 | } | 303 | } |
304 | 304 | ||
305 | int | 305 | int |
306 | nfs3svc_decode_diropargs(struct svc_rqst *rqstp, u32 *p, | 306 | nfs3svc_decode_diropargs(struct svc_rqst *rqstp, __be32 *p, |
307 | struct nfsd3_diropargs *args) | 307 | struct nfsd3_diropargs *args) |
308 | { | 308 | { |
309 | if (!(p = decode_fh(p, &args->fh)) | 309 | if (!(p = decode_fh(p, &args->fh)) |
@@ -314,7 +314,7 @@ nfs3svc_decode_diropargs(struct svc_rqst *rqstp, u32 *p, | |||
314 | } | 314 | } |
315 | 315 | ||
316 | int | 316 | int |
317 | nfs3svc_decode_accessargs(struct svc_rqst *rqstp, u32 *p, | 317 | nfs3svc_decode_accessargs(struct svc_rqst *rqstp, __be32 *p, |
318 | struct nfsd3_accessargs *args) | 318 | struct nfsd3_accessargs *args) |
319 | { | 319 | { |
320 | if (!(p = decode_fh(p, &args->fh))) | 320 | if (!(p = decode_fh(p, &args->fh))) |
@@ -325,11 +325,12 @@ nfs3svc_decode_accessargs(struct svc_rqst *rqstp, u32 *p, | |||
325 | } | 325 | } |
326 | 326 | ||
327 | int | 327 | int |
328 | nfs3svc_decode_readargs(struct svc_rqst *rqstp, u32 *p, | 328 | nfs3svc_decode_readargs(struct svc_rqst *rqstp, __be32 *p, |
329 | struct nfsd3_readargs *args) | 329 | struct nfsd3_readargs *args) |
330 | { | 330 | { |
331 | unsigned int len; | 331 | unsigned int len; |
332 | int v,pn; | 332 | int v,pn; |
333 | u32 max_blocksize = svc_max_payload(rqstp); | ||
333 | 334 | ||
334 | if (!(p = decode_fh(p, &args->fh)) | 335 | if (!(p = decode_fh(p, &args->fh)) |
335 | || !(p = xdr_decode_hyper(p, &args->offset))) | 336 | || !(p = xdr_decode_hyper(p, &args->offset))) |
@@ -337,17 +338,16 @@ nfs3svc_decode_readargs(struct svc_rqst *rqstp, u32 *p, | |||
337 | 338 | ||
338 | len = args->count = ntohl(*p++); | 339 | len = args->count = ntohl(*p++); |
339 | 340 | ||
340 | if (len > NFSSVC_MAXBLKSIZE) | 341 | if (len > max_blocksize) |
341 | len = NFSSVC_MAXBLKSIZE; | 342 | len = max_blocksize; |
342 | 343 | ||
343 | /* set up the kvec */ | 344 | /* set up the kvec */ |
344 | v=0; | 345 | v=0; |
345 | while (len > 0) { | 346 | while (len > 0) { |
346 | pn = rqstp->rq_resused; | 347 | pn = rqstp->rq_resused++; |
347 | svc_take_page(rqstp); | 348 | rqstp->rq_vec[v].iov_base = page_address(rqstp->rq_respages[pn]); |
348 | args->vec[v].iov_base = page_address(rqstp->rq_respages[pn]); | 349 | rqstp->rq_vec[v].iov_len = len < PAGE_SIZE? len : PAGE_SIZE; |
349 | args->vec[v].iov_len = len < PAGE_SIZE? len : PAGE_SIZE; | 350 | len -= rqstp->rq_vec[v].iov_len; |
350 | len -= args->vec[v].iov_len; | ||
351 | v++; | 351 | v++; |
352 | } | 352 | } |
353 | args->vlen = v; | 353 | args->vlen = v; |
@@ -355,10 +355,11 @@ nfs3svc_decode_readargs(struct svc_rqst *rqstp, u32 *p, | |||
355 | } | 355 | } |
356 | 356 | ||
357 | int | 357 | int |
358 | nfs3svc_decode_writeargs(struct svc_rqst *rqstp, u32 *p, | 358 | nfs3svc_decode_writeargs(struct svc_rqst *rqstp, __be32 *p, |
359 | struct nfsd3_writeargs *args) | 359 | struct nfsd3_writeargs *args) |
360 | { | 360 | { |
361 | unsigned int len, v, hdr; | 361 | unsigned int len, v, hdr; |
362 | u32 max_blocksize = svc_max_payload(rqstp); | ||
362 | 363 | ||
363 | if (!(p = decode_fh(p, &args->fh)) | 364 | if (!(p = decode_fh(p, &args->fh)) |
364 | || !(p = xdr_decode_hyper(p, &args->offset))) | 365 | || !(p = xdr_decode_hyper(p, &args->offset))) |
@@ -373,26 +374,26 @@ nfs3svc_decode_writeargs(struct svc_rqst *rqstp, u32 *p, | |||
373 | rqstp->rq_arg.len - hdr < len) | 374 | rqstp->rq_arg.len - hdr < len) |
374 | return 0; | 375 | return 0; |
375 | 376 | ||
376 | args->vec[0].iov_base = (void*)p; | 377 | rqstp->rq_vec[0].iov_base = (void*)p; |
377 | args->vec[0].iov_len = rqstp->rq_arg.head[0].iov_len - hdr; | 378 | rqstp->rq_vec[0].iov_len = rqstp->rq_arg.head[0].iov_len - hdr; |
378 | 379 | ||
379 | if (len > NFSSVC_MAXBLKSIZE) | 380 | if (len > max_blocksize) |
380 | len = NFSSVC_MAXBLKSIZE; | 381 | len = max_blocksize; |
381 | v= 0; | 382 | v= 0; |
382 | while (len > args->vec[v].iov_len) { | 383 | while (len > rqstp->rq_vec[v].iov_len) { |
383 | len -= args->vec[v].iov_len; | 384 | len -= rqstp->rq_vec[v].iov_len; |
384 | v++; | 385 | v++; |
385 | args->vec[v].iov_base = page_address(rqstp->rq_argpages[v]); | 386 | rqstp->rq_vec[v].iov_base = page_address(rqstp->rq_pages[v]); |
386 | args->vec[v].iov_len = PAGE_SIZE; | 387 | rqstp->rq_vec[v].iov_len = PAGE_SIZE; |
387 | } | 388 | } |
388 | args->vec[v].iov_len = len; | 389 | rqstp->rq_vec[v].iov_len = len; |
389 | args->vlen = v+1; | 390 | args->vlen = v+1; |
390 | 391 | ||
391 | return args->count == args->len && args->vec[0].iov_len > 0; | 392 | return args->count == args->len && rqstp->rq_vec[0].iov_len > 0; |
392 | } | 393 | } |
393 | 394 | ||
394 | int | 395 | int |
395 | nfs3svc_decode_createargs(struct svc_rqst *rqstp, u32 *p, | 396 | nfs3svc_decode_createargs(struct svc_rqst *rqstp, __be32 *p, |
396 | struct nfsd3_createargs *args) | 397 | struct nfsd3_createargs *args) |
397 | { | 398 | { |
398 | if (!(p = decode_fh(p, &args->fh)) | 399 | if (!(p = decode_fh(p, &args->fh)) |
@@ -416,7 +417,7 @@ nfs3svc_decode_createargs(struct svc_rqst *rqstp, u32 *p, | |||
416 | return xdr_argsize_check(rqstp, p); | 417 | return xdr_argsize_check(rqstp, p); |
417 | } | 418 | } |
418 | int | 419 | int |
419 | nfs3svc_decode_mkdirargs(struct svc_rqst *rqstp, u32 *p, | 420 | nfs3svc_decode_mkdirargs(struct svc_rqst *rqstp, __be32 *p, |
420 | struct nfsd3_createargs *args) | 421 | struct nfsd3_createargs *args) |
421 | { | 422 | { |
422 | if (!(p = decode_fh(p, &args->fh)) | 423 | if (!(p = decode_fh(p, &args->fh)) |
@@ -428,7 +429,7 @@ nfs3svc_decode_mkdirargs(struct svc_rqst *rqstp, u32 *p, | |||
428 | } | 429 | } |
429 | 430 | ||
430 | int | 431 | int |
431 | nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, u32 *p, | 432 | nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, __be32 *p, |
432 | struct nfsd3_symlinkargs *args) | 433 | struct nfsd3_symlinkargs *args) |
433 | { | 434 | { |
434 | unsigned int len; | 435 | unsigned int len; |
@@ -446,11 +447,11 @@ nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, u32 *p, | |||
446 | * This page appears in the rq_res.pages list, but as pages_len is always | 447 | * This page appears in the rq_res.pages list, but as pages_len is always |
447 | * 0, it won't get in the way | 448 | * 0, it won't get in the way |
448 | */ | 449 | */ |
449 | svc_take_page(rqstp); | ||
450 | len = ntohl(*p++); | 450 | len = ntohl(*p++); |
451 | if (len == 0 || len > NFS3_MAXPATHLEN || len >= PAGE_SIZE) | 451 | if (len == 0 || len > NFS3_MAXPATHLEN || len >= PAGE_SIZE) |
452 | return 0; | 452 | return 0; |
453 | args->tname = new = page_address(rqstp->rq_respages[rqstp->rq_resused-1]); | 453 | args->tname = new = |
454 | page_address(rqstp->rq_respages[rqstp->rq_resused++]); | ||
454 | args->tlen = len; | 455 | args->tlen = len; |
455 | /* first copy and check from the first page */ | 456 | /* first copy and check from the first page */ |
456 | old = (char*)p; | 457 | old = (char*)p; |
@@ -480,7 +481,7 @@ nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, u32 *p, | |||
480 | } | 481 | } |
481 | 482 | ||
482 | int | 483 | int |
483 | nfs3svc_decode_mknodargs(struct svc_rqst *rqstp, u32 *p, | 484 | nfs3svc_decode_mknodargs(struct svc_rqst *rqstp, __be32 *p, |
484 | struct nfsd3_mknodargs *args) | 485 | struct nfsd3_mknodargs *args) |
485 | { | 486 | { |
486 | if (!(p = decode_fh(p, &args->fh)) | 487 | if (!(p = decode_fh(p, &args->fh)) |
@@ -504,7 +505,7 @@ nfs3svc_decode_mknodargs(struct svc_rqst *rqstp, u32 *p, | |||
504 | } | 505 | } |
505 | 506 | ||
506 | int | 507 | int |
507 | nfs3svc_decode_renameargs(struct svc_rqst *rqstp, u32 *p, | 508 | nfs3svc_decode_renameargs(struct svc_rqst *rqstp, __be32 *p, |
508 | struct nfsd3_renameargs *args) | 509 | struct nfsd3_renameargs *args) |
509 | { | 510 | { |
510 | if (!(p = decode_fh(p, &args->ffh)) | 511 | if (!(p = decode_fh(p, &args->ffh)) |
@@ -517,19 +518,19 @@ nfs3svc_decode_renameargs(struct svc_rqst *rqstp, u32 *p, | |||
517 | } | 518 | } |
518 | 519 | ||
519 | int | 520 | int |
520 | nfs3svc_decode_readlinkargs(struct svc_rqst *rqstp, u32 *p, | 521 | nfs3svc_decode_readlinkargs(struct svc_rqst *rqstp, __be32 *p, |
521 | struct nfsd3_readlinkargs *args) | 522 | struct nfsd3_readlinkargs *args) |
522 | { | 523 | { |
523 | if (!(p = decode_fh(p, &args->fh))) | 524 | if (!(p = decode_fh(p, &args->fh))) |
524 | return 0; | 525 | return 0; |
525 | svc_take_page(rqstp); | 526 | args->buffer = |
526 | args->buffer = page_address(rqstp->rq_respages[rqstp->rq_resused-1]); | 527 | page_address(rqstp->rq_respages[rqstp->rq_resused++]); |
527 | 528 | ||
528 | return xdr_argsize_check(rqstp, p); | 529 | return xdr_argsize_check(rqstp, p); |
529 | } | 530 | } |
530 | 531 | ||
531 | int | 532 | int |
532 | nfs3svc_decode_linkargs(struct svc_rqst *rqstp, u32 *p, | 533 | nfs3svc_decode_linkargs(struct svc_rqst *rqstp, __be32 *p, |
533 | struct nfsd3_linkargs *args) | 534 | struct nfsd3_linkargs *args) |
534 | { | 535 | { |
535 | if (!(p = decode_fh(p, &args->ffh)) | 536 | if (!(p = decode_fh(p, &args->ffh)) |
@@ -541,7 +542,7 @@ nfs3svc_decode_linkargs(struct svc_rqst *rqstp, u32 *p, | |||
541 | } | 542 | } |
542 | 543 | ||
543 | int | 544 | int |
544 | nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, u32 *p, | 545 | nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p, |
545 | struct nfsd3_readdirargs *args) | 546 | struct nfsd3_readdirargs *args) |
546 | { | 547 | { |
547 | if (!(p = decode_fh(p, &args->fh))) | 548 | if (!(p = decode_fh(p, &args->fh))) |
@@ -554,17 +555,18 @@ nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, u32 *p, | |||
554 | if (args->count > PAGE_SIZE) | 555 | if (args->count > PAGE_SIZE) |
555 | args->count = PAGE_SIZE; | 556 | args->count = PAGE_SIZE; |
556 | 557 | ||
557 | svc_take_page(rqstp); | 558 | args->buffer = |
558 | args->buffer = page_address(rqstp->rq_respages[rqstp->rq_resused-1]); | 559 | page_address(rqstp->rq_respages[rqstp->rq_resused++]); |
559 | 560 | ||
560 | return xdr_argsize_check(rqstp, p); | 561 | return xdr_argsize_check(rqstp, p); |
561 | } | 562 | } |
562 | 563 | ||
563 | int | 564 | int |
564 | nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, u32 *p, | 565 | nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, __be32 *p, |
565 | struct nfsd3_readdirargs *args) | 566 | struct nfsd3_readdirargs *args) |
566 | { | 567 | { |
567 | int len, pn; | 568 | int len, pn; |
569 | u32 max_blocksize = svc_max_payload(rqstp); | ||
568 | 570 | ||
569 | if (!(p = decode_fh(p, &args->fh))) | 571 | if (!(p = decode_fh(p, &args->fh))) |
570 | return 0; | 572 | return 0; |
@@ -573,13 +575,12 @@ nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, u32 *p, | |||
573 | args->dircount = ntohl(*p++); | 575 | args->dircount = ntohl(*p++); |
574 | args->count = ntohl(*p++); | 576 | args->count = ntohl(*p++); |
575 | 577 | ||
576 | len = (args->count > NFSSVC_MAXBLKSIZE) ? NFSSVC_MAXBLKSIZE : | 578 | len = (args->count > max_blocksize) ? max_blocksize : |
577 | args->count; | 579 | args->count; |
578 | args->count = len; | 580 | args->count = len; |
579 | 581 | ||
580 | while (len > 0) { | 582 | while (len > 0) { |
581 | pn = rqstp->rq_resused; | 583 | pn = rqstp->rq_resused++; |
582 | svc_take_page(rqstp); | ||
583 | if (!args->buffer) | 584 | if (!args->buffer) |
584 | args->buffer = page_address(rqstp->rq_respages[pn]); | 585 | args->buffer = page_address(rqstp->rq_respages[pn]); |
585 | len -= PAGE_SIZE; | 586 | len -= PAGE_SIZE; |
@@ -589,7 +590,7 @@ nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, u32 *p, | |||
589 | } | 590 | } |
590 | 591 | ||
591 | int | 592 | int |
592 | nfs3svc_decode_commitargs(struct svc_rqst *rqstp, u32 *p, | 593 | nfs3svc_decode_commitargs(struct svc_rqst *rqstp, __be32 *p, |
593 | struct nfsd3_commitargs *args) | 594 | struct nfsd3_commitargs *args) |
594 | { | 595 | { |
595 | if (!(p = decode_fh(p, &args->fh))) | 596 | if (!(p = decode_fh(p, &args->fh))) |
@@ -608,14 +609,14 @@ nfs3svc_decode_commitargs(struct svc_rqst *rqstp, u32 *p, | |||
608 | * will work properly. | 609 | * will work properly. |
609 | */ | 610 | */ |
610 | int | 611 | int |
611 | nfs3svc_encode_voidres(struct svc_rqst *rqstp, u32 *p, void *dummy) | 612 | nfs3svc_encode_voidres(struct svc_rqst *rqstp, __be32 *p, void *dummy) |
612 | { | 613 | { |
613 | return xdr_ressize_check(rqstp, p); | 614 | return xdr_ressize_check(rqstp, p); |
614 | } | 615 | } |
615 | 616 | ||
616 | /* GETATTR */ | 617 | /* GETATTR */ |
617 | int | 618 | int |
618 | nfs3svc_encode_attrstat(struct svc_rqst *rqstp, u32 *p, | 619 | nfs3svc_encode_attrstat(struct svc_rqst *rqstp, __be32 *p, |
619 | struct nfsd3_attrstat *resp) | 620 | struct nfsd3_attrstat *resp) |
620 | { | 621 | { |
621 | if (resp->status == 0) | 622 | if (resp->status == 0) |
@@ -625,7 +626,7 @@ nfs3svc_encode_attrstat(struct svc_rqst *rqstp, u32 *p, | |||
625 | 626 | ||
626 | /* SETATTR, REMOVE, RMDIR */ | 627 | /* SETATTR, REMOVE, RMDIR */ |
627 | int | 628 | int |
628 | nfs3svc_encode_wccstat(struct svc_rqst *rqstp, u32 *p, | 629 | nfs3svc_encode_wccstat(struct svc_rqst *rqstp, __be32 *p, |
629 | struct nfsd3_attrstat *resp) | 630 | struct nfsd3_attrstat *resp) |
630 | { | 631 | { |
631 | p = encode_wcc_data(rqstp, p, &resp->fh); | 632 | p = encode_wcc_data(rqstp, p, &resp->fh); |
@@ -634,7 +635,7 @@ nfs3svc_encode_wccstat(struct svc_rqst *rqstp, u32 *p, | |||
634 | 635 | ||
635 | /* LOOKUP */ | 636 | /* LOOKUP */ |
636 | int | 637 | int |
637 | nfs3svc_encode_diropres(struct svc_rqst *rqstp, u32 *p, | 638 | nfs3svc_encode_diropres(struct svc_rqst *rqstp, __be32 *p, |
638 | struct nfsd3_diropres *resp) | 639 | struct nfsd3_diropres *resp) |
639 | { | 640 | { |
640 | if (resp->status == 0) { | 641 | if (resp->status == 0) { |
@@ -647,7 +648,7 @@ nfs3svc_encode_diropres(struct svc_rqst *rqstp, u32 *p, | |||
647 | 648 | ||
648 | /* ACCESS */ | 649 | /* ACCESS */ |
649 | int | 650 | int |
650 | nfs3svc_encode_accessres(struct svc_rqst *rqstp, u32 *p, | 651 | nfs3svc_encode_accessres(struct svc_rqst *rqstp, __be32 *p, |
651 | struct nfsd3_accessres *resp) | 652 | struct nfsd3_accessres *resp) |
652 | { | 653 | { |
653 | p = encode_post_op_attr(rqstp, p, &resp->fh); | 654 | p = encode_post_op_attr(rqstp, p, &resp->fh); |
@@ -658,7 +659,7 @@ nfs3svc_encode_accessres(struct svc_rqst *rqstp, u32 *p, | |||
658 | 659 | ||
659 | /* READLINK */ | 660 | /* READLINK */ |
660 | int | 661 | int |
661 | nfs3svc_encode_readlinkres(struct svc_rqst *rqstp, u32 *p, | 662 | nfs3svc_encode_readlinkres(struct svc_rqst *rqstp, __be32 *p, |
662 | struct nfsd3_readlinkres *resp) | 663 | struct nfsd3_readlinkres *resp) |
663 | { | 664 | { |
664 | p = encode_post_op_attr(rqstp, p, &resp->fh); | 665 | p = encode_post_op_attr(rqstp, p, &resp->fh); |
@@ -668,7 +669,6 @@ nfs3svc_encode_readlinkres(struct svc_rqst *rqstp, u32 *p, | |||
668 | rqstp->rq_res.page_len = resp->len; | 669 | rqstp->rq_res.page_len = resp->len; |
669 | if (resp->len & 3) { | 670 | if (resp->len & 3) { |
670 | /* need to pad the tail */ | 671 | /* need to pad the tail */ |
671 | rqstp->rq_restailpage = 0; | ||
672 | rqstp->rq_res.tail[0].iov_base = p; | 672 | rqstp->rq_res.tail[0].iov_base = p; |
673 | *p = 0; | 673 | *p = 0; |
674 | rqstp->rq_res.tail[0].iov_len = 4 - (resp->len&3); | 674 | rqstp->rq_res.tail[0].iov_len = 4 - (resp->len&3); |
@@ -680,7 +680,7 @@ nfs3svc_encode_readlinkres(struct svc_rqst *rqstp, u32 *p, | |||
680 | 680 | ||
681 | /* READ */ | 681 | /* READ */ |
682 | int | 682 | int |
683 | nfs3svc_encode_readres(struct svc_rqst *rqstp, u32 *p, | 683 | nfs3svc_encode_readres(struct svc_rqst *rqstp, __be32 *p, |
684 | struct nfsd3_readres *resp) | 684 | struct nfsd3_readres *resp) |
685 | { | 685 | { |
686 | p = encode_post_op_attr(rqstp, p, &resp->fh); | 686 | p = encode_post_op_attr(rqstp, p, &resp->fh); |
@@ -693,7 +693,6 @@ nfs3svc_encode_readres(struct svc_rqst *rqstp, u32 *p, | |||
693 | rqstp->rq_res.page_len = resp->count; | 693 | rqstp->rq_res.page_len = resp->count; |
694 | if (resp->count & 3) { | 694 | if (resp->count & 3) { |
695 | /* need to pad the tail */ | 695 | /* need to pad the tail */ |
696 | rqstp->rq_restailpage = 0; | ||
697 | rqstp->rq_res.tail[0].iov_base = p; | 696 | rqstp->rq_res.tail[0].iov_base = p; |
698 | *p = 0; | 697 | *p = 0; |
699 | rqstp->rq_res.tail[0].iov_len = 4 - (resp->count & 3); | 698 | rqstp->rq_res.tail[0].iov_len = 4 - (resp->count & 3); |
@@ -705,7 +704,7 @@ nfs3svc_encode_readres(struct svc_rqst *rqstp, u32 *p, | |||
705 | 704 | ||
706 | /* WRITE */ | 705 | /* WRITE */ |
707 | int | 706 | int |
708 | nfs3svc_encode_writeres(struct svc_rqst *rqstp, u32 *p, | 707 | nfs3svc_encode_writeres(struct svc_rqst *rqstp, __be32 *p, |
709 | struct nfsd3_writeres *resp) | 708 | struct nfsd3_writeres *resp) |
710 | { | 709 | { |
711 | p = encode_wcc_data(rqstp, p, &resp->fh); | 710 | p = encode_wcc_data(rqstp, p, &resp->fh); |
@@ -720,7 +719,7 @@ nfs3svc_encode_writeres(struct svc_rqst *rqstp, u32 *p, | |||
720 | 719 | ||
721 | /* CREATE, MKDIR, SYMLINK, MKNOD */ | 720 | /* CREATE, MKDIR, SYMLINK, MKNOD */ |
722 | int | 721 | int |
723 | nfs3svc_encode_createres(struct svc_rqst *rqstp, u32 *p, | 722 | nfs3svc_encode_createres(struct svc_rqst *rqstp, __be32 *p, |
724 | struct nfsd3_diropres *resp) | 723 | struct nfsd3_diropres *resp) |
725 | { | 724 | { |
726 | if (resp->status == 0) { | 725 | if (resp->status == 0) { |
@@ -734,7 +733,7 @@ nfs3svc_encode_createres(struct svc_rqst *rqstp, u32 *p, | |||
734 | 733 | ||
735 | /* RENAME */ | 734 | /* RENAME */ |
736 | int | 735 | int |
737 | nfs3svc_encode_renameres(struct svc_rqst *rqstp, u32 *p, | 736 | nfs3svc_encode_renameres(struct svc_rqst *rqstp, __be32 *p, |
738 | struct nfsd3_renameres *resp) | 737 | struct nfsd3_renameres *resp) |
739 | { | 738 | { |
740 | p = encode_wcc_data(rqstp, p, &resp->ffh); | 739 | p = encode_wcc_data(rqstp, p, &resp->ffh); |
@@ -744,7 +743,7 @@ nfs3svc_encode_renameres(struct svc_rqst *rqstp, u32 *p, | |||
744 | 743 | ||
745 | /* LINK */ | 744 | /* LINK */ |
746 | int | 745 | int |
747 | nfs3svc_encode_linkres(struct svc_rqst *rqstp, u32 *p, | 746 | nfs3svc_encode_linkres(struct svc_rqst *rqstp, __be32 *p, |
748 | struct nfsd3_linkres *resp) | 747 | struct nfsd3_linkres *resp) |
749 | { | 748 | { |
750 | p = encode_post_op_attr(rqstp, p, &resp->fh); | 749 | p = encode_post_op_attr(rqstp, p, &resp->fh); |
@@ -754,7 +753,7 @@ nfs3svc_encode_linkres(struct svc_rqst *rqstp, u32 *p, | |||
754 | 753 | ||
755 | /* READDIR */ | 754 | /* READDIR */ |
756 | int | 755 | int |
757 | nfs3svc_encode_readdirres(struct svc_rqst *rqstp, u32 *p, | 756 | nfs3svc_encode_readdirres(struct svc_rqst *rqstp, __be32 *p, |
758 | struct nfsd3_readdirres *resp) | 757 | struct nfsd3_readdirres *resp) |
759 | { | 758 | { |
760 | p = encode_post_op_attr(rqstp, p, &resp->fh); | 759 | p = encode_post_op_attr(rqstp, p, &resp->fh); |
@@ -768,7 +767,6 @@ nfs3svc_encode_readdirres(struct svc_rqst *rqstp, u32 *p, | |||
768 | rqstp->rq_res.page_len = (resp->count) << 2; | 767 | rqstp->rq_res.page_len = (resp->count) << 2; |
769 | 768 | ||
770 | /* add the 'tail' to the end of the 'head' page - page 0. */ | 769 | /* add the 'tail' to the end of the 'head' page - page 0. */ |
771 | rqstp->rq_restailpage = 0; | ||
772 | rqstp->rq_res.tail[0].iov_base = p; | 770 | rqstp->rq_res.tail[0].iov_base = p; |
773 | *p++ = 0; /* no more entries */ | 771 | *p++ = 0; /* no more entries */ |
774 | *p++ = htonl(resp->common.err == nfserr_eof); | 772 | *p++ = htonl(resp->common.err == nfserr_eof); |
@@ -778,8 +776,8 @@ nfs3svc_encode_readdirres(struct svc_rqst *rqstp, u32 *p, | |||
778 | return xdr_ressize_check(rqstp, p); | 776 | return xdr_ressize_check(rqstp, p); |
779 | } | 777 | } |
780 | 778 | ||
781 | static inline u32 * | 779 | static inline __be32 * |
782 | encode_entry_baggage(struct nfsd3_readdirres *cd, u32 *p, const char *name, | 780 | encode_entry_baggage(struct nfsd3_readdirres *cd, __be32 *p, const char *name, |
783 | int namlen, ino_t ino) | 781 | int namlen, ino_t ino) |
784 | { | 782 | { |
785 | *p++ = xdr_one; /* mark entry present */ | 783 | *p++ = xdr_one; /* mark entry present */ |
@@ -792,8 +790,8 @@ encode_entry_baggage(struct nfsd3_readdirres *cd, u32 *p, const char *name, | |||
792 | return p; | 790 | return p; |
793 | } | 791 | } |
794 | 792 | ||
795 | static inline u32 * | 793 | static inline __be32 * |
796 | encode_entryplus_baggage(struct nfsd3_readdirres *cd, u32 *p, | 794 | encode_entryplus_baggage(struct nfsd3_readdirres *cd, __be32 *p, |
797 | struct svc_fh *fhp) | 795 | struct svc_fh *fhp) |
798 | { | 796 | { |
799 | p = encode_post_op_attr(cd->rqstp, p, fhp); | 797 | p = encode_post_op_attr(cd->rqstp, p, fhp); |
@@ -855,7 +853,7 @@ encode_entry(struct readdir_cd *ccd, const char *name, | |||
855 | { | 853 | { |
856 | struct nfsd3_readdirres *cd = container_of(ccd, struct nfsd3_readdirres, | 854 | struct nfsd3_readdirres *cd = container_of(ccd, struct nfsd3_readdirres, |
857 | common); | 855 | common); |
858 | u32 *p = cd->buffer; | 856 | __be32 *p = cd->buffer; |
859 | caddr_t curr_page_addr = NULL; | 857 | caddr_t curr_page_addr = NULL; |
860 | int pn; /* current page number */ | 858 | int pn; /* current page number */ |
861 | int slen; /* string (name) length */ | 859 | int slen; /* string (name) length */ |
@@ -921,7 +919,7 @@ encode_entry(struct readdir_cd *ccd, const char *name, | |||
921 | } else if (cd->rqstp->rq_respages[pn+1] != NULL) { | 919 | } else if (cd->rqstp->rq_respages[pn+1] != NULL) { |
922 | /* temporarily encode entry into next page, then move back to | 920 | /* temporarily encode entry into next page, then move back to |
923 | * current and next page in rq_respages[] */ | 921 | * current and next page in rq_respages[] */ |
924 | u32 *p1, *tmp; | 922 | __be32 *p1, *tmp; |
925 | int len1, len2; | 923 | int len1, len2; |
926 | 924 | ||
927 | /* grab next page for temporary storage of entry */ | 925 | /* grab next page for temporary storage of entry */ |
@@ -1011,7 +1009,7 @@ nfs3svc_encode_entry_plus(struct readdir_cd *cd, const char *name, | |||
1011 | 1009 | ||
1012 | /* FSSTAT */ | 1010 | /* FSSTAT */ |
1013 | int | 1011 | int |
1014 | nfs3svc_encode_fsstatres(struct svc_rqst *rqstp, u32 *p, | 1012 | nfs3svc_encode_fsstatres(struct svc_rqst *rqstp, __be32 *p, |
1015 | struct nfsd3_fsstatres *resp) | 1013 | struct nfsd3_fsstatres *resp) |
1016 | { | 1014 | { |
1017 | struct kstatfs *s = &resp->stats; | 1015 | struct kstatfs *s = &resp->stats; |
@@ -1033,7 +1031,7 @@ nfs3svc_encode_fsstatres(struct svc_rqst *rqstp, u32 *p, | |||
1033 | 1031 | ||
1034 | /* FSINFO */ | 1032 | /* FSINFO */ |
1035 | int | 1033 | int |
1036 | nfs3svc_encode_fsinfores(struct svc_rqst *rqstp, u32 *p, | 1034 | nfs3svc_encode_fsinfores(struct svc_rqst *rqstp, __be32 *p, |
1037 | struct nfsd3_fsinfores *resp) | 1035 | struct nfsd3_fsinfores *resp) |
1038 | { | 1036 | { |
1039 | *p++ = xdr_zero; /* no post_op_attr */ | 1037 | *p++ = xdr_zero; /* no post_op_attr */ |
@@ -1057,7 +1055,7 @@ nfs3svc_encode_fsinfores(struct svc_rqst *rqstp, u32 *p, | |||
1057 | 1055 | ||
1058 | /* PATHCONF */ | 1056 | /* PATHCONF */ |
1059 | int | 1057 | int |
1060 | nfs3svc_encode_pathconfres(struct svc_rqst *rqstp, u32 *p, | 1058 | nfs3svc_encode_pathconfres(struct svc_rqst *rqstp, __be32 *p, |
1061 | struct nfsd3_pathconfres *resp) | 1059 | struct nfsd3_pathconfres *resp) |
1062 | { | 1060 | { |
1063 | *p++ = xdr_zero; /* no post_op_attr */ | 1061 | *p++ = xdr_zero; /* no post_op_attr */ |
@@ -1076,7 +1074,7 @@ nfs3svc_encode_pathconfres(struct svc_rqst *rqstp, u32 *p, | |||
1076 | 1074 | ||
1077 | /* COMMIT */ | 1075 | /* COMMIT */ |
1078 | int | 1076 | int |
1079 | nfs3svc_encode_commitres(struct svc_rqst *rqstp, u32 *p, | 1077 | nfs3svc_encode_commitres(struct svc_rqst *rqstp, __be32 *p, |
1080 | struct nfsd3_commitres *resp) | 1078 | struct nfsd3_commitres *resp) |
1081 | { | 1079 | { |
1082 | p = encode_wcc_data(rqstp, p, &resp->fh); | 1080 | p = encode_wcc_data(rqstp, p, &resp->fh); |
@@ -1092,7 +1090,7 @@ nfs3svc_encode_commitres(struct svc_rqst *rqstp, u32 *p, | |||
1092 | * XDR release functions | 1090 | * XDR release functions |
1093 | */ | 1091 | */ |
1094 | int | 1092 | int |
1095 | nfs3svc_release_fhandle(struct svc_rqst *rqstp, u32 *p, | 1093 | nfs3svc_release_fhandle(struct svc_rqst *rqstp, __be32 *p, |
1096 | struct nfsd3_attrstat *resp) | 1094 | struct nfsd3_attrstat *resp) |
1097 | { | 1095 | { |
1098 | fh_put(&resp->fh); | 1096 | fh_put(&resp->fh); |
@@ -1100,7 +1098,7 @@ nfs3svc_release_fhandle(struct svc_rqst *rqstp, u32 *p, | |||
1100 | } | 1098 | } |
1101 | 1099 | ||
1102 | int | 1100 | int |
1103 | nfs3svc_release_fhandle2(struct svc_rqst *rqstp, u32 *p, | 1101 | nfs3svc_release_fhandle2(struct svc_rqst *rqstp, __be32 *p, |
1104 | struct nfsd3_fhandle_pair *resp) | 1102 | struct nfsd3_fhandle_pair *resp) |
1105 | { | 1103 | { |
1106 | fh_put(&resp->fh1); | 1104 | fh_put(&resp->fh1); |