summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-07-13 16:56:24 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-07-13 16:56:24 -0400
commit62403005975c678ba7594a36670ae3bf0273d7c4 (patch)
tree10113ca849639a544c2b356dddf99712d40e99dd
parent19c6e12c07ceab2ff5d5ec97354b893ab386c41c (diff)
parentb20dae70bfa5014fdf201d0a8589271b888e4927 (diff)
Merge tag 'nfsd-4.13' of git://linux-nfs.org/~bfields/linux
Pull nfsd updates from Bruce Fields: "Chuck's RDMA update overhauls the "call receive" side of the RPC-over-RDMA transport to use the new rdma_rw API. Christoph cleaned the way nfs operations are declared, removing a bunch of function-pointer casts and declaring the operation vectors as const. Christoph's changes touch both client and server, and both client and server pulls this time around should be based on the same commits from Christoph" * tag 'nfsd-4.13' of git://linux-nfs.org/~bfields/linux: (53 commits) svcrdma: fix an incorrect check on -E2BIG and -EINVAL nfsd4: factor ctime into change attribute svcrdma: Remove svc_rdma_chunk_ctxt::cc_dir field svcrdma: use offset_in_page() macro svcrdma: Clean up after converting svc_rdma_recvfrom to rdma_rw API svcrdma: Clean-up svc_rdma_unmap_dma svcrdma: Remove frmr cache svcrdma: Remove unused Read completion handlers svcrdma: Properly compute .len and .buflen for received RPC Calls svcrdma: Use generic RDMA R/W API in RPC Call path svcrdma: Add recvfrom helpers to svc_rdma_rw.c sunrpc: Allocate up to RPCSVC_MAXPAGES per svc_rqst svcrdma: Don't account for Receive queue "starvation" svcrdma: Improve Reply chunk sanity checking svcrdma: Improve Write chunk sanity checking svcrdma: Improve Read chunk sanity checking svcrdma: Remove svc_rdma_marshal.c svcrdma: Avoid Send Queue overflow svcrdma: Squelch disconnection messages sunrpc: Disable splice for krb5i ...
-rw-r--r--fs/lockd/clnt4xdr.c34
-rw-r--r--fs/lockd/clntxdr.c58
-rw-r--r--fs/lockd/mon.c38
-rw-r--r--fs/lockd/svc.c38
-rw-r--r--fs/lockd/svc4proc.c124
-rw-r--r--fs/lockd/svcproc.c124
-rw-r--r--fs/lockd/xdr.c43
-rw-r--r--fs/lockd/xdr4.c43
-rw-r--r--fs/nfs/callback.c2
-rw-r--r--fs/nfs/callback.h27
-rw-r--r--fs/nfs/callback_proc.c33
-rw-r--r--fs/nfs/callback_xdr.c113
-rw-r--r--fs/nfs/internal.h10
-rw-r--r--fs/nfs/mount_clnt.c29
-rw-r--r--fs/nfs/nfs2xdr.c70
-rw-r--r--fs/nfs/nfs3xdr.c151
-rw-r--r--fs/nfs/nfs42xdr.c52
-rw-r--r--fs/nfs/nfs4_fs.h6
-rw-r--r--fs/nfs/nfs4xdr.c331
-rw-r--r--fs/nfsd/current_stateid.h36
-rw-r--r--fs/nfsd/nfs2acl.c116
-rw-r--r--fs/nfsd/nfs3acl.c75
-rw-r--r--fs/nfsd/nfs3proc.c301
-rw-r--r--fs/nfsd/nfs3xdr.c166
-rw-r--r--fs/nfsd/nfs4callback.c32
-rw-r--r--fs/nfsd/nfs4proc.c412
-rw-r--r--fs/nfsd/nfs4state.c142
-rw-r--r--fs/nfsd/nfs4xdr.c15
-rw-r--r--fs/nfsd/nfsd.h6
-rw-r--r--fs/nfsd/nfsfh.h24
-rw-r--r--fs/nfsd/nfsproc.c206
-rw-r--r--fs/nfsd/nfssvc.c24
-rw-r--r--fs/nfsd/nfsxdr.c92
-rw-r--r--fs/nfsd/xdr.h50
-rw-r--r--fs/nfsd/xdr3.h100
-rw-r--r--fs/nfsd/xdr4.h78
-rw-r--r--include/linux/lockd/lockd.h4
-rw-r--r--include/linux/lockd/xdr.h26
-rw-r--r--include/linux/lockd/xdr4.h26
-rw-r--r--include/linux/sunrpc/clnt.h6
-rw-r--r--include/linux/sunrpc/sched.h2
-rw-r--r--include/linux/sunrpc/svc.h23
-rw-r--r--include/linux/sunrpc/svc_rdma.h46
-rw-r--r--include/linux/sunrpc/xdr.h15
-rw-r--r--net/sunrpc/auth_gss/gss_rpc_upcall.c9
-rw-r--r--net/sunrpc/auth_gss/gss_rpc_xdr.c14
-rw-r--r--net/sunrpc/auth_gss/gss_rpc_xdr.h4
-rw-r--r--net/sunrpc/auth_gss/svcauth_gss.c8
-rw-r--r--net/sunrpc/clnt.c16
-rw-r--r--net/sunrpc/rpcb_clnt.c82
-rw-r--r--net/sunrpc/stats.c16
-rw-r--r--net/sunrpc/svc.c35
-rw-r--r--net/sunrpc/svc_xprt.c10
-rw-r--r--net/sunrpc/xprtrdma/Makefile4
-rw-r--r--net/sunrpc/xprtrdma/svc_rdma_marshal.c168
-rw-r--r--net/sunrpc/xprtrdma/svc_rdma_recvfrom.c734
-rw-r--r--net/sunrpc/xprtrdma/svc_rdma_rw.c449
-rw-r--r--net/sunrpc/xprtrdma/svc_rdma_sendto.c15
-rw-r--r--net/sunrpc/xprtrdma/svc_rdma_transport.c250
59 files changed, 2758 insertions, 2405 deletions
diff --git a/fs/lockd/clnt4xdr.c b/fs/lockd/clnt4xdr.c
index d3e40db28930..c349fc0f9b80 100644
--- a/fs/lockd/clnt4xdr.c
+++ b/fs/lockd/clnt4xdr.c
@@ -381,8 +381,9 @@ static void encode_nlm4_lock(struct xdr_stream *xdr,
381 */ 381 */
382static void nlm4_xdr_enc_testargs(struct rpc_rqst *req, 382static void nlm4_xdr_enc_testargs(struct rpc_rqst *req,
383 struct xdr_stream *xdr, 383 struct xdr_stream *xdr,
384 const struct nlm_args *args) 384 const void *data)
385{ 385{
386 const struct nlm_args *args = data;
386 const struct nlm_lock *lock = &args->lock; 387 const struct nlm_lock *lock = &args->lock;
387 388
388 encode_cookie(xdr, &args->cookie); 389 encode_cookie(xdr, &args->cookie);
@@ -402,8 +403,9 @@ static void nlm4_xdr_enc_testargs(struct rpc_rqst *req,
402 */ 403 */
403static void nlm4_xdr_enc_lockargs(struct rpc_rqst *req, 404static void nlm4_xdr_enc_lockargs(struct rpc_rqst *req,
404 struct xdr_stream *xdr, 405 struct xdr_stream *xdr,
405 const struct nlm_args *args) 406 const void *data)
406{ 407{
408 const struct nlm_args *args = data;
407 const struct nlm_lock *lock = &args->lock; 409 const struct nlm_lock *lock = &args->lock;
408 410
409 encode_cookie(xdr, &args->cookie); 411 encode_cookie(xdr, &args->cookie);
@@ -424,8 +426,9 @@ static void nlm4_xdr_enc_lockargs(struct rpc_rqst *req,
424 */ 426 */
425static void nlm4_xdr_enc_cancargs(struct rpc_rqst *req, 427static void nlm4_xdr_enc_cancargs(struct rpc_rqst *req,
426 struct xdr_stream *xdr, 428 struct xdr_stream *xdr,
427 const struct nlm_args *args) 429 const void *data)
428{ 430{
431 const struct nlm_args *args = data;
429 const struct nlm_lock *lock = &args->lock; 432 const struct nlm_lock *lock = &args->lock;
430 433
431 encode_cookie(xdr, &args->cookie); 434 encode_cookie(xdr, &args->cookie);
@@ -442,8 +445,9 @@ static void nlm4_xdr_enc_cancargs(struct rpc_rqst *req,
442 */ 445 */
443static void nlm4_xdr_enc_unlockargs(struct rpc_rqst *req, 446static void nlm4_xdr_enc_unlockargs(struct rpc_rqst *req,
444 struct xdr_stream *xdr, 447 struct xdr_stream *xdr,
445 const struct nlm_args *args) 448 const void *data)
446{ 449{
450 const struct nlm_args *args = data;
447 const struct nlm_lock *lock = &args->lock; 451 const struct nlm_lock *lock = &args->lock;
448 452
449 encode_cookie(xdr, &args->cookie); 453 encode_cookie(xdr, &args->cookie);
@@ -458,8 +462,10 @@ static void nlm4_xdr_enc_unlockargs(struct rpc_rqst *req,
458 */ 462 */
459static void nlm4_xdr_enc_res(struct rpc_rqst *req, 463static void nlm4_xdr_enc_res(struct rpc_rqst *req,
460 struct xdr_stream *xdr, 464 struct xdr_stream *xdr,
461 const struct nlm_res *result) 465 const void *data)
462{ 466{
467 const struct nlm_res *result = data;
468
463 encode_cookie(xdr, &result->cookie); 469 encode_cookie(xdr, &result->cookie);
464 encode_nlm4_stat(xdr, result->status); 470 encode_nlm4_stat(xdr, result->status);
465} 471}
@@ -479,8 +485,10 @@ static void nlm4_xdr_enc_res(struct rpc_rqst *req,
479 */ 485 */
480static void nlm4_xdr_enc_testres(struct rpc_rqst *req, 486static void nlm4_xdr_enc_testres(struct rpc_rqst *req,
481 struct xdr_stream *xdr, 487 struct xdr_stream *xdr,
482 const struct nlm_res *result) 488 const void *data)
483{ 489{
490 const struct nlm_res *result = data;
491
484 encode_cookie(xdr, &result->cookie); 492 encode_cookie(xdr, &result->cookie);
485 encode_nlm4_stat(xdr, result->status); 493 encode_nlm4_stat(xdr, result->status);
486 if (result->status == nlm_lck_denied) 494 if (result->status == nlm_lck_denied)
@@ -525,8 +533,9 @@ out:
525 533
526static int nlm4_xdr_dec_testres(struct rpc_rqst *req, 534static int nlm4_xdr_dec_testres(struct rpc_rqst *req,
527 struct xdr_stream *xdr, 535 struct xdr_stream *xdr,
528 struct nlm_res *result) 536 void *data)
529{ 537{
538 struct nlm_res *result = data;
530 int error; 539 int error;
531 540
532 error = decode_cookie(xdr, &result->cookie); 541 error = decode_cookie(xdr, &result->cookie);
@@ -545,8 +554,9 @@ out:
545 */ 554 */
546static int nlm4_xdr_dec_res(struct rpc_rqst *req, 555static int nlm4_xdr_dec_res(struct rpc_rqst *req,
547 struct xdr_stream *xdr, 556 struct xdr_stream *xdr,
548 struct nlm_res *result) 557 void *data)
549{ 558{
559 struct nlm_res *result = data;
550 int error; 560 int error;
551 561
552 error = decode_cookie(xdr, &result->cookie); 562 error = decode_cookie(xdr, &result->cookie);
@@ -566,15 +576,15 @@ out:
566#define PROC(proc, argtype, restype) \ 576#define PROC(proc, argtype, restype) \
567[NLMPROC_##proc] = { \ 577[NLMPROC_##proc] = { \
568 .p_proc = NLMPROC_##proc, \ 578 .p_proc = NLMPROC_##proc, \
569 .p_encode = (kxdreproc_t)nlm4_xdr_enc_##argtype, \ 579 .p_encode = nlm4_xdr_enc_##argtype, \
570 .p_decode = (kxdrdproc_t)nlm4_xdr_dec_##restype, \ 580 .p_decode = nlm4_xdr_dec_##restype, \
571 .p_arglen = NLM4_##argtype##_sz, \ 581 .p_arglen = NLM4_##argtype##_sz, \
572 .p_replen = NLM4_##restype##_sz, \ 582 .p_replen = NLM4_##restype##_sz, \
573 .p_statidx = NLMPROC_##proc, \ 583 .p_statidx = NLMPROC_##proc, \
574 .p_name = #proc, \ 584 .p_name = #proc, \
575 } 585 }
576 586
577static struct rpc_procinfo nlm4_procedures[] = { 587static const struct rpc_procinfo nlm4_procedures[] = {
578 PROC(TEST, testargs, testres), 588 PROC(TEST, testargs, testres),
579 PROC(LOCK, lockargs, res), 589 PROC(LOCK, lockargs, res),
580 PROC(CANCEL, cancargs, res), 590 PROC(CANCEL, cancargs, res),
@@ -592,8 +602,10 @@ static struct rpc_procinfo nlm4_procedures[] = {
592 PROC(GRANTED_RES, res, norep), 602 PROC(GRANTED_RES, res, norep),
593}; 603};
594 604
605static unsigned int nlm_version4_counts[ARRAY_SIZE(nlm4_procedures)];
595const struct rpc_version nlm_version4 = { 606const struct rpc_version nlm_version4 = {
596 .number = 4, 607 .number = 4,
597 .nrprocs = ARRAY_SIZE(nlm4_procedures), 608 .nrprocs = ARRAY_SIZE(nlm4_procedures),
598 .procs = nlm4_procedures, 609 .procs = nlm4_procedures,
610 .counts = nlm_version4_counts,
599}; 611};
diff --git a/fs/lockd/clntxdr.c b/fs/lockd/clntxdr.c
index 3e9f7874b975..3b4724a6c4ee 100644
--- a/fs/lockd/clntxdr.c
+++ b/fs/lockd/clntxdr.c
@@ -374,8 +374,9 @@ static void encode_nlm_lock(struct xdr_stream *xdr,
374 */ 374 */
375static void nlm_xdr_enc_testargs(struct rpc_rqst *req, 375static void nlm_xdr_enc_testargs(struct rpc_rqst *req,
376 struct xdr_stream *xdr, 376 struct xdr_stream *xdr,
377 const struct nlm_args *args) 377 const void *data)
378{ 378{
379 const struct nlm_args *args = data;
379 const struct nlm_lock *lock = &args->lock; 380 const struct nlm_lock *lock = &args->lock;
380 381
381 encode_cookie(xdr, &args->cookie); 382 encode_cookie(xdr, &args->cookie);
@@ -395,8 +396,9 @@ static void nlm_xdr_enc_testargs(struct rpc_rqst *req,
395 */ 396 */
396static void nlm_xdr_enc_lockargs(struct rpc_rqst *req, 397static void nlm_xdr_enc_lockargs(struct rpc_rqst *req,
397 struct xdr_stream *xdr, 398 struct xdr_stream *xdr,
398 const struct nlm_args *args) 399 const void *data)
399{ 400{
401 const struct nlm_args *args = data;
400 const struct nlm_lock *lock = &args->lock; 402 const struct nlm_lock *lock = &args->lock;
401 403
402 encode_cookie(xdr, &args->cookie); 404 encode_cookie(xdr, &args->cookie);
@@ -417,8 +419,9 @@ static void nlm_xdr_enc_lockargs(struct rpc_rqst *req,
417 */ 419 */
418static void nlm_xdr_enc_cancargs(struct rpc_rqst *req, 420static void nlm_xdr_enc_cancargs(struct rpc_rqst *req,
419 struct xdr_stream *xdr, 421 struct xdr_stream *xdr,
420 const struct nlm_args *args) 422 const void *data)
421{ 423{
424 const struct nlm_args *args = data;
422 const struct nlm_lock *lock = &args->lock; 425 const struct nlm_lock *lock = &args->lock;
423 426
424 encode_cookie(xdr, &args->cookie); 427 encode_cookie(xdr, &args->cookie);
@@ -435,8 +438,9 @@ static void nlm_xdr_enc_cancargs(struct rpc_rqst *req,
435 */ 438 */
436static void nlm_xdr_enc_unlockargs(struct rpc_rqst *req, 439static void nlm_xdr_enc_unlockargs(struct rpc_rqst *req,
437 struct xdr_stream *xdr, 440 struct xdr_stream *xdr,
438 const struct nlm_args *args) 441 const void *data)
439{ 442{
443 const struct nlm_args *args = data;
440 const struct nlm_lock *lock = &args->lock; 444 const struct nlm_lock *lock = &args->lock;
441 445
442 encode_cookie(xdr, &args->cookie); 446 encode_cookie(xdr, &args->cookie);
@@ -451,8 +455,10 @@ static void nlm_xdr_enc_unlockargs(struct rpc_rqst *req,
451 */ 455 */
452static void nlm_xdr_enc_res(struct rpc_rqst *req, 456static void nlm_xdr_enc_res(struct rpc_rqst *req,
453 struct xdr_stream *xdr, 457 struct xdr_stream *xdr,
454 const struct nlm_res *result) 458 const void *data)
455{ 459{
460 const struct nlm_res *result = data;
461
456 encode_cookie(xdr, &result->cookie); 462 encode_cookie(xdr, &result->cookie);
457 encode_nlm_stat(xdr, result->status); 463 encode_nlm_stat(xdr, result->status);
458} 464}
@@ -479,8 +485,10 @@ static void encode_nlm_testrply(struct xdr_stream *xdr,
479 485
480static void nlm_xdr_enc_testres(struct rpc_rqst *req, 486static void nlm_xdr_enc_testres(struct rpc_rqst *req,
481 struct xdr_stream *xdr, 487 struct xdr_stream *xdr,
482 const struct nlm_res *result) 488 const void *data)
483{ 489{
490 const struct nlm_res *result = data;
491
484 encode_cookie(xdr, &result->cookie); 492 encode_cookie(xdr, &result->cookie);
485 encode_nlm_stat(xdr, result->status); 493 encode_nlm_stat(xdr, result->status);
486 encode_nlm_testrply(xdr, result); 494 encode_nlm_testrply(xdr, result);
@@ -523,8 +531,9 @@ out:
523 531
524static int nlm_xdr_dec_testres(struct rpc_rqst *req, 532static int nlm_xdr_dec_testres(struct rpc_rqst *req,
525 struct xdr_stream *xdr, 533 struct xdr_stream *xdr,
526 struct nlm_res *result) 534 void *data)
527{ 535{
536 struct nlm_res *result = data;
528 int error; 537 int error;
529 538
530 error = decode_cookie(xdr, &result->cookie); 539 error = decode_cookie(xdr, &result->cookie);
@@ -543,8 +552,9 @@ out:
543 */ 552 */
544static int nlm_xdr_dec_res(struct rpc_rqst *req, 553static int nlm_xdr_dec_res(struct rpc_rqst *req,
545 struct xdr_stream *xdr, 554 struct xdr_stream *xdr,
546 struct nlm_res *result) 555 void *data)
547{ 556{
557 struct nlm_res *result = data;
548 int error; 558 int error;
549 559
550 error = decode_cookie(xdr, &result->cookie); 560 error = decode_cookie(xdr, &result->cookie);
@@ -564,15 +574,15 @@ out:
564#define PROC(proc, argtype, restype) \ 574#define PROC(proc, argtype, restype) \
565[NLMPROC_##proc] = { \ 575[NLMPROC_##proc] = { \
566 .p_proc = NLMPROC_##proc, \ 576 .p_proc = NLMPROC_##proc, \
567 .p_encode = (kxdreproc_t)nlm_xdr_enc_##argtype, \ 577 .p_encode = nlm_xdr_enc_##argtype, \
568 .p_decode = (kxdrdproc_t)nlm_xdr_dec_##restype, \ 578 .p_decode = nlm_xdr_dec_##restype, \
569 .p_arglen = NLM_##argtype##_sz, \ 579 .p_arglen = NLM_##argtype##_sz, \
570 .p_replen = NLM_##restype##_sz, \ 580 .p_replen = NLM_##restype##_sz, \
571 .p_statidx = NLMPROC_##proc, \ 581 .p_statidx = NLMPROC_##proc, \
572 .p_name = #proc, \ 582 .p_name = #proc, \
573 } 583 }
574 584
575static struct rpc_procinfo nlm_procedures[] = { 585static const struct rpc_procinfo nlm_procedures[] = {
576 PROC(TEST, testargs, testres), 586 PROC(TEST, testargs, testres),
577 PROC(LOCK, lockargs, res), 587 PROC(LOCK, lockargs, res),
578 PROC(CANCEL, cancargs, res), 588 PROC(CANCEL, cancargs, res),
@@ -590,16 +600,20 @@ static struct rpc_procinfo nlm_procedures[] = {
590 PROC(GRANTED_RES, res, norep), 600 PROC(GRANTED_RES, res, norep),
591}; 601};
592 602
603static unsigned int nlm_version1_counts[ARRAY_SIZE(nlm_procedures)];
593static const struct rpc_version nlm_version1 = { 604static const struct rpc_version nlm_version1 = {
594 .number = 1, 605 .number = 1,
595 .nrprocs = ARRAY_SIZE(nlm_procedures), 606 .nrprocs = ARRAY_SIZE(nlm_procedures),
596 .procs = nlm_procedures, 607 .procs = nlm_procedures,
608 .counts = nlm_version1_counts,
597}; 609};
598 610
611static unsigned int nlm_version3_counts[ARRAY_SIZE(nlm_procedures)];
599static const struct rpc_version nlm_version3 = { 612static const struct rpc_version nlm_version3 = {
600 .number = 3, 613 .number = 3,
601 .nrprocs = ARRAY_SIZE(nlm_procedures), 614 .nrprocs = ARRAY_SIZE(nlm_procedures),
602 .procs = nlm_procedures, 615 .procs = nlm_procedures,
616 .counts = nlm_version3_counts,
603}; 617};
604 618
605static const struct rpc_version *nlm_versions[] = { 619static const struct rpc_version *nlm_versions[] = {
@@ -613,9 +627,9 @@ static const struct rpc_version *nlm_versions[] = {
613static struct rpc_stat nlm_rpc_stats; 627static struct rpc_stat nlm_rpc_stats;
614 628
615const struct rpc_program nlm_program = { 629const struct rpc_program nlm_program = {
616 .name = "lockd", 630 .name = "lockd",
617 .number = NLM_PROGRAM, 631 .number = NLM_PROGRAM,
618 .nrvers = ARRAY_SIZE(nlm_versions), 632 .nrvers = ARRAY_SIZE(nlm_versions),
619 .version = nlm_versions, 633 .version = nlm_versions,
620 .stats = &nlm_rpc_stats, 634 .stats = &nlm_rpc_stats,
621}; 635};
diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c
index 19166d4a8d31..9d8166c39c54 100644
--- a/fs/lockd/mon.c
+++ b/fs/lockd/mon.c
@@ -476,22 +476,23 @@ static void encode_priv(struct xdr_stream *xdr, const struct nsm_args *argp)
476} 476}
477 477
478static void nsm_xdr_enc_mon(struct rpc_rqst *req, struct xdr_stream *xdr, 478static void nsm_xdr_enc_mon(struct rpc_rqst *req, struct xdr_stream *xdr,
479 const struct nsm_args *argp) 479 const void *argp)
480{ 480{
481 encode_mon_id(xdr, argp); 481 encode_mon_id(xdr, argp);
482 encode_priv(xdr, argp); 482 encode_priv(xdr, argp);
483} 483}
484 484
485static void nsm_xdr_enc_unmon(struct rpc_rqst *req, struct xdr_stream *xdr, 485static void nsm_xdr_enc_unmon(struct rpc_rqst *req, struct xdr_stream *xdr,
486 const struct nsm_args *argp) 486 const void *argp)
487{ 487{
488 encode_mon_id(xdr, argp); 488 encode_mon_id(xdr, argp);
489} 489}
490 490
491static int nsm_xdr_dec_stat_res(struct rpc_rqst *rqstp, 491static int nsm_xdr_dec_stat_res(struct rpc_rqst *rqstp,
492 struct xdr_stream *xdr, 492 struct xdr_stream *xdr,
493 struct nsm_res *resp) 493 void *data)
494{ 494{
495 struct nsm_res *resp = data;
495 __be32 *p; 496 __be32 *p;
496 497
497 p = xdr_inline_decode(xdr, 4 + 4); 498 p = xdr_inline_decode(xdr, 4 + 4);
@@ -507,8 +508,9 @@ static int nsm_xdr_dec_stat_res(struct rpc_rqst *rqstp,
507 508
508static int nsm_xdr_dec_stat(struct rpc_rqst *rqstp, 509static int nsm_xdr_dec_stat(struct rpc_rqst *rqstp,
509 struct xdr_stream *xdr, 510 struct xdr_stream *xdr,
510 struct nsm_res *resp) 511 void *data)
511{ 512{
513 struct nsm_res *resp = data;
512 __be32 *p; 514 __be32 *p;
513 515
514 p = xdr_inline_decode(xdr, 4); 516 p = xdr_inline_decode(xdr, 4);
@@ -529,11 +531,11 @@ static int nsm_xdr_dec_stat(struct rpc_rqst *rqstp,
529#define SM_monres_sz 2 531#define SM_monres_sz 2
530#define SM_unmonres_sz 1 532#define SM_unmonres_sz 1
531 533
532static struct rpc_procinfo nsm_procedures[] = { 534static const struct rpc_procinfo nsm_procedures[] = {
533[NSMPROC_MON] = { 535[NSMPROC_MON] = {
534 .p_proc = NSMPROC_MON, 536 .p_proc = NSMPROC_MON,
535 .p_encode = (kxdreproc_t)nsm_xdr_enc_mon, 537 .p_encode = nsm_xdr_enc_mon,
536 .p_decode = (kxdrdproc_t)nsm_xdr_dec_stat_res, 538 .p_decode = nsm_xdr_dec_stat_res,
537 .p_arglen = SM_mon_sz, 539 .p_arglen = SM_mon_sz,
538 .p_replen = SM_monres_sz, 540 .p_replen = SM_monres_sz,
539 .p_statidx = NSMPROC_MON, 541 .p_statidx = NSMPROC_MON,
@@ -541,8 +543,8 @@ static struct rpc_procinfo nsm_procedures[] = {
541 }, 543 },
542[NSMPROC_UNMON] = { 544[NSMPROC_UNMON] = {
543 .p_proc = NSMPROC_UNMON, 545 .p_proc = NSMPROC_UNMON,
544 .p_encode = (kxdreproc_t)nsm_xdr_enc_unmon, 546 .p_encode = nsm_xdr_enc_unmon,
545 .p_decode = (kxdrdproc_t)nsm_xdr_dec_stat, 547 .p_decode = nsm_xdr_dec_stat,
546 .p_arglen = SM_mon_id_sz, 548 .p_arglen = SM_mon_id_sz,
547 .p_replen = SM_unmonres_sz, 549 .p_replen = SM_unmonres_sz,
548 .p_statidx = NSMPROC_UNMON, 550 .p_statidx = NSMPROC_UNMON,
@@ -550,10 +552,12 @@ static struct rpc_procinfo nsm_procedures[] = {
550 }, 552 },
551}; 553};
552 554
555static unsigned int nsm_version1_counts[ARRAY_SIZE(nsm_procedures)];
553static const struct rpc_version nsm_version1 = { 556static const struct rpc_version nsm_version1 = {
554 .number = 1, 557 .number = 1,
555 .nrprocs = ARRAY_SIZE(nsm_procedures), 558 .nrprocs = ARRAY_SIZE(nsm_procedures),
556 .procs = nsm_procedures 559 .procs = nsm_procedures,
560 .counts = nsm_version1_counts,
557}; 561};
558 562
559static const struct rpc_version *nsm_version[] = { 563static const struct rpc_version *nsm_version[] = {
@@ -563,9 +567,9 @@ static const struct rpc_version *nsm_version[] = {
563static struct rpc_stat nsm_stats; 567static struct rpc_stat nsm_stats;
564 568
565static const struct rpc_program nsm_program = { 569static const struct rpc_program nsm_program = {
566 .name = "statd", 570 .name = "statd",
567 .number = NSM_PROGRAM, 571 .number = NSM_PROGRAM,
568 .nrvers = ARRAY_SIZE(nsm_version), 572 .nrvers = ARRAY_SIZE(nsm_version),
569 .version = nsm_version, 573 .version = nsm_version,
570 .stats = &nsm_stats 574 .stats = &nsm_stats
571}; 575};
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
index 5d481e8a1b5d..726b6cecf430 100644
--- a/fs/lockd/svc.c
+++ b/fs/lockd/svc.c
@@ -739,27 +739,33 @@ module_exit(exit_nlm);
739/* 739/*
740 * Define NLM program and procedures 740 * Define NLM program and procedures
741 */ 741 */
742static struct svc_version nlmsvc_version1 = { 742static unsigned int nlmsvc_version1_count[17];
743 .vs_vers = 1, 743static const struct svc_version nlmsvc_version1 = {
744 .vs_nproc = 17, 744 .vs_vers = 1,
745 .vs_proc = nlmsvc_procedures, 745 .vs_nproc = 17,
746 .vs_xdrsize = NLMSVC_XDRSIZE, 746 .vs_proc = nlmsvc_procedures,
747 .vs_count = nlmsvc_version1_count,
748 .vs_xdrsize = NLMSVC_XDRSIZE,
747}; 749};
748static struct svc_version nlmsvc_version3 = { 750static unsigned int nlmsvc_version3_count[24];
749 .vs_vers = 3, 751static const struct svc_version nlmsvc_version3 = {
750 .vs_nproc = 24, 752 .vs_vers = 3,
751 .vs_proc = nlmsvc_procedures, 753 .vs_nproc = 24,
752 .vs_xdrsize = NLMSVC_XDRSIZE, 754 .vs_proc = nlmsvc_procedures,
755 .vs_count = nlmsvc_version3_count,
756 .vs_xdrsize = NLMSVC_XDRSIZE,
753}; 757};
754#ifdef CONFIG_LOCKD_V4 758#ifdef CONFIG_LOCKD_V4
755static struct svc_version nlmsvc_version4 = { 759static unsigned int nlmsvc_version4_count[24];
756 .vs_vers = 4, 760static const struct svc_version nlmsvc_version4 = {
757 .vs_nproc = 24, 761 .vs_vers = 4,
758 .vs_proc = nlmsvc_procedures4, 762 .vs_nproc = 24,
759 .vs_xdrsize = NLMSVC_XDRSIZE, 763 .vs_proc = nlmsvc_procedures4,
764 .vs_count = nlmsvc_version4_count,
765 .vs_xdrsize = NLMSVC_XDRSIZE,
760}; 766};
761#endif 767#endif
762static struct svc_version * nlmsvc_version[] = { 768static const struct svc_version *nlmsvc_version[] = {
763 [1] = &nlmsvc_version1, 769 [1] = &nlmsvc_version1,
764 [3] = &nlmsvc_version3, 770 [3] = &nlmsvc_version3,
765#ifdef CONFIG_LOCKD_V4 771#ifdef CONFIG_LOCKD_V4
diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c
index 09c576f26c7b..82925f17ec45 100644
--- a/fs/lockd/svc4proc.c
+++ b/fs/lockd/svc4proc.c
@@ -62,7 +62,7 @@ no_locks:
62 * NULL: Test for presence of service 62 * NULL: Test for presence of service
63 */ 63 */
64static __be32 64static __be32
65nlm4svc_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) 65nlm4svc_proc_null(struct svc_rqst *rqstp)
66{ 66{
67 dprintk("lockd: NULL called\n"); 67 dprintk("lockd: NULL called\n");
68 return rpc_success; 68 return rpc_success;
@@ -72,9 +72,9 @@ nlm4svc_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)
72 * TEST: Check for conflicting lock 72 * TEST: Check for conflicting lock
73 */ 73 */
74static __be32 74static __be32
75nlm4svc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp, 75__nlm4svc_proc_test(struct svc_rqst *rqstp, struct nlm_res *resp)
76 struct nlm_res *resp)
77{ 76{
77 struct nlm_args *argp = rqstp->rq_argp;
78 struct nlm_host *host; 78 struct nlm_host *host;
79 struct nlm_file *file; 79 struct nlm_file *file;
80 __be32 rc = rpc_success; 80 __be32 rc = rpc_success;
@@ -99,9 +99,15 @@ nlm4svc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp,
99} 99}
100 100
101static __be32 101static __be32
102nlm4svc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp, 102nlm4svc_proc_test(struct svc_rqst *rqstp)
103 struct nlm_res *resp)
104{ 103{
104 return __nlm4svc_proc_test(rqstp, rqstp->rq_resp);
105}
106
107static __be32
108__nlm4svc_proc_lock(struct svc_rqst *rqstp, struct nlm_res *resp)
109{
110 struct nlm_args *argp = rqstp->rq_argp;
105 struct nlm_host *host; 111 struct nlm_host *host;
106 struct nlm_file *file; 112 struct nlm_file *file;
107 __be32 rc = rpc_success; 113 __be32 rc = rpc_success;
@@ -141,9 +147,15 @@ nlm4svc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
141} 147}
142 148
143static __be32 149static __be32
144nlm4svc_proc_cancel(struct svc_rqst *rqstp, struct nlm_args *argp, 150nlm4svc_proc_lock(struct svc_rqst *rqstp)
145 struct nlm_res *resp) 151{
152 return __nlm4svc_proc_lock(rqstp, rqstp->rq_resp);
153}
154
155static __be32
156__nlm4svc_proc_cancel(struct svc_rqst *rqstp, struct nlm_res *resp)
146{ 157{
158 struct nlm_args *argp = rqstp->rq_argp;
147 struct nlm_host *host; 159 struct nlm_host *host;
148 struct nlm_file *file; 160 struct nlm_file *file;
149 161
@@ -170,13 +182,19 @@ nlm4svc_proc_cancel(struct svc_rqst *rqstp, struct nlm_args *argp,
170 return rpc_success; 182 return rpc_success;
171} 183}
172 184
185static __be32
186nlm4svc_proc_cancel(struct svc_rqst *rqstp)
187{
188 return __nlm4svc_proc_cancel(rqstp, rqstp->rq_resp);
189}
190
173/* 191/*
174 * UNLOCK: release a lock 192 * UNLOCK: release a lock
175 */ 193 */
176static __be32 194static __be32
177nlm4svc_proc_unlock(struct svc_rqst *rqstp, struct nlm_args *argp, 195__nlm4svc_proc_unlock(struct svc_rqst *rqstp, struct nlm_res *resp)
178 struct nlm_res *resp)
179{ 196{
197 struct nlm_args *argp = rqstp->rq_argp;
180 struct nlm_host *host; 198 struct nlm_host *host;
181 struct nlm_file *file; 199 struct nlm_file *file;
182 200
@@ -203,14 +221,21 @@ nlm4svc_proc_unlock(struct svc_rqst *rqstp, struct nlm_args *argp,
203 return rpc_success; 221 return rpc_success;
204} 222}
205 223
224static __be32
225nlm4svc_proc_unlock(struct svc_rqst *rqstp)
226{
227 return __nlm4svc_proc_unlock(rqstp, rqstp->rq_resp);
228}
229
206/* 230/*
207 * GRANTED: A server calls us to tell that a process' lock request 231 * GRANTED: A server calls us to tell that a process' lock request
208 * was granted 232 * was granted
209 */ 233 */
210static __be32 234static __be32
211nlm4svc_proc_granted(struct svc_rqst *rqstp, struct nlm_args *argp, 235__nlm4svc_proc_granted(struct svc_rqst *rqstp, struct nlm_res *resp)
212 struct nlm_res *resp)
213{ 236{
237 struct nlm_args *argp = rqstp->rq_argp;
238
214 resp->cookie = argp->cookie; 239 resp->cookie = argp->cookie;
215 240
216 dprintk("lockd: GRANTED called\n"); 241 dprintk("lockd: GRANTED called\n");
@@ -219,6 +244,12 @@ nlm4svc_proc_granted(struct svc_rqst *rqstp, struct nlm_args *argp,
219 return rpc_success; 244 return rpc_success;
220} 245}
221 246
247static __be32
248nlm4svc_proc_granted(struct svc_rqst *rqstp)
249{
250 return __nlm4svc_proc_granted(rqstp, rqstp->rq_resp);
251}
252
222/* 253/*
223 * This is the generic lockd callback for async RPC calls 254 * This is the generic lockd callback for async RPC calls
224 */ 255 */
@@ -243,9 +274,10 @@ static const struct rpc_call_ops nlm4svc_callback_ops = {
243 * because we send the callback before the reply proper. I hope this 274 * because we send the callback before the reply proper. I hope this
244 * doesn't break any clients. 275 * doesn't break any clients.
245 */ 276 */
246static __be32 nlm4svc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_args *argp, 277static __be32 nlm4svc_callback(struct svc_rqst *rqstp, u32 proc,
247 __be32 (*func)(struct svc_rqst *, struct nlm_args *, struct nlm_res *)) 278 __be32 (*func)(struct svc_rqst *, struct nlm_res *))
248{ 279{
280 struct nlm_args *argp = rqstp->rq_argp;
249 struct nlm_host *host; 281 struct nlm_host *host;
250 struct nlm_rqst *call; 282 struct nlm_rqst *call;
251 __be32 stat; 283 __be32 stat;
@@ -261,7 +293,7 @@ static __be32 nlm4svc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_args
261 if (call == NULL) 293 if (call == NULL)
262 return rpc_system_err; 294 return rpc_system_err;
263 295
264 stat = func(rqstp, argp, &call->a_res); 296 stat = func(rqstp, &call->a_res);
265 if (stat != 0) { 297 if (stat != 0) {
266 nlmsvc_release_call(call); 298 nlmsvc_release_call(call);
267 return stat; 299 return stat;
@@ -273,48 +305,44 @@ static __be32 nlm4svc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_args
273 return rpc_success; 305 return rpc_success;
274} 306}
275 307
276static __be32 nlm4svc_proc_test_msg(struct svc_rqst *rqstp, struct nlm_args *argp, 308static __be32 nlm4svc_proc_test_msg(struct svc_rqst *rqstp)
277 void *resp)
278{ 309{
279 dprintk("lockd: TEST_MSG called\n"); 310 dprintk("lockd: TEST_MSG called\n");
280 return nlm4svc_callback(rqstp, NLMPROC_TEST_RES, argp, nlm4svc_proc_test); 311 return nlm4svc_callback(rqstp, NLMPROC_TEST_RES, __nlm4svc_proc_test);
281} 312}
282 313
283static __be32 nlm4svc_proc_lock_msg(struct svc_rqst *rqstp, struct nlm_args *argp, 314static __be32 nlm4svc_proc_lock_msg(struct svc_rqst *rqstp)
284 void *resp)
285{ 315{
286 dprintk("lockd: LOCK_MSG called\n"); 316 dprintk("lockd: LOCK_MSG called\n");
287 return nlm4svc_callback(rqstp, NLMPROC_LOCK_RES, argp, nlm4svc_proc_lock); 317 return nlm4svc_callback(rqstp, NLMPROC_LOCK_RES, __nlm4svc_proc_lock);
288} 318}
289 319
290static __be32 nlm4svc_proc_cancel_msg(struct svc_rqst *rqstp, struct nlm_args *argp, 320static __be32 nlm4svc_proc_cancel_msg(struct svc_rqst *rqstp)
291 void *resp)
292{ 321{
293 dprintk("lockd: CANCEL_MSG called\n"); 322 dprintk("lockd: CANCEL_MSG called\n");
294 return nlm4svc_callback(rqstp, NLMPROC_CANCEL_RES, argp, nlm4svc_proc_cancel); 323 return nlm4svc_callback(rqstp, NLMPROC_CANCEL_RES, __nlm4svc_proc_cancel);
295} 324}
296 325
297static __be32 nlm4svc_proc_unlock_msg(struct svc_rqst *rqstp, struct nlm_args *argp, 326static __be32 nlm4svc_proc_unlock_msg(struct svc_rqst *rqstp)
298 void *resp)
299{ 327{
300 dprintk("lockd: UNLOCK_MSG called\n"); 328 dprintk("lockd: UNLOCK_MSG called\n");
301 return nlm4svc_callback(rqstp, NLMPROC_UNLOCK_RES, argp, nlm4svc_proc_unlock); 329 return nlm4svc_callback(rqstp, NLMPROC_UNLOCK_RES, __nlm4svc_proc_unlock);
302} 330}
303 331
304static __be32 nlm4svc_proc_granted_msg(struct svc_rqst *rqstp, struct nlm_args *argp, 332static __be32 nlm4svc_proc_granted_msg(struct svc_rqst *rqstp)
305 void *resp)
306{ 333{
307 dprintk("lockd: GRANTED_MSG called\n"); 334 dprintk("lockd: GRANTED_MSG called\n");
308 return nlm4svc_callback(rqstp, NLMPROC_GRANTED_RES, argp, nlm4svc_proc_granted); 335 return nlm4svc_callback(rqstp, NLMPROC_GRANTED_RES, __nlm4svc_proc_granted);
309} 336}
310 337
311/* 338/*
312 * SHARE: create a DOS share or alter existing share. 339 * SHARE: create a DOS share or alter existing share.
313 */ 340 */
314static __be32 341static __be32
315nlm4svc_proc_share(struct svc_rqst *rqstp, struct nlm_args *argp, 342nlm4svc_proc_share(struct svc_rqst *rqstp)
316 struct nlm_res *resp)
317{ 343{
344 struct nlm_args *argp = rqstp->rq_argp;
345 struct nlm_res *resp = rqstp->rq_resp;
318 struct nlm_host *host; 346 struct nlm_host *host;
319 struct nlm_file *file; 347 struct nlm_file *file;
320 348
@@ -345,9 +373,10 @@ nlm4svc_proc_share(struct svc_rqst *rqstp, struct nlm_args *argp,
345 * UNSHARE: Release a DOS share. 373 * UNSHARE: Release a DOS share.
346 */ 374 */
347static __be32 375static __be32
348nlm4svc_proc_unshare(struct svc_rqst *rqstp, struct nlm_args *argp, 376nlm4svc_proc_unshare(struct svc_rqst *rqstp)
349 struct nlm_res *resp)
350{ 377{
378 struct nlm_args *argp = rqstp->rq_argp;
379 struct nlm_res *resp = rqstp->rq_resp;
351 struct nlm_host *host; 380 struct nlm_host *host;
352 struct nlm_file *file; 381 struct nlm_file *file;
353 382
@@ -378,22 +407,23 @@ nlm4svc_proc_unshare(struct svc_rqst *rqstp, struct nlm_args *argp,
378 * NM_LOCK: Create an unmonitored lock 407 * NM_LOCK: Create an unmonitored lock
379 */ 408 */
380static __be32 409static __be32
381nlm4svc_proc_nm_lock(struct svc_rqst *rqstp, struct nlm_args *argp, 410nlm4svc_proc_nm_lock(struct svc_rqst *rqstp)
382 struct nlm_res *resp)
383{ 411{
412 struct nlm_args *argp = rqstp->rq_argp;
413
384 dprintk("lockd: NM_LOCK called\n"); 414 dprintk("lockd: NM_LOCK called\n");
385 415
386 argp->monitor = 0; /* just clean the monitor flag */ 416 argp->monitor = 0; /* just clean the monitor flag */
387 return nlm4svc_proc_lock(rqstp, argp, resp); 417 return nlm4svc_proc_lock(rqstp);
388} 418}
389 419
390/* 420/*
391 * FREE_ALL: Release all locks and shares held by client 421 * FREE_ALL: Release all locks and shares held by client
392 */ 422 */
393static __be32 423static __be32
394nlm4svc_proc_free_all(struct svc_rqst *rqstp, struct nlm_args *argp, 424nlm4svc_proc_free_all(struct svc_rqst *rqstp)
395 void *resp)
396{ 425{
426 struct nlm_args *argp = rqstp->rq_argp;
397 struct nlm_host *host; 427 struct nlm_host *host;
398 428
399 /* Obtain client */ 429 /* Obtain client */
@@ -409,9 +439,10 @@ nlm4svc_proc_free_all(struct svc_rqst *rqstp, struct nlm_args *argp,
409 * SM_NOTIFY: private callback from statd (not part of official NLM proto) 439 * SM_NOTIFY: private callback from statd (not part of official NLM proto)
410 */ 440 */
411static __be32 441static __be32
412nlm4svc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp, 442nlm4svc_proc_sm_notify(struct svc_rqst *rqstp)
413 void *resp)
414{ 443{
444 struct nlm_reboot *argp = rqstp->rq_argp;
445
415 dprintk("lockd: SM_NOTIFY called\n"); 446 dprintk("lockd: SM_NOTIFY called\n");
416 447
417 if (!nlm_privileged_requester(rqstp)) { 448 if (!nlm_privileged_requester(rqstp)) {
@@ -429,9 +460,10 @@ nlm4svc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp,
429 * client sent a GRANTED_RES, let's remove the associated block 460 * client sent a GRANTED_RES, let's remove the associated block
430 */ 461 */
431static __be32 462static __be32
432nlm4svc_proc_granted_res(struct svc_rqst *rqstp, struct nlm_res *argp, 463nlm4svc_proc_granted_res(struct svc_rqst *rqstp)
433 void *resp)
434{ 464{
465 struct nlm_res *argp = rqstp->rq_argp;
466
435 if (!nlmsvc_ops) 467 if (!nlmsvc_ops)
436 return rpc_success; 468 return rpc_success;
437 469
@@ -463,9 +495,9 @@ nlm4svc_proc_granted_res(struct svc_rqst *rqstp, struct nlm_res *argp,
463struct nlm_void { int dummy; }; 495struct nlm_void { int dummy; };
464 496
465#define PROC(name, xargt, xrest, argt, rest, respsize) \ 497#define PROC(name, xargt, xrest, argt, rest, respsize) \
466 { .pc_func = (svc_procfunc) nlm4svc_proc_##name, \ 498 { .pc_func = nlm4svc_proc_##name, \
467 .pc_decode = (kxdrproc_t) nlm4svc_decode_##xargt, \ 499 .pc_decode = nlm4svc_decode_##xargt, \
468 .pc_encode = (kxdrproc_t) nlm4svc_encode_##xrest, \ 500 .pc_encode = nlm4svc_encode_##xrest, \
469 .pc_release = NULL, \ 501 .pc_release = NULL, \
470 .pc_argsize = sizeof(struct nlm_##argt), \ 502 .pc_argsize = sizeof(struct nlm_##argt), \
471 .pc_ressize = sizeof(struct nlm_##rest), \ 503 .pc_ressize = sizeof(struct nlm_##rest), \
@@ -475,7 +507,7 @@ struct nlm_void { int dummy; };
475#define No (1+1024/4) /* netobj */ 507#define No (1+1024/4) /* netobj */
476#define St 1 /* status */ 508#define St 1 /* status */
477#define Rg 4 /* range (offset + length) */ 509#define Rg 4 /* range (offset + length) */
478struct svc_procedure nlmsvc_procedures4[] = { 510const struct svc_procedure nlmsvc_procedures4[] = {
479 PROC(null, void, void, void, void, 1), 511 PROC(null, void, void, void, void, 1),
480 PROC(test, testargs, testres, args, res, Ck+St+2+No+Rg), 512 PROC(test, testargs, testres, args, res, Ck+St+2+No+Rg),
481 PROC(lock, lockargs, res, args, res, Ck+St), 513 PROC(lock, lockargs, res, args, res, Ck+St),
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index fb26b9f522e7..07915162581d 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -92,7 +92,7 @@ no_locks:
92 * NULL: Test for presence of service 92 * NULL: Test for presence of service
93 */ 93 */
94static __be32 94static __be32
95nlmsvc_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) 95nlmsvc_proc_null(struct svc_rqst *rqstp)
96{ 96{
97 dprintk("lockd: NULL called\n"); 97 dprintk("lockd: NULL called\n");
98 return rpc_success; 98 return rpc_success;
@@ -102,9 +102,9 @@ nlmsvc_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)
102 * TEST: Check for conflicting lock 102 * TEST: Check for conflicting lock
103 */ 103 */
104static __be32 104static __be32
105nlmsvc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp, 105__nlmsvc_proc_test(struct svc_rqst *rqstp, struct nlm_res *resp)
106 struct nlm_res *resp)
107{ 106{
107 struct nlm_args *argp = rqstp->rq_argp;
108 struct nlm_host *host; 108 struct nlm_host *host;
109 struct nlm_file *file; 109 struct nlm_file *file;
110 __be32 rc = rpc_success; 110 __be32 rc = rpc_success;
@@ -130,9 +130,15 @@ nlmsvc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp,
130} 130}
131 131
132static __be32 132static __be32
133nlmsvc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp, 133nlmsvc_proc_test(struct svc_rqst *rqstp)
134 struct nlm_res *resp)
135{ 134{
135 return __nlmsvc_proc_test(rqstp, rqstp->rq_resp);
136}
137
138static __be32
139__nlmsvc_proc_lock(struct svc_rqst *rqstp, struct nlm_res *resp)
140{
141 struct nlm_args *argp = rqstp->rq_argp;
136 struct nlm_host *host; 142 struct nlm_host *host;
137 struct nlm_file *file; 143 struct nlm_file *file;
138 __be32 rc = rpc_success; 144 __be32 rc = rpc_success;
@@ -172,9 +178,15 @@ nlmsvc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
172} 178}
173 179
174static __be32 180static __be32
175nlmsvc_proc_cancel(struct svc_rqst *rqstp, struct nlm_args *argp, 181nlmsvc_proc_lock(struct svc_rqst *rqstp)
176 struct nlm_res *resp) 182{
183 return __nlmsvc_proc_lock(rqstp, rqstp->rq_resp);
184}
185
186static __be32
187__nlmsvc_proc_cancel(struct svc_rqst *rqstp, struct nlm_res *resp)
177{ 188{
189 struct nlm_args *argp = rqstp->rq_argp;
178 struct nlm_host *host; 190 struct nlm_host *host;
179 struct nlm_file *file; 191 struct nlm_file *file;
180 struct net *net = SVC_NET(rqstp); 192 struct net *net = SVC_NET(rqstp);
@@ -202,13 +214,19 @@ nlmsvc_proc_cancel(struct svc_rqst *rqstp, struct nlm_args *argp,
202 return rpc_success; 214 return rpc_success;
203} 215}
204 216
217static __be32
218nlmsvc_proc_cancel(struct svc_rqst *rqstp)
219{
220 return __nlmsvc_proc_cancel(rqstp, rqstp->rq_resp);
221}
222
205/* 223/*
206 * UNLOCK: release a lock 224 * UNLOCK: release a lock
207 */ 225 */
208static __be32 226static __be32
209nlmsvc_proc_unlock(struct svc_rqst *rqstp, struct nlm_args *argp, 227__nlmsvc_proc_unlock(struct svc_rqst *rqstp, struct nlm_res *resp)
210 struct nlm_res *resp)
211{ 228{
229 struct nlm_args *argp = rqstp->rq_argp;
212 struct nlm_host *host; 230 struct nlm_host *host;
213 struct nlm_file *file; 231 struct nlm_file *file;
214 struct net *net = SVC_NET(rqstp); 232 struct net *net = SVC_NET(rqstp);
@@ -236,14 +254,21 @@ nlmsvc_proc_unlock(struct svc_rqst *rqstp, struct nlm_args *argp,
236 return rpc_success; 254 return rpc_success;
237} 255}
238 256
257static __be32
258nlmsvc_proc_unlock(struct svc_rqst *rqstp)
259{
260 return __nlmsvc_proc_unlock(rqstp, rqstp->rq_resp);
261}
262
239/* 263/*
240 * GRANTED: A server calls us to tell that a process' lock request 264 * GRANTED: A server calls us to tell that a process' lock request
241 * was granted 265 * was granted
242 */ 266 */
243static __be32 267static __be32
244nlmsvc_proc_granted(struct svc_rqst *rqstp, struct nlm_args *argp, 268__nlmsvc_proc_granted(struct svc_rqst *rqstp, struct nlm_res *resp)
245 struct nlm_res *resp)
246{ 269{
270 struct nlm_args *argp = rqstp->rq_argp;
271
247 resp->cookie = argp->cookie; 272 resp->cookie = argp->cookie;
248 273
249 dprintk("lockd: GRANTED called\n"); 274 dprintk("lockd: GRANTED called\n");
@@ -252,6 +277,12 @@ nlmsvc_proc_granted(struct svc_rqst *rqstp, struct nlm_args *argp,
252 return rpc_success; 277 return rpc_success;
253} 278}
254 279
280static __be32
281nlmsvc_proc_granted(struct svc_rqst *rqstp)
282{
283 return __nlmsvc_proc_granted(rqstp, rqstp->rq_resp);
284}
285
255/* 286/*
256 * This is the generic lockd callback for async RPC calls 287 * This is the generic lockd callback for async RPC calls
257 */ 288 */
@@ -284,9 +315,10 @@ static const struct rpc_call_ops nlmsvc_callback_ops = {
284 * because we send the callback before the reply proper. I hope this 315 * because we send the callback before the reply proper. I hope this
285 * doesn't break any clients. 316 * doesn't break any clients.
286 */ 317 */
287static __be32 nlmsvc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_args *argp, 318static __be32 nlmsvc_callback(struct svc_rqst *rqstp, u32 proc,
288 __be32 (*func)(struct svc_rqst *, struct nlm_args *, struct nlm_res *)) 319 __be32 (*func)(struct svc_rqst *, struct nlm_res *))
289{ 320{
321 struct nlm_args *argp = rqstp->rq_argp;
290 struct nlm_host *host; 322 struct nlm_host *host;
291 struct nlm_rqst *call; 323 struct nlm_rqst *call;
292 __be32 stat; 324 __be32 stat;
@@ -302,7 +334,7 @@ static __be32 nlmsvc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_args
302 if (call == NULL) 334 if (call == NULL)
303 return rpc_system_err; 335 return rpc_system_err;
304 336
305 stat = func(rqstp, argp, &call->a_res); 337 stat = func(rqstp, &call->a_res);
306 if (stat != 0) { 338 if (stat != 0) {
307 nlmsvc_release_call(call); 339 nlmsvc_release_call(call);
308 return stat; 340 return stat;
@@ -314,50 +346,46 @@ static __be32 nlmsvc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_args
314 return rpc_success; 346 return rpc_success;
315} 347}
316 348
317static __be32 nlmsvc_proc_test_msg(struct svc_rqst *rqstp, struct nlm_args *argp, 349static __be32 nlmsvc_proc_test_msg(struct svc_rqst *rqstp)
318 void *resp)
319{ 350{
320 dprintk("lockd: TEST_MSG called\n"); 351 dprintk("lockd: TEST_MSG called\n");
321 return nlmsvc_callback(rqstp, NLMPROC_TEST_RES, argp, nlmsvc_proc_test); 352 return nlmsvc_callback(rqstp, NLMPROC_TEST_RES, __nlmsvc_proc_test);
322} 353}
323 354
324static __be32 nlmsvc_proc_lock_msg(struct svc_rqst *rqstp, struct nlm_args *argp, 355static __be32 nlmsvc_proc_lock_msg(struct svc_rqst *rqstp)
325 void *resp)
326{ 356{
327 dprintk("lockd: LOCK_MSG called\n"); 357 dprintk("lockd: LOCK_MSG called\n");
328 return nlmsvc_callback(rqstp, NLMPROC_LOCK_RES, argp, nlmsvc_proc_lock); 358 return nlmsvc_callback(rqstp, NLMPROC_LOCK_RES, __nlmsvc_proc_lock);
329} 359}
330 360
331static __be32 nlmsvc_proc_cancel_msg(struct svc_rqst *rqstp, struct nlm_args *argp, 361static __be32 nlmsvc_proc_cancel_msg(struct svc_rqst *rqstp)
332 void *resp)
333{ 362{
334 dprintk("lockd: CANCEL_MSG called\n"); 363 dprintk("lockd: CANCEL_MSG called\n");
335 return nlmsvc_callback(rqstp, NLMPROC_CANCEL_RES, argp, nlmsvc_proc_cancel); 364 return nlmsvc_callback(rqstp, NLMPROC_CANCEL_RES, __nlmsvc_proc_cancel);
336} 365}
337 366
338static __be32 367static __be32
339nlmsvc_proc_unlock_msg(struct svc_rqst *rqstp, struct nlm_args *argp, 368nlmsvc_proc_unlock_msg(struct svc_rqst *rqstp)
340 void *resp)
341{ 369{
342 dprintk("lockd: UNLOCK_MSG called\n"); 370 dprintk("lockd: UNLOCK_MSG called\n");
343 return nlmsvc_callback(rqstp, NLMPROC_UNLOCK_RES, argp, nlmsvc_proc_unlock); 371 return nlmsvc_callback(rqstp, NLMPROC_UNLOCK_RES, __nlmsvc_proc_unlock);
344} 372}
345 373
346static __be32 374static __be32
347nlmsvc_proc_granted_msg(struct svc_rqst *rqstp, struct nlm_args *argp, 375nlmsvc_proc_granted_msg(struct svc_rqst *rqstp)
348 void *resp)
349{ 376{
350 dprintk("lockd: GRANTED_MSG called\n"); 377 dprintk("lockd: GRANTED_MSG called\n");
351 return nlmsvc_callback(rqstp, NLMPROC_GRANTED_RES, argp, nlmsvc_proc_granted); 378 return nlmsvc_callback(rqstp, NLMPROC_GRANTED_RES, __nlmsvc_proc_granted);
352} 379}
353 380
354/* 381/*
355 * SHARE: create a DOS share or alter existing share. 382 * SHARE: create a DOS share or alter existing share.
356 */ 383 */
357static __be32 384static __be32
358nlmsvc_proc_share(struct svc_rqst *rqstp, struct nlm_args *argp, 385nlmsvc_proc_share(struct svc_rqst *rqstp)
359 struct nlm_res *resp)
360{ 386{
387 struct nlm_args *argp = rqstp->rq_argp;
388 struct nlm_res *resp = rqstp->rq_resp;
361 struct nlm_host *host; 389 struct nlm_host *host;
362 struct nlm_file *file; 390 struct nlm_file *file;
363 391
@@ -388,9 +416,10 @@ nlmsvc_proc_share(struct svc_rqst *rqstp, struct nlm_args *argp,
388 * UNSHARE: Release a DOS share. 416 * UNSHARE: Release a DOS share.
389 */ 417 */
390static __be32 418static __be32
391nlmsvc_proc_unshare(struct svc_rqst *rqstp, struct nlm_args *argp, 419nlmsvc_proc_unshare(struct svc_rqst *rqstp)
392 struct nlm_res *resp)
393{ 420{
421 struct nlm_args *argp = rqstp->rq_argp;
422 struct nlm_res *resp = rqstp->rq_resp;
394 struct nlm_host *host; 423 struct nlm_host *host;
395 struct nlm_file *file; 424 struct nlm_file *file;
396 425
@@ -421,22 +450,23 @@ nlmsvc_proc_unshare(struct svc_rqst *rqstp, struct nlm_args *argp,
421 * NM_LOCK: Create an unmonitored lock 450 * NM_LOCK: Create an unmonitored lock
422 */ 451 */
423static __be32 452static __be32
424nlmsvc_proc_nm_lock(struct svc_rqst *rqstp, struct nlm_args *argp, 453nlmsvc_proc_nm_lock(struct svc_rqst *rqstp)
425 struct nlm_res *resp)
426{ 454{
455 struct nlm_args *argp = rqstp->rq_argp;
456
427 dprintk("lockd: NM_LOCK called\n"); 457 dprintk("lockd: NM_LOCK called\n");
428 458
429 argp->monitor = 0; /* just clean the monitor flag */ 459 argp->monitor = 0; /* just clean the monitor flag */
430 return nlmsvc_proc_lock(rqstp, argp, resp); 460 return nlmsvc_proc_lock(rqstp);
431} 461}
432 462
433/* 463/*
434 * FREE_ALL: Release all locks and shares held by client 464 * FREE_ALL: Release all locks and shares held by client
435 */ 465 */
436static __be32 466static __be32
437nlmsvc_proc_free_all(struct svc_rqst *rqstp, struct nlm_args *argp, 467nlmsvc_proc_free_all(struct svc_rqst *rqstp)
438 void *resp)
439{ 468{
469 struct nlm_args *argp = rqstp->rq_argp;
440 struct nlm_host *host; 470 struct nlm_host *host;
441 471
442 /* Obtain client */ 472 /* Obtain client */
@@ -452,9 +482,10 @@ nlmsvc_proc_free_all(struct svc_rqst *rqstp, struct nlm_args *argp,
452 * SM_NOTIFY: private callback from statd (not part of official NLM proto) 482 * SM_NOTIFY: private callback from statd (not part of official NLM proto)
453 */ 483 */
454static __be32 484static __be32
455nlmsvc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp, 485nlmsvc_proc_sm_notify(struct svc_rqst *rqstp)
456 void *resp)
457{ 486{
487 struct nlm_reboot *argp = rqstp->rq_argp;
488
458 dprintk("lockd: SM_NOTIFY called\n"); 489 dprintk("lockd: SM_NOTIFY called\n");
459 490
460 if (!nlm_privileged_requester(rqstp)) { 491 if (!nlm_privileged_requester(rqstp)) {
@@ -472,9 +503,10 @@ nlmsvc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp,
472 * client sent a GRANTED_RES, let's remove the associated block 503 * client sent a GRANTED_RES, let's remove the associated block
473 */ 504 */
474static __be32 505static __be32
475nlmsvc_proc_granted_res(struct svc_rqst *rqstp, struct nlm_res *argp, 506nlmsvc_proc_granted_res(struct svc_rqst *rqstp)
476 void *resp)
477{ 507{
508 struct nlm_res *argp = rqstp->rq_argp;
509
478 if (!nlmsvc_ops) 510 if (!nlmsvc_ops)
479 return rpc_success; 511 return rpc_success;
480 512
@@ -505,9 +537,9 @@ nlmsvc_proc_granted_res(struct svc_rqst *rqstp, struct nlm_res *argp,
505struct nlm_void { int dummy; }; 537struct nlm_void { int dummy; };
506 538
507#define PROC(name, xargt, xrest, argt, rest, respsize) \ 539#define PROC(name, xargt, xrest, argt, rest, respsize) \
508 { .pc_func = (svc_procfunc) nlmsvc_proc_##name, \ 540 { .pc_func = nlmsvc_proc_##name, \
509 .pc_decode = (kxdrproc_t) nlmsvc_decode_##xargt, \ 541 .pc_decode = nlmsvc_decode_##xargt, \
510 .pc_encode = (kxdrproc_t) nlmsvc_encode_##xrest, \ 542 .pc_encode = nlmsvc_encode_##xrest, \
511 .pc_release = NULL, \ 543 .pc_release = NULL, \
512 .pc_argsize = sizeof(struct nlm_##argt), \ 544 .pc_argsize = sizeof(struct nlm_##argt), \
513 .pc_ressize = sizeof(struct nlm_##rest), \ 545 .pc_ressize = sizeof(struct nlm_##rest), \
@@ -519,7 +551,7 @@ struct nlm_void { int dummy; };
519#define No (1+1024/4) /* Net Obj */ 551#define No (1+1024/4) /* Net Obj */
520#define Rg 2 /* range - offset + size */ 552#define Rg 2 /* range - offset + size */
521 553
522struct svc_procedure nlmsvc_procedures[] = { 554const struct svc_procedure nlmsvc_procedures[] = {
523 PROC(null, void, void, void, void, 1), 555 PROC(null, void, void, void, void, 1),
524 PROC(test, testargs, testres, args, res, Ck+St+2+No+Rg), 556 PROC(test, testargs, testres, args, res, Ck+St+2+No+Rg),
525 PROC(lock, lockargs, res, args, res, Ck+St), 557 PROC(lock, lockargs, res, args, res, Ck+St),
diff --git a/fs/lockd/xdr.c b/fs/lockd/xdr.c
index 5b651daad518..442bbd0b0b29 100644
--- a/fs/lockd/xdr.c
+++ b/fs/lockd/xdr.c
@@ -182,8 +182,9 @@ nlm_encode_testres(__be32 *p, struct nlm_res *resp)
182 * First, the server side XDR functions 182 * First, the server side XDR functions
183 */ 183 */
184int 184int
185nlmsvc_decode_testargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp) 185nlmsvc_decode_testargs(struct svc_rqst *rqstp, __be32 *p)
186{ 186{
187 struct nlm_args *argp = rqstp->rq_argp;
187 u32 exclusive; 188 u32 exclusive;
188 189
189 if (!(p = nlm_decode_cookie(p, &argp->cookie))) 190 if (!(p = nlm_decode_cookie(p, &argp->cookie)))
@@ -199,16 +200,19 @@ nlmsvc_decode_testargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
199} 200}
200 201
201int 202int
202nlmsvc_encode_testres(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp) 203nlmsvc_encode_testres(struct svc_rqst *rqstp, __be32 *p)
203{ 204{
205 struct nlm_res *resp = rqstp->rq_resp;
206
204 if (!(p = nlm_encode_testres(p, resp))) 207 if (!(p = nlm_encode_testres(p, resp)))
205 return 0; 208 return 0;
206 return xdr_ressize_check(rqstp, p); 209 return xdr_ressize_check(rqstp, p);
207} 210}
208 211
209int 212int
210nlmsvc_decode_lockargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp) 213nlmsvc_decode_lockargs(struct svc_rqst *rqstp, __be32 *p)
211{ 214{
215 struct nlm_args *argp = rqstp->rq_argp;
212 u32 exclusive; 216 u32 exclusive;
213 217
214 if (!(p = nlm_decode_cookie(p, &argp->cookie))) 218 if (!(p = nlm_decode_cookie(p, &argp->cookie)))
@@ -227,8 +231,9 @@ nlmsvc_decode_lockargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
227} 231}
228 232
229int 233int
230nlmsvc_decode_cancargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp) 234nlmsvc_decode_cancargs(struct svc_rqst *rqstp, __be32 *p)
231{ 235{
236 struct nlm_args *argp = rqstp->rq_argp;
232 u32 exclusive; 237 u32 exclusive;
233 238
234 if (!(p = nlm_decode_cookie(p, &argp->cookie))) 239 if (!(p = nlm_decode_cookie(p, &argp->cookie)))
@@ -243,8 +248,10 @@ nlmsvc_decode_cancargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
243} 248}
244 249
245int 250int
246nlmsvc_decode_unlockargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp) 251nlmsvc_decode_unlockargs(struct svc_rqst *rqstp, __be32 *p)
247{ 252{
253 struct nlm_args *argp = rqstp->rq_argp;
254
248 if (!(p = nlm_decode_cookie(p, &argp->cookie)) 255 if (!(p = nlm_decode_cookie(p, &argp->cookie))
249 || !(p = nlm_decode_lock(p, &argp->lock))) 256 || !(p = nlm_decode_lock(p, &argp->lock)))
250 return 0; 257 return 0;
@@ -253,8 +260,9 @@ nlmsvc_decode_unlockargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
253} 260}
254 261
255int 262int
256nlmsvc_decode_shareargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp) 263nlmsvc_decode_shareargs(struct svc_rqst *rqstp, __be32 *p)
257{ 264{
265 struct nlm_args *argp = rqstp->rq_argp;
258 struct nlm_lock *lock = &argp->lock; 266 struct nlm_lock *lock = &argp->lock;
259 267
260 memset(lock, 0, sizeof(*lock)); 268 memset(lock, 0, sizeof(*lock));
@@ -274,8 +282,10 @@ nlmsvc_decode_shareargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
274} 282}
275 283
276int 284int
277nlmsvc_encode_shareres(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp) 285nlmsvc_encode_shareres(struct svc_rqst *rqstp, __be32 *p)
278{ 286{
287 struct nlm_res *resp = rqstp->rq_resp;
288
279 if (!(p = nlm_encode_cookie(p, &resp->cookie))) 289 if (!(p = nlm_encode_cookie(p, &resp->cookie)))
280 return 0; 290 return 0;
281 *p++ = resp->status; 291 *p++ = resp->status;
@@ -284,8 +294,10 @@ nlmsvc_encode_shareres(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp)
284} 294}
285 295
286int 296int
287nlmsvc_encode_res(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp) 297nlmsvc_encode_res(struct svc_rqst *rqstp, __be32 *p)
288{ 298{
299 struct nlm_res *resp = rqstp->rq_resp;
300
289 if (!(p = nlm_encode_cookie(p, &resp->cookie))) 301 if (!(p = nlm_encode_cookie(p, &resp->cookie)))
290 return 0; 302 return 0;
291 *p++ = resp->status; 303 *p++ = resp->status;
@@ -293,8 +305,9 @@ nlmsvc_encode_res(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp)
293} 305}
294 306
295int 307int
296nlmsvc_decode_notify(struct svc_rqst *rqstp, __be32 *p, struct nlm_args *argp) 308nlmsvc_decode_notify(struct svc_rqst *rqstp, __be32 *p)
297{ 309{
310 struct nlm_args *argp = rqstp->rq_argp;
298 struct nlm_lock *lock = &argp->lock; 311 struct nlm_lock *lock = &argp->lock;
299 312
300 if (!(p = xdr_decode_string_inplace(p, &lock->caller, 313 if (!(p = xdr_decode_string_inplace(p, &lock->caller,
@@ -305,8 +318,10 @@ nlmsvc_decode_notify(struct svc_rqst *rqstp, __be32 *p, struct nlm_args *argp)
305} 318}
306 319
307int 320int
308nlmsvc_decode_reboot(struct svc_rqst *rqstp, __be32 *p, struct nlm_reboot *argp) 321nlmsvc_decode_reboot(struct svc_rqst *rqstp, __be32 *p)
309{ 322{
323 struct nlm_reboot *argp = rqstp->rq_argp;
324
310 if (!(p = xdr_decode_string_inplace(p, &argp->mon, &argp->len, SM_MAXSTRLEN))) 325 if (!(p = xdr_decode_string_inplace(p, &argp->mon, &argp->len, SM_MAXSTRLEN)))
311 return 0; 326 return 0;
312 argp->state = ntohl(*p++); 327 argp->state = ntohl(*p++);
@@ -316,8 +331,10 @@ nlmsvc_decode_reboot(struct svc_rqst *rqstp, __be32 *p, struct nlm_reboot *argp)
316} 331}
317 332
318int 333int
319nlmsvc_decode_res(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp) 334nlmsvc_decode_res(struct svc_rqst *rqstp, __be32 *p)
320{ 335{
336 struct nlm_res *resp = rqstp->rq_argp;
337
321 if (!(p = nlm_decode_cookie(p, &resp->cookie))) 338 if (!(p = nlm_decode_cookie(p, &resp->cookie)))
322 return 0; 339 return 0;
323 resp->status = *p++; 340 resp->status = *p++;
@@ -325,13 +342,13 @@ nlmsvc_decode_res(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp)
325} 342}
326 343
327int 344int
328nlmsvc_decode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy) 345nlmsvc_decode_void(struct svc_rqst *rqstp, __be32 *p)
329{ 346{
330 return xdr_argsize_check(rqstp, p); 347 return xdr_argsize_check(rqstp, p);
331} 348}
332 349
333int 350int
334nlmsvc_encode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy) 351nlmsvc_encode_void(struct svc_rqst *rqstp, __be32 *p)
335{ 352{
336 return xdr_ressize_check(rqstp, p); 353 return xdr_ressize_check(rqstp, p);
337} 354}
diff --git a/fs/lockd/xdr4.c b/fs/lockd/xdr4.c
index dfa4789cd460..2a0cd5679c49 100644
--- a/fs/lockd/xdr4.c
+++ b/fs/lockd/xdr4.c
@@ -179,8 +179,9 @@ nlm4_encode_testres(__be32 *p, struct nlm_res *resp)
179 * First, the server side XDR functions 179 * First, the server side XDR functions
180 */ 180 */
181int 181int
182nlm4svc_decode_testargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp) 182nlm4svc_decode_testargs(struct svc_rqst *rqstp, __be32 *p)
183{ 183{
184 struct nlm_args *argp = rqstp->rq_argp;
184 u32 exclusive; 185 u32 exclusive;
185 186
186 if (!(p = nlm4_decode_cookie(p, &argp->cookie))) 187 if (!(p = nlm4_decode_cookie(p, &argp->cookie)))
@@ -196,16 +197,19 @@ nlm4svc_decode_testargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
196} 197}
197 198
198int 199int
199nlm4svc_encode_testres(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp) 200nlm4svc_encode_testres(struct svc_rqst *rqstp, __be32 *p)
200{ 201{
202 struct nlm_res *resp = rqstp->rq_resp;
203
201 if (!(p = nlm4_encode_testres(p, resp))) 204 if (!(p = nlm4_encode_testres(p, resp)))
202 return 0; 205 return 0;
203 return xdr_ressize_check(rqstp, p); 206 return xdr_ressize_check(rqstp, p);
204} 207}
205 208
206int 209int
207nlm4svc_decode_lockargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp) 210nlm4svc_decode_lockargs(struct svc_rqst *rqstp, __be32 *p)
208{ 211{
212 struct nlm_args *argp = rqstp->rq_argp;
209 u32 exclusive; 213 u32 exclusive;
210 214
211 if (!(p = nlm4_decode_cookie(p, &argp->cookie))) 215 if (!(p = nlm4_decode_cookie(p, &argp->cookie)))
@@ -224,8 +228,9 @@ nlm4svc_decode_lockargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
224} 228}
225 229
226int 230int
227nlm4svc_decode_cancargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp) 231nlm4svc_decode_cancargs(struct svc_rqst *rqstp, __be32 *p)
228{ 232{
233 struct nlm_args *argp = rqstp->rq_argp;
229 u32 exclusive; 234 u32 exclusive;
230 235
231 if (!(p = nlm4_decode_cookie(p, &argp->cookie))) 236 if (!(p = nlm4_decode_cookie(p, &argp->cookie)))
@@ -240,8 +245,10 @@ nlm4svc_decode_cancargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
240} 245}
241 246
242int 247int
243nlm4svc_decode_unlockargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp) 248nlm4svc_decode_unlockargs(struct svc_rqst *rqstp, __be32 *p)
244{ 249{
250 struct nlm_args *argp = rqstp->rq_argp;
251
245 if (!(p = nlm4_decode_cookie(p, &argp->cookie)) 252 if (!(p = nlm4_decode_cookie(p, &argp->cookie))
246 || !(p = nlm4_decode_lock(p, &argp->lock))) 253 || !(p = nlm4_decode_lock(p, &argp->lock)))
247 return 0; 254 return 0;
@@ -250,8 +257,9 @@ nlm4svc_decode_unlockargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
250} 257}
251 258
252int 259int
253nlm4svc_decode_shareargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp) 260nlm4svc_decode_shareargs(struct svc_rqst *rqstp, __be32 *p)
254{ 261{
262 struct nlm_args *argp = rqstp->rq_argp;
255 struct nlm_lock *lock = &argp->lock; 263 struct nlm_lock *lock = &argp->lock;
256 264
257 memset(lock, 0, sizeof(*lock)); 265 memset(lock, 0, sizeof(*lock));
@@ -271,8 +279,10 @@ nlm4svc_decode_shareargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
271} 279}
272 280
273int 281int
274nlm4svc_encode_shareres(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp) 282nlm4svc_encode_shareres(struct svc_rqst *rqstp, __be32 *p)
275{ 283{
284 struct nlm_res *resp = rqstp->rq_resp;
285
276 if (!(p = nlm4_encode_cookie(p, &resp->cookie))) 286 if (!(p = nlm4_encode_cookie(p, &resp->cookie)))
277 return 0; 287 return 0;
278 *p++ = resp->status; 288 *p++ = resp->status;
@@ -281,8 +291,10 @@ nlm4svc_encode_shareres(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp)
281} 291}
282 292
283int 293int
284nlm4svc_encode_res(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp) 294nlm4svc_encode_res(struct svc_rqst *rqstp, __be32 *p)
285{ 295{
296 struct nlm_res *resp = rqstp->rq_resp;
297
286 if (!(p = nlm4_encode_cookie(p, &resp->cookie))) 298 if (!(p = nlm4_encode_cookie(p, &resp->cookie)))
287 return 0; 299 return 0;
288 *p++ = resp->status; 300 *p++ = resp->status;
@@ -290,8 +302,9 @@ nlm4svc_encode_res(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp)
290} 302}
291 303
292int 304int
293nlm4svc_decode_notify(struct svc_rqst *rqstp, __be32 *p, struct nlm_args *argp) 305nlm4svc_decode_notify(struct svc_rqst *rqstp, __be32 *p)
294{ 306{
307 struct nlm_args *argp = rqstp->rq_argp;
295 struct nlm_lock *lock = &argp->lock; 308 struct nlm_lock *lock = &argp->lock;
296 309
297 if (!(p = xdr_decode_string_inplace(p, &lock->caller, 310 if (!(p = xdr_decode_string_inplace(p, &lock->caller,
@@ -302,8 +315,10 @@ nlm4svc_decode_notify(struct svc_rqst *rqstp, __be32 *p, struct nlm_args *argp)
302} 315}
303 316
304int 317int
305nlm4svc_decode_reboot(struct svc_rqst *rqstp, __be32 *p, struct nlm_reboot *argp) 318nlm4svc_decode_reboot(struct svc_rqst *rqstp, __be32 *p)
306{ 319{
320 struct nlm_reboot *argp = rqstp->rq_argp;
321
307 if (!(p = xdr_decode_string_inplace(p, &argp->mon, &argp->len, SM_MAXSTRLEN))) 322 if (!(p = xdr_decode_string_inplace(p, &argp->mon, &argp->len, SM_MAXSTRLEN)))
308 return 0; 323 return 0;
309 argp->state = ntohl(*p++); 324 argp->state = ntohl(*p++);
@@ -313,8 +328,10 @@ nlm4svc_decode_reboot(struct svc_rqst *rqstp, __be32 *p, struct nlm_reboot *argp
313} 328}
314 329
315int 330int
316nlm4svc_decode_res(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp) 331nlm4svc_decode_res(struct svc_rqst *rqstp, __be32 *p)
317{ 332{
333 struct nlm_res *resp = rqstp->rq_argp;
334
318 if (!(p = nlm4_decode_cookie(p, &resp->cookie))) 335 if (!(p = nlm4_decode_cookie(p, &resp->cookie)))
319 return 0; 336 return 0;
320 resp->status = *p++; 337 resp->status = *p++;
@@ -322,13 +339,13 @@ nlm4svc_decode_res(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp)
322} 339}
323 340
324int 341int
325nlm4svc_decode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy) 342nlm4svc_decode_void(struct svc_rqst *rqstp, __be32 *p)
326{ 343{
327 return xdr_argsize_check(rqstp, p); 344 return xdr_argsize_check(rqstp, p);
328} 345}
329 346
330int 347int
331nlm4svc_encode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy) 348nlm4svc_encode_void(struct svc_rqst *rqstp, __be32 *p)
332{ 349{
333 return xdr_ressize_check(rqstp, p); 350 return xdr_ressize_check(rqstp, p);
334} 351}
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c
index 73a1f928226c..34323877ec13 100644
--- a/fs/nfs/callback.c
+++ b/fs/nfs/callback.c
@@ -439,7 +439,7 @@ static int nfs_callback_authenticate(struct svc_rqst *rqstp)
439/* 439/*
440 * Define NFS4 callback program 440 * Define NFS4 callback program
441 */ 441 */
442static struct svc_version *nfs4_callback_version[] = { 442static const struct svc_version *nfs4_callback_version[] = {
443 [1] = &nfs4_callback_version1, 443 [1] = &nfs4_callback_version1,
444 [4] = &nfs4_callback_version4, 444 [4] = &nfs4_callback_version4,
445}; 445};
diff --git a/fs/nfs/callback.h b/fs/nfs/callback.h
index c701c308fac5..3dc54d7cb19c 100644
--- a/fs/nfs/callback.h
+++ b/fs/nfs/callback.h
@@ -114,8 +114,7 @@ struct cb_sequenceres {
114 uint32_t csr_target_highestslotid; 114 uint32_t csr_target_highestslotid;
115}; 115};
116 116
117extern __be32 nfs4_callback_sequence(struct cb_sequenceargs *args, 117extern __be32 nfs4_callback_sequence(void *argp, void *resp,
118 struct cb_sequenceres *res,
119 struct cb_process_state *cps); 118 struct cb_process_state *cps);
120 119
121#define RCA4_TYPE_MASK_RDATA_DLG 0 120#define RCA4_TYPE_MASK_RDATA_DLG 0
@@ -134,15 +133,13 @@ struct cb_recallanyargs {
134 uint32_t craa_type_mask; 133 uint32_t craa_type_mask;
135}; 134};
136 135
137extern __be32 nfs4_callback_recallany(struct cb_recallanyargs *args, 136extern __be32 nfs4_callback_recallany(void *argp, void *resp,
138 void *dummy,
139 struct cb_process_state *cps); 137 struct cb_process_state *cps);
140 138
141struct cb_recallslotargs { 139struct cb_recallslotargs {
142 uint32_t crsa_target_highest_slotid; 140 uint32_t crsa_target_highest_slotid;
143}; 141};
144extern __be32 nfs4_callback_recallslot(struct cb_recallslotargs *args, 142extern __be32 nfs4_callback_recallslot(void *argp, void *resp,
145 void *dummy,
146 struct cb_process_state *cps); 143 struct cb_process_state *cps);
147 144
148struct cb_layoutrecallargs { 145struct cb_layoutrecallargs {
@@ -159,9 +156,8 @@ struct cb_layoutrecallargs {
159 }; 156 };
160}; 157};
161 158
162extern __be32 nfs4_callback_layoutrecall( 159extern __be32 nfs4_callback_layoutrecall(void *argp, void *resp,
163 struct cb_layoutrecallargs *args, 160 struct cb_process_state *cps);
164 void *dummy, struct cb_process_state *cps);
165 161
166struct cb_devicenotifyitem { 162struct cb_devicenotifyitem {
167 uint32_t cbd_notify_type; 163 uint32_t cbd_notify_type;
@@ -175,9 +171,8 @@ struct cb_devicenotifyargs {
175 struct cb_devicenotifyitem *devs; 171 struct cb_devicenotifyitem *devs;
176}; 172};
177 173
178extern __be32 nfs4_callback_devicenotify( 174extern __be32 nfs4_callback_devicenotify(void *argp, void *resp,
179 struct cb_devicenotifyargs *args, 175 struct cb_process_state *cps);
180 void *dummy, struct cb_process_state *cps);
181 176
182struct cb_notify_lock_args { 177struct cb_notify_lock_args {
183 struct nfs_fh cbnl_fh; 178 struct nfs_fh cbnl_fh;
@@ -185,15 +180,13 @@ struct cb_notify_lock_args {
185 bool cbnl_valid; 180 bool cbnl_valid;
186}; 181};
187 182
188extern __be32 nfs4_callback_notify_lock(struct cb_notify_lock_args *args, 183extern __be32 nfs4_callback_notify_lock(void *argp, void *resp,
189 void *dummy,
190 struct cb_process_state *cps); 184 struct cb_process_state *cps);
191#endif /* CONFIG_NFS_V4_1 */ 185#endif /* CONFIG_NFS_V4_1 */
192extern int check_gss_callback_principal(struct nfs_client *, struct svc_rqst *); 186extern int check_gss_callback_principal(struct nfs_client *, struct svc_rqst *);
193extern __be32 nfs4_callback_getattr(struct cb_getattrargs *args, 187extern __be32 nfs4_callback_getattr(void *argp, void *resp,
194 struct cb_getattrres *res,
195 struct cb_process_state *cps); 188 struct cb_process_state *cps);
196extern __be32 nfs4_callback_recall(struct cb_recallargs *args, void *dummy, 189extern __be32 nfs4_callback_recall(void *argp, void *resp,
197 struct cb_process_state *cps); 190 struct cb_process_state *cps);
198#if IS_ENABLED(CONFIG_NFS_V4) 191#if IS_ENABLED(CONFIG_NFS_V4)
199extern int nfs_callback_up(u32 minorversion, struct rpc_xprt *xprt); 192extern int nfs_callback_up(u32 minorversion, struct rpc_xprt *xprt);
diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c
index 52479f180ea1..5427cdf04c5a 100644
--- a/fs/nfs/callback_proc.c
+++ b/fs/nfs/callback_proc.c
@@ -19,10 +19,11 @@
19 19
20#define NFSDBG_FACILITY NFSDBG_CALLBACK 20#define NFSDBG_FACILITY NFSDBG_CALLBACK
21 21
22__be32 nfs4_callback_getattr(struct cb_getattrargs *args, 22__be32 nfs4_callback_getattr(void *argp, void *resp,
23 struct cb_getattrres *res,
24 struct cb_process_state *cps) 23 struct cb_process_state *cps)
25{ 24{
25 struct cb_getattrargs *args = argp;
26 struct cb_getattrres *res = resp;
26 struct nfs_delegation *delegation; 27 struct nfs_delegation *delegation;
27 struct nfs_inode *nfsi; 28 struct nfs_inode *nfsi;
28 struct inode *inode; 29 struct inode *inode;
@@ -68,9 +69,10 @@ out:
68 return res->status; 69 return res->status;
69} 70}
70 71
71__be32 nfs4_callback_recall(struct cb_recallargs *args, void *dummy, 72__be32 nfs4_callback_recall(void *argp, void *resp,
72 struct cb_process_state *cps) 73 struct cb_process_state *cps)
73{ 74{
75 struct cb_recallargs *args = argp;
74 struct inode *inode; 76 struct inode *inode;
75 __be32 res; 77 __be32 res;
76 78
@@ -324,9 +326,10 @@ static u32 do_callback_layoutrecall(struct nfs_client *clp,
324 return initiate_bulk_draining(clp, args); 326 return initiate_bulk_draining(clp, args);
325} 327}
326 328
327__be32 nfs4_callback_layoutrecall(struct cb_layoutrecallargs *args, 329__be32 nfs4_callback_layoutrecall(void *argp, void *resp,
328 void *dummy, struct cb_process_state *cps) 330 struct cb_process_state *cps)
329{ 331{
332 struct cb_layoutrecallargs *args = argp;
330 u32 res = NFS4ERR_OP_NOT_IN_SESSION; 333 u32 res = NFS4ERR_OP_NOT_IN_SESSION;
331 334
332 if (cps->clp) 335 if (cps->clp)
@@ -345,9 +348,10 @@ static void pnfs_recall_all_layouts(struct nfs_client *clp)
345 do_callback_layoutrecall(clp, &args); 348 do_callback_layoutrecall(clp, &args);
346} 349}
347 350
348__be32 nfs4_callback_devicenotify(struct cb_devicenotifyargs *args, 351__be32 nfs4_callback_devicenotify(void *argp, void *resp,
349 void *dummy, struct cb_process_state *cps) 352 struct cb_process_state *cps)
350{ 353{
354 struct cb_devicenotifyargs *args = argp;
351 int i; 355 int i;
352 __be32 res = 0; 356 __be32 res = 0;
353 struct nfs_client *clp = cps->clp; 357 struct nfs_client *clp = cps->clp;
@@ -469,10 +473,11 @@ out:
469 return status; 473 return status;
470} 474}
471 475
472__be32 nfs4_callback_sequence(struct cb_sequenceargs *args, 476__be32 nfs4_callback_sequence(void *argp, void *resp,
473 struct cb_sequenceres *res,
474 struct cb_process_state *cps) 477 struct cb_process_state *cps)
475{ 478{
479 struct cb_sequenceargs *args = argp;
480 struct cb_sequenceres *res = resp;
476 struct nfs4_slot_table *tbl; 481 struct nfs4_slot_table *tbl;
477 struct nfs4_slot *slot; 482 struct nfs4_slot *slot;
478 struct nfs_client *clp; 483 struct nfs_client *clp;
@@ -571,9 +576,10 @@ validate_bitmap_values(unsigned long mask)
571 return (mask & ~RCA4_TYPE_MASK_ALL) == 0; 576 return (mask & ~RCA4_TYPE_MASK_ALL) == 0;
572} 577}
573 578
574__be32 nfs4_callback_recallany(struct cb_recallanyargs *args, void *dummy, 579__be32 nfs4_callback_recallany(void *argp, void *resp,
575 struct cb_process_state *cps) 580 struct cb_process_state *cps)
576{ 581{
582 struct cb_recallanyargs *args = argp;
577 __be32 status; 583 __be32 status;
578 fmode_t flags = 0; 584 fmode_t flags = 0;
579 585
@@ -606,9 +612,10 @@ out:
606} 612}
607 613
608/* Reduce the fore channel's max_slots to the target value */ 614/* Reduce the fore channel's max_slots to the target value */
609__be32 nfs4_callback_recallslot(struct cb_recallslotargs *args, void *dummy, 615__be32 nfs4_callback_recallslot(void *argp, void *resp,
610 struct cb_process_state *cps) 616 struct cb_process_state *cps)
611{ 617{
618 struct cb_recallslotargs *args = argp;
612 struct nfs4_slot_table *fc_tbl; 619 struct nfs4_slot_table *fc_tbl;
613 __be32 status; 620 __be32 status;
614 621
@@ -631,9 +638,11 @@ out:
631 return status; 638 return status;
632} 639}
633 640
634__be32 nfs4_callback_notify_lock(struct cb_notify_lock_args *args, void *dummy, 641__be32 nfs4_callback_notify_lock(void *argp, void *resp,
635 struct cb_process_state *cps) 642 struct cb_process_state *cps)
636{ 643{
644 struct cb_notify_lock_args *args = argp;
645
637 if (!cps->clp) /* set in cb_sequence */ 646 if (!cps->clp) /* set in cb_sequence */
638 return htonl(NFS4ERR_OP_NOT_IN_SESSION); 647 return htonl(NFS4ERR_OP_NOT_IN_SESSION);
639 648
diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c
index 390ac9c39c59..681dd642f119 100644
--- a/fs/nfs/callback_xdr.c
+++ b/fs/nfs/callback_xdr.c
@@ -43,32 +43,27 @@
43/* Internal error code */ 43/* Internal error code */
44#define NFS4ERR_RESOURCE_HDR 11050 44#define NFS4ERR_RESOURCE_HDR 11050
45 45
46typedef __be32 (*callback_process_op_t)(void *, void *,
47 struct cb_process_state *);
48typedef __be32 (*callback_decode_arg_t)(struct svc_rqst *, struct xdr_stream *, void *);
49typedef __be32 (*callback_encode_res_t)(struct svc_rqst *, struct xdr_stream *, void *);
50
51
52struct callback_op { 46struct callback_op {
53 callback_process_op_t process_op; 47 __be32 (*process_op)(void *, void *, struct cb_process_state *);
54 callback_decode_arg_t decode_args; 48 __be32 (*decode_args)(struct svc_rqst *, struct xdr_stream *, void *);
55 callback_encode_res_t encode_res; 49 __be32 (*encode_res)(struct svc_rqst *, struct xdr_stream *,
50 const void *);
56 long res_maxsize; 51 long res_maxsize;
57}; 52};
58 53
59static struct callback_op callback_ops[]; 54static struct callback_op callback_ops[];
60 55
61static __be32 nfs4_callback_null(struct svc_rqst *rqstp, void *argp, void *resp) 56static __be32 nfs4_callback_null(struct svc_rqst *rqstp)
62{ 57{
63 return htonl(NFS4_OK); 58 return htonl(NFS4_OK);
64} 59}
65 60
66static int nfs4_decode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy) 61static int nfs4_decode_void(struct svc_rqst *rqstp, __be32 *p)
67{ 62{
68 return xdr_argsize_check(rqstp, p); 63 return xdr_argsize_check(rqstp, p);
69} 64}
70 65
71static int nfs4_encode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy) 66static int nfs4_encode_void(struct svc_rqst *rqstp, __be32 *p)
72{ 67{
73 return xdr_ressize_check(rqstp, p); 68 return xdr_ressize_check(rqstp, p);
74} 69}
@@ -184,8 +179,10 @@ static __be32 decode_op_hdr(struct xdr_stream *xdr, unsigned int *op)
184 return 0; 179 return 0;
185} 180}
186 181
187static __be32 decode_getattr_args(struct svc_rqst *rqstp, struct xdr_stream *xdr, struct cb_getattrargs *args) 182static __be32 decode_getattr_args(struct svc_rqst *rqstp,
183 struct xdr_stream *xdr, void *argp)
188{ 184{
185 struct cb_getattrargs *args = argp;
189 __be32 status; 186 __be32 status;
190 187
191 status = decode_fh(xdr, &args->fh); 188 status = decode_fh(xdr, &args->fh);
@@ -194,8 +191,10 @@ static __be32 decode_getattr_args(struct svc_rqst *rqstp, struct xdr_stream *xdr
194 return decode_bitmap(xdr, args->bitmap); 191 return decode_bitmap(xdr, args->bitmap);
195} 192}
196 193
197static __be32 decode_recall_args(struct svc_rqst *rqstp, struct xdr_stream *xdr, struct cb_recallargs *args) 194static __be32 decode_recall_args(struct svc_rqst *rqstp,
195 struct xdr_stream *xdr, void *argp)
198{ 196{
197 struct cb_recallargs *args = argp;
199 __be32 *p; 198 __be32 *p;
200 __be32 status; 199 __be32 status;
201 200
@@ -217,9 +216,9 @@ static __be32 decode_layout_stateid(struct xdr_stream *xdr, nfs4_stateid *statei
217} 216}
218 217
219static __be32 decode_layoutrecall_args(struct svc_rqst *rqstp, 218static __be32 decode_layoutrecall_args(struct svc_rqst *rqstp,
220 struct xdr_stream *xdr, 219 struct xdr_stream *xdr, void *argp)
221 struct cb_layoutrecallargs *args)
222{ 220{
221 struct cb_layoutrecallargs *args = argp;
223 __be32 *p; 222 __be32 *p;
224 __be32 status = 0; 223 __be32 status = 0;
225 uint32_t iomode; 224 uint32_t iomode;
@@ -262,8 +261,9 @@ static __be32 decode_layoutrecall_args(struct svc_rqst *rqstp,
262static 261static
263__be32 decode_devicenotify_args(struct svc_rqst *rqstp, 262__be32 decode_devicenotify_args(struct svc_rqst *rqstp,
264 struct xdr_stream *xdr, 263 struct xdr_stream *xdr,
265 struct cb_devicenotifyargs *args) 264 void *argp)
266{ 265{
266 struct cb_devicenotifyargs *args = argp;
267 __be32 *p; 267 __be32 *p;
268 __be32 status = 0; 268 __be32 status = 0;
269 u32 tmp; 269 u32 tmp;
@@ -403,8 +403,9 @@ out:
403 403
404static __be32 decode_cb_sequence_args(struct svc_rqst *rqstp, 404static __be32 decode_cb_sequence_args(struct svc_rqst *rqstp,
405 struct xdr_stream *xdr, 405 struct xdr_stream *xdr,
406 struct cb_sequenceargs *args) 406 void *argp)
407{ 407{
408 struct cb_sequenceargs *args = argp;
408 __be32 *p; 409 __be32 *p;
409 int i; 410 int i;
410 __be32 status; 411 __be32 status;
@@ -450,8 +451,9 @@ out_free:
450 451
451static __be32 decode_recallany_args(struct svc_rqst *rqstp, 452static __be32 decode_recallany_args(struct svc_rqst *rqstp,
452 struct xdr_stream *xdr, 453 struct xdr_stream *xdr,
453 struct cb_recallanyargs *args) 454 void *argp)
454{ 455{
456 struct cb_recallanyargs *args = argp;
455 uint32_t bitmap[2]; 457 uint32_t bitmap[2];
456 __be32 *p, status; 458 __be32 *p, status;
457 459
@@ -469,8 +471,9 @@ static __be32 decode_recallany_args(struct svc_rqst *rqstp,
469 471
470static __be32 decode_recallslot_args(struct svc_rqst *rqstp, 472static __be32 decode_recallslot_args(struct svc_rqst *rqstp,
471 struct xdr_stream *xdr, 473 struct xdr_stream *xdr,
472 struct cb_recallslotargs *args) 474 void *argp)
473{ 475{
476 struct cb_recallslotargs *args = argp;
474 __be32 *p; 477 __be32 *p;
475 478
476 p = read_buf(xdr, 4); 479 p = read_buf(xdr, 4);
@@ -510,8 +513,10 @@ static __be32 decode_lockowner(struct xdr_stream *xdr, struct cb_notify_lock_arg
510 return 0; 513 return 0;
511} 514}
512 515
513static __be32 decode_notify_lock_args(struct svc_rqst *rqstp, struct xdr_stream *xdr, struct cb_notify_lock_args *args) 516static __be32 decode_notify_lock_args(struct svc_rqst *rqstp,
517 struct xdr_stream *xdr, void *argp)
514{ 518{
519 struct cb_notify_lock_args *args = argp;
515 __be32 status; 520 __be32 status;
516 521
517 status = decode_fh(xdr, &args->cbnl_fh); 522 status = decode_fh(xdr, &args->cbnl_fh);
@@ -641,8 +646,10 @@ static __be32 encode_op_hdr(struct xdr_stream *xdr, uint32_t op, __be32 res)
641 return 0; 646 return 0;
642} 647}
643 648
644static __be32 encode_getattr_res(struct svc_rqst *rqstp, struct xdr_stream *xdr, const struct cb_getattrres *res) 649static __be32 encode_getattr_res(struct svc_rqst *rqstp, struct xdr_stream *xdr,
650 const void *resp)
645{ 651{
652 const struct cb_getattrres *res = resp;
646 __be32 *savep = NULL; 653 __be32 *savep = NULL;
647 __be32 status = res->status; 654 __be32 status = res->status;
648 655
@@ -683,8 +690,9 @@ static __be32 encode_sessionid(struct xdr_stream *xdr,
683 690
684static __be32 encode_cb_sequence_res(struct svc_rqst *rqstp, 691static __be32 encode_cb_sequence_res(struct svc_rqst *rqstp,
685 struct xdr_stream *xdr, 692 struct xdr_stream *xdr,
686 const struct cb_sequenceres *res) 693 const void *resp)
687{ 694{
695 const struct cb_sequenceres *res = resp;
688 __be32 *p; 696 __be32 *p;
689 __be32 status = res->csr_status; 697 __be32 status = res->csr_status;
690 698
@@ -871,7 +879,7 @@ encode_hdr:
871/* 879/*
872 * Decode, process and encode a COMPOUND 880 * Decode, process and encode a COMPOUND
873 */ 881 */
874static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *resp) 882static __be32 nfs4_callback_compound(struct svc_rqst *rqstp)
875{ 883{
876 struct cb_compound_hdr_arg hdr_arg = { 0 }; 884 struct cb_compound_hdr_arg hdr_arg = { 0 };
877 struct cb_compound_hdr_res hdr_res = { NULL }; 885 struct cb_compound_hdr_res hdr_res = { NULL };
@@ -907,7 +915,8 @@ static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *r
907 915
908 while (status == 0 && nops != hdr_arg.nops) { 916 while (status == 0 && nops != hdr_arg.nops) {
909 status = process_op(nops, rqstp, &xdr_in, 917 status = process_op(nops, rqstp, &xdr_in,
910 argp, &xdr_out, resp, &cps); 918 rqstp->rq_argp, &xdr_out, rqstp->rq_resp,
919 &cps);
911 nops++; 920 nops++;
912 } 921 }
913 922
@@ -937,48 +946,46 @@ static struct callback_op callback_ops[] = {
937 .res_maxsize = CB_OP_HDR_RES_MAXSZ, 946 .res_maxsize = CB_OP_HDR_RES_MAXSZ,
938 }, 947 },
939 [OP_CB_GETATTR] = { 948 [OP_CB_GETATTR] = {
940 .process_op = (callback_process_op_t)nfs4_callback_getattr, 949 .process_op = nfs4_callback_getattr,
941 .decode_args = (callback_decode_arg_t)decode_getattr_args, 950 .decode_args = decode_getattr_args,
942 .encode_res = (callback_encode_res_t)encode_getattr_res, 951 .encode_res = encode_getattr_res,
943 .res_maxsize = CB_OP_GETATTR_RES_MAXSZ, 952 .res_maxsize = CB_OP_GETATTR_RES_MAXSZ,
944 }, 953 },
945 [OP_CB_RECALL] = { 954 [OP_CB_RECALL] = {
946 .process_op = (callback_process_op_t)nfs4_callback_recall, 955 .process_op = nfs4_callback_recall,
947 .decode_args = (callback_decode_arg_t)decode_recall_args, 956 .decode_args = decode_recall_args,
948 .res_maxsize = CB_OP_RECALL_RES_MAXSZ, 957 .res_maxsize = CB_OP_RECALL_RES_MAXSZ,
949 }, 958 },
950#if defined(CONFIG_NFS_V4_1) 959#if defined(CONFIG_NFS_V4_1)
951 [OP_CB_LAYOUTRECALL] = { 960 [OP_CB_LAYOUTRECALL] = {
952 .process_op = (callback_process_op_t)nfs4_callback_layoutrecall, 961 .process_op = nfs4_callback_layoutrecall,
953 .decode_args = 962 .decode_args = decode_layoutrecall_args,
954 (callback_decode_arg_t)decode_layoutrecall_args,
955 .res_maxsize = CB_OP_LAYOUTRECALL_RES_MAXSZ, 963 .res_maxsize = CB_OP_LAYOUTRECALL_RES_MAXSZ,
956 }, 964 },
957 [OP_CB_NOTIFY_DEVICEID] = { 965 [OP_CB_NOTIFY_DEVICEID] = {
958 .process_op = (callback_process_op_t)nfs4_callback_devicenotify, 966 .process_op = nfs4_callback_devicenotify,
959 .decode_args = 967 .decode_args = decode_devicenotify_args,
960 (callback_decode_arg_t)decode_devicenotify_args,
961 .res_maxsize = CB_OP_DEVICENOTIFY_RES_MAXSZ, 968 .res_maxsize = CB_OP_DEVICENOTIFY_RES_MAXSZ,
962 }, 969 },
963 [OP_CB_SEQUENCE] = { 970 [OP_CB_SEQUENCE] = {
964 .process_op = (callback_process_op_t)nfs4_callback_sequence, 971 .process_op = nfs4_callback_sequence,
965 .decode_args = (callback_decode_arg_t)decode_cb_sequence_args, 972 .decode_args = decode_cb_sequence_args,
966 .encode_res = (callback_encode_res_t)encode_cb_sequence_res, 973 .encode_res = encode_cb_sequence_res,
967 .res_maxsize = CB_OP_SEQUENCE_RES_MAXSZ, 974 .res_maxsize = CB_OP_SEQUENCE_RES_MAXSZ,
968 }, 975 },
969 [OP_CB_RECALL_ANY] = { 976 [OP_CB_RECALL_ANY] = {
970 .process_op = (callback_process_op_t)nfs4_callback_recallany, 977 .process_op = nfs4_callback_recallany,
971 .decode_args = (callback_decode_arg_t)decode_recallany_args, 978 .decode_args = decode_recallany_args,
972 .res_maxsize = CB_OP_RECALLANY_RES_MAXSZ, 979 .res_maxsize = CB_OP_RECALLANY_RES_MAXSZ,
973 }, 980 },
974 [OP_CB_RECALL_SLOT] = { 981 [OP_CB_RECALL_SLOT] = {
975 .process_op = (callback_process_op_t)nfs4_callback_recallslot, 982 .process_op = nfs4_callback_recallslot,
976 .decode_args = (callback_decode_arg_t)decode_recallslot_args, 983 .decode_args = decode_recallslot_args,
977 .res_maxsize = CB_OP_RECALLSLOT_RES_MAXSZ, 984 .res_maxsize = CB_OP_RECALLSLOT_RES_MAXSZ,
978 }, 985 },
979 [OP_CB_NOTIFY_LOCK] = { 986 [OP_CB_NOTIFY_LOCK] = {
980 .process_op = (callback_process_op_t)nfs4_callback_notify_lock, 987 .process_op = nfs4_callback_notify_lock,
981 .decode_args = (callback_decode_arg_t)decode_notify_lock_args, 988 .decode_args = decode_notify_lock_args,
982 .res_maxsize = CB_OP_NOTIFY_LOCK_RES_MAXSZ, 989 .res_maxsize = CB_OP_NOTIFY_LOCK_RES_MAXSZ,
983 }, 990 },
984#endif /* CONFIG_NFS_V4_1 */ 991#endif /* CONFIG_NFS_V4_1 */
@@ -987,36 +994,40 @@ static struct callback_op callback_ops[] = {
987/* 994/*
988 * Define NFS4 callback procedures 995 * Define NFS4 callback procedures
989 */ 996 */
990static struct svc_procedure nfs4_callback_procedures1[] = { 997static const struct svc_procedure nfs4_callback_procedures1[] = {
991 [CB_NULL] = { 998 [CB_NULL] = {
992 .pc_func = nfs4_callback_null, 999 .pc_func = nfs4_callback_null,
993 .pc_decode = (kxdrproc_t)nfs4_decode_void, 1000 .pc_decode = nfs4_decode_void,
994 .pc_encode = (kxdrproc_t)nfs4_encode_void, 1001 .pc_encode = nfs4_encode_void,
995 .pc_xdrressize = 1, 1002 .pc_xdrressize = 1,
996 }, 1003 },
997 [CB_COMPOUND] = { 1004 [CB_COMPOUND] = {
998 .pc_func = nfs4_callback_compound, 1005 .pc_func = nfs4_callback_compound,
999 .pc_encode = (kxdrproc_t)nfs4_encode_void, 1006 .pc_encode = nfs4_encode_void,
1000 .pc_argsize = 256, 1007 .pc_argsize = 256,
1001 .pc_ressize = 256, 1008 .pc_ressize = 256,
1002 .pc_xdrressize = NFS4_CALLBACK_BUFSIZE, 1009 .pc_xdrressize = NFS4_CALLBACK_BUFSIZE,
1003 } 1010 }
1004}; 1011};
1005 1012
1006struct svc_version nfs4_callback_version1 = { 1013static unsigned int nfs4_callback_count1[ARRAY_SIZE(nfs4_callback_procedures1)];
1014const struct svc_version nfs4_callback_version1 = {
1007 .vs_vers = 1, 1015 .vs_vers = 1,
1008 .vs_nproc = ARRAY_SIZE(nfs4_callback_procedures1), 1016 .vs_nproc = ARRAY_SIZE(nfs4_callback_procedures1),
1009 .vs_proc = nfs4_callback_procedures1, 1017 .vs_proc = nfs4_callback_procedures1,
1018 .vs_count = nfs4_callback_count1,
1010 .vs_xdrsize = NFS4_CALLBACK_XDRSIZE, 1019 .vs_xdrsize = NFS4_CALLBACK_XDRSIZE,
1011 .vs_dispatch = NULL, 1020 .vs_dispatch = NULL,
1012 .vs_hidden = true, 1021 .vs_hidden = true,
1013 .vs_need_cong_ctrl = true, 1022 .vs_need_cong_ctrl = true,
1014}; 1023};
1015 1024
1016struct svc_version nfs4_callback_version4 = { 1025static unsigned int nfs4_callback_count4[ARRAY_SIZE(nfs4_callback_procedures1)];
1026const struct svc_version nfs4_callback_version4 = {
1017 .vs_vers = 4, 1027 .vs_vers = 4,
1018 .vs_nproc = ARRAY_SIZE(nfs4_callback_procedures1), 1028 .vs_nproc = ARRAY_SIZE(nfs4_callback_procedures1),
1019 .vs_proc = nfs4_callback_procedures1, 1029 .vs_proc = nfs4_callback_procedures1,
1030 .vs_count = nfs4_callback_count4,
1020 .vs_xdrsize = NFS4_CALLBACK_XDRSIZE, 1031 .vs_xdrsize = NFS4_CALLBACK_XDRSIZE,
1021 .vs_dispatch = NULL, 1032 .vs_dispatch = NULL,
1022 .vs_hidden = true, 1033 .vs_hidden = true,
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index 8701d7617964..c7ebba9eb611 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -226,8 +226,8 @@ static inline void nfs_fs_proc_exit(void)
226#endif 226#endif
227 227
228/* callback_xdr.c */ 228/* callback_xdr.c */
229extern struct svc_version nfs4_callback_version1; 229extern const struct svc_version nfs4_callback_version1;
230extern struct svc_version nfs4_callback_version4; 230extern const struct svc_version nfs4_callback_version4;
231 231
232struct nfs_pageio_descriptor; 232struct nfs_pageio_descriptor;
233/* pagelist.c */ 233/* pagelist.c */
@@ -271,12 +271,12 @@ static inline bool nfs_match_open_context(const struct nfs_open_context *ctx1,
271} 271}
272 272
273/* nfs2xdr.c */ 273/* nfs2xdr.c */
274extern struct rpc_procinfo nfs_procedures[]; 274extern const struct rpc_procinfo nfs_procedures[];
275extern int nfs2_decode_dirent(struct xdr_stream *, 275extern int nfs2_decode_dirent(struct xdr_stream *,
276 struct nfs_entry *, int); 276 struct nfs_entry *, int);
277 277
278/* nfs3xdr.c */ 278/* nfs3xdr.c */
279extern struct rpc_procinfo nfs3_procedures[]; 279extern const struct rpc_procinfo nfs3_procedures[];
280extern int nfs3_decode_dirent(struct xdr_stream *, 280extern int nfs3_decode_dirent(struct xdr_stream *,
281 struct nfs_entry *, int); 281 struct nfs_entry *, int);
282 282
@@ -293,7 +293,7 @@ extern const u32 nfs41_maxgetdevinfo_overhead;
293 293
294/* nfs4proc.c */ 294/* nfs4proc.c */
295#if IS_ENABLED(CONFIG_NFS_V4) 295#if IS_ENABLED(CONFIG_NFS_V4)
296extern struct rpc_procinfo nfs4_procedures[]; 296extern const struct rpc_procinfo nfs4_procedures[];
297#endif 297#endif
298 298
299#ifdef CONFIG_NFS_V4_SECURITY_LABEL 299#ifdef CONFIG_NFS_V4_SECURITY_LABEL
diff --git a/fs/nfs/mount_clnt.c b/fs/nfs/mount_clnt.c
index 09b190015df4..3efe946672be 100644
--- a/fs/nfs/mount_clnt.c
+++ b/fs/nfs/mount_clnt.c
@@ -304,7 +304,7 @@ static void encode_mntdirpath(struct xdr_stream *xdr, const char *pathname)
304} 304}
305 305
306static void mnt_xdr_enc_dirpath(struct rpc_rqst *req, struct xdr_stream *xdr, 306static void mnt_xdr_enc_dirpath(struct rpc_rqst *req, struct xdr_stream *xdr,
307 const char *dirpath) 307 const void *dirpath)
308{ 308{
309 encode_mntdirpath(xdr, dirpath); 309 encode_mntdirpath(xdr, dirpath);
310} 310}
@@ -357,8 +357,9 @@ static int decode_fhandle(struct xdr_stream *xdr, struct mountres *res)
357 357
358static int mnt_xdr_dec_mountres(struct rpc_rqst *req, 358static int mnt_xdr_dec_mountres(struct rpc_rqst *req,
359 struct xdr_stream *xdr, 359 struct xdr_stream *xdr,
360 struct mountres *res) 360 void *data)
361{ 361{
362 struct mountres *res = data;
362 int status; 363 int status;
363 364
364 status = decode_status(xdr, res); 365 status = decode_status(xdr, res);
@@ -449,8 +450,9 @@ static int decode_auth_flavors(struct xdr_stream *xdr, struct mountres *res)
449 450
450static int mnt_xdr_dec_mountres3(struct rpc_rqst *req, 451static int mnt_xdr_dec_mountres3(struct rpc_rqst *req,
451 struct xdr_stream *xdr, 452 struct xdr_stream *xdr,
452 struct mountres *res) 453 void *data)
453{ 454{
455 struct mountres *res = data;
454 int status; 456 int status;
455 457
456 status = decode_fhs_status(xdr, res); 458 status = decode_fhs_status(xdr, res);
@@ -464,11 +466,11 @@ static int mnt_xdr_dec_mountres3(struct rpc_rqst *req,
464 return decode_auth_flavors(xdr, res); 466 return decode_auth_flavors(xdr, res);
465} 467}
466 468
467static struct rpc_procinfo mnt_procedures[] = { 469static const struct rpc_procinfo mnt_procedures[] = {
468 [MOUNTPROC_MNT] = { 470 [MOUNTPROC_MNT] = {
469 .p_proc = MOUNTPROC_MNT, 471 .p_proc = MOUNTPROC_MNT,
470 .p_encode = (kxdreproc_t)mnt_xdr_enc_dirpath, 472 .p_encode = mnt_xdr_enc_dirpath,
471 .p_decode = (kxdrdproc_t)mnt_xdr_dec_mountres, 473 .p_decode = mnt_xdr_dec_mountres,
472 .p_arglen = MNT_enc_dirpath_sz, 474 .p_arglen = MNT_enc_dirpath_sz,
473 .p_replen = MNT_dec_mountres_sz, 475 .p_replen = MNT_dec_mountres_sz,
474 .p_statidx = MOUNTPROC_MNT, 476 .p_statidx = MOUNTPROC_MNT,
@@ -476,18 +478,18 @@ static struct rpc_procinfo mnt_procedures[] = {
476 }, 478 },
477 [MOUNTPROC_UMNT] = { 479 [MOUNTPROC_UMNT] = {
478 .p_proc = MOUNTPROC_UMNT, 480 .p_proc = MOUNTPROC_UMNT,
479 .p_encode = (kxdreproc_t)mnt_xdr_enc_dirpath, 481 .p_encode = mnt_xdr_enc_dirpath,
480 .p_arglen = MNT_enc_dirpath_sz, 482 .p_arglen = MNT_enc_dirpath_sz,
481 .p_statidx = MOUNTPROC_UMNT, 483 .p_statidx = MOUNTPROC_UMNT,
482 .p_name = "UMOUNT", 484 .p_name = "UMOUNT",
483 }, 485 },
484}; 486};
485 487
486static struct rpc_procinfo mnt3_procedures[] = { 488static const struct rpc_procinfo mnt3_procedures[] = {
487 [MOUNTPROC3_MNT] = { 489 [MOUNTPROC3_MNT] = {
488 .p_proc = MOUNTPROC3_MNT, 490 .p_proc = MOUNTPROC3_MNT,
489 .p_encode = (kxdreproc_t)mnt_xdr_enc_dirpath, 491 .p_encode = mnt_xdr_enc_dirpath,
490 .p_decode = (kxdrdproc_t)mnt_xdr_dec_mountres3, 492 .p_decode = mnt_xdr_dec_mountres3,
491 .p_arglen = MNT_enc_dirpath_sz, 493 .p_arglen = MNT_enc_dirpath_sz,
492 .p_replen = MNT_dec_mountres3_sz, 494 .p_replen = MNT_dec_mountres3_sz,
493 .p_statidx = MOUNTPROC3_MNT, 495 .p_statidx = MOUNTPROC3_MNT,
@@ -495,24 +497,27 @@ static struct rpc_procinfo mnt3_procedures[] = {
495 }, 497 },
496 [MOUNTPROC3_UMNT] = { 498 [MOUNTPROC3_UMNT] = {
497 .p_proc = MOUNTPROC3_UMNT, 499 .p_proc = MOUNTPROC3_UMNT,
498 .p_encode = (kxdreproc_t)mnt_xdr_enc_dirpath, 500 .p_encode = mnt_xdr_enc_dirpath,
499 .p_arglen = MNT_enc_dirpath_sz, 501 .p_arglen = MNT_enc_dirpath_sz,
500 .p_statidx = MOUNTPROC3_UMNT, 502 .p_statidx = MOUNTPROC3_UMNT,
501 .p_name = "UMOUNT", 503 .p_name = "UMOUNT",
502 }, 504 },
503}; 505};
504 506
505 507static unsigned int mnt_counts[ARRAY_SIZE(mnt_procedures)];
506static const struct rpc_version mnt_version1 = { 508static const struct rpc_version mnt_version1 = {
507 .number = 1, 509 .number = 1,
508 .nrprocs = ARRAY_SIZE(mnt_procedures), 510 .nrprocs = ARRAY_SIZE(mnt_procedures),
509 .procs = mnt_procedures, 511 .procs = mnt_procedures,
512 .counts = mnt_counts,
510}; 513};
511 514
515static unsigned int mnt3_counts[ARRAY_SIZE(mnt_procedures)];
512static const struct rpc_version mnt_version3 = { 516static const struct rpc_version mnt_version3 = {
513 .number = 3, 517 .number = 3,
514 .nrprocs = ARRAY_SIZE(mnt3_procedures), 518 .nrprocs = ARRAY_SIZE(mnt3_procedures),
515 .procs = mnt3_procedures, 519 .procs = mnt3_procedures,
520 .counts = mnt3_counts,
516}; 521};
517 522
518static const struct rpc_version *mnt_version[] = { 523static const struct rpc_version *mnt_version[] = {
diff --git a/fs/nfs/nfs2xdr.c b/fs/nfs/nfs2xdr.c
index b4e03ed8599d..c8a7e98c1371 100644
--- a/fs/nfs/nfs2xdr.c
+++ b/fs/nfs/nfs2xdr.c
@@ -568,8 +568,10 @@ out_default:
568 568
569static void nfs2_xdr_enc_fhandle(struct rpc_rqst *req, 569static void nfs2_xdr_enc_fhandle(struct rpc_rqst *req,
570 struct xdr_stream *xdr, 570 struct xdr_stream *xdr,
571 const struct nfs_fh *fh) 571 const void *data)
572{ 572{
573 const struct nfs_fh *fh = data;
574
573 encode_fhandle(xdr, fh); 575 encode_fhandle(xdr, fh);
574} 576}
575 577
@@ -583,23 +585,29 @@ static void nfs2_xdr_enc_fhandle(struct rpc_rqst *req,
583 */ 585 */
584static void nfs2_xdr_enc_sattrargs(struct rpc_rqst *req, 586static void nfs2_xdr_enc_sattrargs(struct rpc_rqst *req,
585 struct xdr_stream *xdr, 587 struct xdr_stream *xdr,
586 const struct nfs_sattrargs *args) 588 const void *data)
587{ 589{
590 const struct nfs_sattrargs *args = data;
591
588 encode_fhandle(xdr, args->fh); 592 encode_fhandle(xdr, args->fh);
589 encode_sattr(xdr, args->sattr); 593 encode_sattr(xdr, args->sattr);
590} 594}
591 595
592static void nfs2_xdr_enc_diropargs(struct rpc_rqst *req, 596static void nfs2_xdr_enc_diropargs(struct rpc_rqst *req,
593 struct xdr_stream *xdr, 597 struct xdr_stream *xdr,
594 const struct nfs_diropargs *args) 598 const void *data)
595{ 599{
600 const struct nfs_diropargs *args = data;
601
596 encode_diropargs(xdr, args->fh, args->name, args->len); 602 encode_diropargs(xdr, args->fh, args->name, args->len);
597} 603}
598 604
599static void nfs2_xdr_enc_readlinkargs(struct rpc_rqst *req, 605static void nfs2_xdr_enc_readlinkargs(struct rpc_rqst *req,
600 struct xdr_stream *xdr, 606 struct xdr_stream *xdr,
601 const struct nfs_readlinkargs *args) 607 const void *data)
602{ 608{
609 const struct nfs_readlinkargs *args = data;
610
603 encode_fhandle(xdr, args->fh); 611 encode_fhandle(xdr, args->fh);
604 prepare_reply_buffer(req, args->pages, args->pgbase, 612 prepare_reply_buffer(req, args->pages, args->pgbase,
605 args->pglen, NFS_readlinkres_sz); 613 args->pglen, NFS_readlinkres_sz);
@@ -632,8 +640,10 @@ static void encode_readargs(struct xdr_stream *xdr,
632 640
633static void nfs2_xdr_enc_readargs(struct rpc_rqst *req, 641static void nfs2_xdr_enc_readargs(struct rpc_rqst *req,
634 struct xdr_stream *xdr, 642 struct xdr_stream *xdr,
635 const struct nfs_pgio_args *args) 643 const void *data)
636{ 644{
645 const struct nfs_pgio_args *args = data;
646
637 encode_readargs(xdr, args); 647 encode_readargs(xdr, args);
638 prepare_reply_buffer(req, args->pages, args->pgbase, 648 prepare_reply_buffer(req, args->pages, args->pgbase,
639 args->count, NFS_readres_sz); 649 args->count, NFS_readres_sz);
@@ -672,8 +682,10 @@ static void encode_writeargs(struct xdr_stream *xdr,
672 682
673static void nfs2_xdr_enc_writeargs(struct rpc_rqst *req, 683static void nfs2_xdr_enc_writeargs(struct rpc_rqst *req,
674 struct xdr_stream *xdr, 684 struct xdr_stream *xdr,
675 const struct nfs_pgio_args *args) 685 const void *data)
676{ 686{
687 const struct nfs_pgio_args *args = data;
688
677 encode_writeargs(xdr, args); 689 encode_writeargs(xdr, args);
678 xdr->buf->flags |= XDRBUF_WRITE; 690 xdr->buf->flags |= XDRBUF_WRITE;
679} 691}
@@ -688,16 +700,20 @@ static void nfs2_xdr_enc_writeargs(struct rpc_rqst *req,
688 */ 700 */
689static void nfs2_xdr_enc_createargs(struct rpc_rqst *req, 701static void nfs2_xdr_enc_createargs(struct rpc_rqst *req,
690 struct xdr_stream *xdr, 702 struct xdr_stream *xdr,
691 const struct nfs_createargs *args) 703 const void *data)
692{ 704{
705 const struct nfs_createargs *args = data;
706
693 encode_diropargs(xdr, args->fh, args->name, args->len); 707 encode_diropargs(xdr, args->fh, args->name, args->len);
694 encode_sattr(xdr, args->sattr); 708 encode_sattr(xdr, args->sattr);
695} 709}
696 710
697static void nfs2_xdr_enc_removeargs(struct rpc_rqst *req, 711static void nfs2_xdr_enc_removeargs(struct rpc_rqst *req,
698 struct xdr_stream *xdr, 712 struct xdr_stream *xdr,
699 const struct nfs_removeargs *args) 713 const void *data)
700{ 714{
715 const struct nfs_removeargs *args = data;
716
701 encode_diropargs(xdr, args->fh, args->name.name, args->name.len); 717 encode_diropargs(xdr, args->fh, args->name.name, args->name.len);
702} 718}
703 719
@@ -711,8 +727,9 @@ static void nfs2_xdr_enc_removeargs(struct rpc_rqst *req,
711 */ 727 */
712static void nfs2_xdr_enc_renameargs(struct rpc_rqst *req, 728static void nfs2_xdr_enc_renameargs(struct rpc_rqst *req,
713 struct xdr_stream *xdr, 729 struct xdr_stream *xdr,
714 const struct nfs_renameargs *args) 730 const void *data)
715{ 731{
732 const struct nfs_renameargs *args = data;
716 const struct qstr *old = args->old_name; 733 const struct qstr *old = args->old_name;
717 const struct qstr *new = args->new_name; 734 const struct qstr *new = args->new_name;
718 735
@@ -730,8 +747,10 @@ static void nfs2_xdr_enc_renameargs(struct rpc_rqst *req,
730 */ 747 */
731static void nfs2_xdr_enc_linkargs(struct rpc_rqst *req, 748static void nfs2_xdr_enc_linkargs(struct rpc_rqst *req,
732 struct xdr_stream *xdr, 749 struct xdr_stream *xdr,
733 const struct nfs_linkargs *args) 750 const void *data)
734{ 751{
752 const struct nfs_linkargs *args = data;
753
735 encode_fhandle(xdr, args->fromfh); 754 encode_fhandle(xdr, args->fromfh);
736 encode_diropargs(xdr, args->tofh, args->toname, args->tolen); 755 encode_diropargs(xdr, args->tofh, args->toname, args->tolen);
737} 756}
@@ -747,8 +766,10 @@ static void nfs2_xdr_enc_linkargs(struct rpc_rqst *req,
747 */ 766 */
748static void nfs2_xdr_enc_symlinkargs(struct rpc_rqst *req, 767static void nfs2_xdr_enc_symlinkargs(struct rpc_rqst *req,
749 struct xdr_stream *xdr, 768 struct xdr_stream *xdr,
750 const struct nfs_symlinkargs *args) 769 const void *data)
751{ 770{
771 const struct nfs_symlinkargs *args = data;
772
752 encode_diropargs(xdr, args->fromfh, args->fromname, args->fromlen); 773 encode_diropargs(xdr, args->fromfh, args->fromname, args->fromlen);
753 encode_path(xdr, args->pages, args->pathlen); 774 encode_path(xdr, args->pages, args->pathlen);
754 encode_sattr(xdr, args->sattr); 775 encode_sattr(xdr, args->sattr);
@@ -777,8 +798,10 @@ static void encode_readdirargs(struct xdr_stream *xdr,
777 798
778static void nfs2_xdr_enc_readdirargs(struct rpc_rqst *req, 799static void nfs2_xdr_enc_readdirargs(struct rpc_rqst *req,
779 struct xdr_stream *xdr, 800 struct xdr_stream *xdr,
780 const struct nfs_readdirargs *args) 801 const void *data)
781{ 802{
803 const struct nfs_readdirargs *args = data;
804
782 encode_readdirargs(xdr, args); 805 encode_readdirargs(xdr, args);
783 prepare_reply_buffer(req, args->pages, 0, 806 prepare_reply_buffer(req, args->pages, 0,
784 args->count, NFS_readdirres_sz); 807 args->count, NFS_readdirres_sz);
@@ -809,13 +832,13 @@ out_default:
809} 832}
810 833
811static int nfs2_xdr_dec_attrstat(struct rpc_rqst *req, struct xdr_stream *xdr, 834static int nfs2_xdr_dec_attrstat(struct rpc_rqst *req, struct xdr_stream *xdr,
812 struct nfs_fattr *result) 835 void *result)
813{ 836{
814 return decode_attrstat(xdr, result, NULL); 837 return decode_attrstat(xdr, result, NULL);
815} 838}
816 839
817static int nfs2_xdr_dec_diropres(struct rpc_rqst *req, struct xdr_stream *xdr, 840static int nfs2_xdr_dec_diropres(struct rpc_rqst *req, struct xdr_stream *xdr,
818 struct nfs_diropok *result) 841 void *result)
819{ 842{
820 return decode_diropres(xdr, result); 843 return decode_diropres(xdr, result);
821} 844}
@@ -860,8 +883,9 @@ out_default:
860 * }; 883 * };
861 */ 884 */
862static int nfs2_xdr_dec_readres(struct rpc_rqst *req, struct xdr_stream *xdr, 885static int nfs2_xdr_dec_readres(struct rpc_rqst *req, struct xdr_stream *xdr,
863 struct nfs_pgio_res *result) 886 void *data)
864{ 887{
888 struct nfs_pgio_res *result = data;
865 enum nfs_stat status; 889 enum nfs_stat status;
866 int error; 890 int error;
867 891
@@ -882,8 +906,10 @@ out_default:
882} 906}
883 907
884static int nfs2_xdr_dec_writeres(struct rpc_rqst *req, struct xdr_stream *xdr, 908static int nfs2_xdr_dec_writeres(struct rpc_rqst *req, struct xdr_stream *xdr,
885 struct nfs_pgio_res *result) 909 void *data)
886{ 910{
911 struct nfs_pgio_res *result = data;
912
887 /* All NFSv2 writes are "file sync" writes */ 913 /* All NFSv2 writes are "file sync" writes */
888 result->verf->committed = NFS_FILE_SYNC; 914 result->verf->committed = NFS_FILE_SYNC;
889 return decode_attrstat(xdr, result->fattr, &result->op_status); 915 return decode_attrstat(xdr, result->fattr, &result->op_status);
@@ -1034,7 +1060,7 @@ out_overflow:
1034} 1060}
1035 1061
1036static int nfs2_xdr_dec_statfsres(struct rpc_rqst *req, struct xdr_stream *xdr, 1062static int nfs2_xdr_dec_statfsres(struct rpc_rqst *req, struct xdr_stream *xdr,
1037 struct nfs2_fsstat *result) 1063 void *result)
1038{ 1064{
1039 enum nfs_stat status; 1065 enum nfs_stat status;
1040 int error; 1066 int error;
@@ -1118,15 +1144,15 @@ static int nfs_stat_to_errno(enum nfs_stat status)
1118#define PROC(proc, argtype, restype, timer) \ 1144#define PROC(proc, argtype, restype, timer) \
1119[NFSPROC_##proc] = { \ 1145[NFSPROC_##proc] = { \
1120 .p_proc = NFSPROC_##proc, \ 1146 .p_proc = NFSPROC_##proc, \
1121 .p_encode = (kxdreproc_t)nfs2_xdr_enc_##argtype, \ 1147 .p_encode = nfs2_xdr_enc_##argtype, \
1122 .p_decode = (kxdrdproc_t)nfs2_xdr_dec_##restype, \ 1148 .p_decode = nfs2_xdr_dec_##restype, \
1123 .p_arglen = NFS_##argtype##_sz, \ 1149 .p_arglen = NFS_##argtype##_sz, \
1124 .p_replen = NFS_##restype##_sz, \ 1150 .p_replen = NFS_##restype##_sz, \
1125 .p_timer = timer, \ 1151 .p_timer = timer, \
1126 .p_statidx = NFSPROC_##proc, \ 1152 .p_statidx = NFSPROC_##proc, \
1127 .p_name = #proc, \ 1153 .p_name = #proc, \
1128 } 1154 }
1129struct rpc_procinfo nfs_procedures[] = { 1155const struct rpc_procinfo nfs_procedures[] = {
1130 PROC(GETATTR, fhandle, attrstat, 1), 1156 PROC(GETATTR, fhandle, attrstat, 1),
1131 PROC(SETATTR, sattrargs, attrstat, 0), 1157 PROC(SETATTR, sattrargs, attrstat, 0),
1132 PROC(LOOKUP, diropargs, diropres, 2), 1158 PROC(LOOKUP, diropargs, diropres, 2),
@@ -1144,8 +1170,10 @@ struct rpc_procinfo nfs_procedures[] = {
1144 PROC(STATFS, fhandle, statfsres, 0), 1170 PROC(STATFS, fhandle, statfsres, 0),
1145}; 1171};
1146 1172
1173static unsigned int nfs_version2_counts[ARRAY_SIZE(nfs_procedures)];
1147const struct rpc_version nfs_version2 = { 1174const struct rpc_version nfs_version2 = {
1148 .number = 2, 1175 .number = 2,
1149 .nrprocs = ARRAY_SIZE(nfs_procedures), 1176 .nrprocs = ARRAY_SIZE(nfs_procedures),
1150 .procs = nfs_procedures 1177 .procs = nfs_procedures,
1178 .counts = nfs_version2_counts,
1151}; 1179};
diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c
index 267126d32ec0..670eddb3ae36 100644
--- a/fs/nfs/nfs3xdr.c
+++ b/fs/nfs/nfs3xdr.c
@@ -846,8 +846,10 @@ static void encode_diropargs3(struct xdr_stream *xdr, const struct nfs_fh *fh,
846 */ 846 */
847static void nfs3_xdr_enc_getattr3args(struct rpc_rqst *req, 847static void nfs3_xdr_enc_getattr3args(struct rpc_rqst *req,
848 struct xdr_stream *xdr, 848 struct xdr_stream *xdr,
849 const struct nfs_fh *fh) 849 const void *data)
850{ 850{
851 const struct nfs_fh *fh = data;
852
851 encode_nfs_fh3(xdr, fh); 853 encode_nfs_fh3(xdr, fh);
852} 854}
853 855
@@ -884,8 +886,9 @@ static void encode_sattrguard3(struct xdr_stream *xdr,
884 886
885static void nfs3_xdr_enc_setattr3args(struct rpc_rqst *req, 887static void nfs3_xdr_enc_setattr3args(struct rpc_rqst *req,
886 struct xdr_stream *xdr, 888 struct xdr_stream *xdr,
887 const struct nfs3_sattrargs *args) 889 const void *data)
888{ 890{
891 const struct nfs3_sattrargs *args = data;
889 encode_nfs_fh3(xdr, args->fh); 892 encode_nfs_fh3(xdr, args->fh);
890 encode_sattr3(xdr, args->sattr); 893 encode_sattr3(xdr, args->sattr);
891 encode_sattrguard3(xdr, args); 894 encode_sattrguard3(xdr, args);
@@ -900,8 +903,10 @@ static void nfs3_xdr_enc_setattr3args(struct rpc_rqst *req,
900 */ 903 */
901static void nfs3_xdr_enc_lookup3args(struct rpc_rqst *req, 904static void nfs3_xdr_enc_lookup3args(struct rpc_rqst *req,
902 struct xdr_stream *xdr, 905 struct xdr_stream *xdr,
903 const struct nfs3_diropargs *args) 906 const void *data)
904{ 907{
908 const struct nfs3_diropargs *args = data;
909
905 encode_diropargs3(xdr, args->fh, args->name, args->len); 910 encode_diropargs3(xdr, args->fh, args->name, args->len);
906} 911}
907 912
@@ -922,8 +927,10 @@ static void encode_access3args(struct xdr_stream *xdr,
922 927
923static void nfs3_xdr_enc_access3args(struct rpc_rqst *req, 928static void nfs3_xdr_enc_access3args(struct rpc_rqst *req,
924 struct xdr_stream *xdr, 929 struct xdr_stream *xdr,
925 const struct nfs3_accessargs *args) 930 const void *data)
926{ 931{
932 const struct nfs3_accessargs *args = data;
933
927 encode_access3args(xdr, args); 934 encode_access3args(xdr, args);
928} 935}
929 936
@@ -936,8 +943,10 @@ static void nfs3_xdr_enc_access3args(struct rpc_rqst *req,
936 */ 943 */
937static void nfs3_xdr_enc_readlink3args(struct rpc_rqst *req, 944static void nfs3_xdr_enc_readlink3args(struct rpc_rqst *req,
938 struct xdr_stream *xdr, 945 struct xdr_stream *xdr,
939 const struct nfs3_readlinkargs *args) 946 const void *data)
940{ 947{
948 const struct nfs3_readlinkargs *args = data;
949
941 encode_nfs_fh3(xdr, args->fh); 950 encode_nfs_fh3(xdr, args->fh);
942 prepare_reply_buffer(req, args->pages, args->pgbase, 951 prepare_reply_buffer(req, args->pages, args->pgbase,
943 args->pglen, NFS3_readlinkres_sz); 952 args->pglen, NFS3_readlinkres_sz);
@@ -966,8 +975,10 @@ static void encode_read3args(struct xdr_stream *xdr,
966 975
967static void nfs3_xdr_enc_read3args(struct rpc_rqst *req, 976static void nfs3_xdr_enc_read3args(struct rpc_rqst *req,
968 struct xdr_stream *xdr, 977 struct xdr_stream *xdr,
969 const struct nfs_pgio_args *args) 978 const void *data)
970{ 979{
980 const struct nfs_pgio_args *args = data;
981
971 encode_read3args(xdr, args); 982 encode_read3args(xdr, args);
972 prepare_reply_buffer(req, args->pages, args->pgbase, 983 prepare_reply_buffer(req, args->pages, args->pgbase,
973 args->count, NFS3_readres_sz); 984 args->count, NFS3_readres_sz);
@@ -1008,8 +1019,10 @@ static void encode_write3args(struct xdr_stream *xdr,
1008 1019
1009static void nfs3_xdr_enc_write3args(struct rpc_rqst *req, 1020static void nfs3_xdr_enc_write3args(struct rpc_rqst *req,
1010 struct xdr_stream *xdr, 1021 struct xdr_stream *xdr,
1011 const struct nfs_pgio_args *args) 1022 const void *data)
1012{ 1023{
1024 const struct nfs_pgio_args *args = data;
1025
1013 encode_write3args(xdr, args); 1026 encode_write3args(xdr, args);
1014 xdr->buf->flags |= XDRBUF_WRITE; 1027 xdr->buf->flags |= XDRBUF_WRITE;
1015} 1028}
@@ -1055,8 +1068,10 @@ static void encode_createhow3(struct xdr_stream *xdr,
1055 1068
1056static void nfs3_xdr_enc_create3args(struct rpc_rqst *req, 1069static void nfs3_xdr_enc_create3args(struct rpc_rqst *req,
1057 struct xdr_stream *xdr, 1070 struct xdr_stream *xdr,
1058 const struct nfs3_createargs *args) 1071 const void *data)
1059{ 1072{
1073 const struct nfs3_createargs *args = data;
1074
1060 encode_diropargs3(xdr, args->fh, args->name, args->len); 1075 encode_diropargs3(xdr, args->fh, args->name, args->len);
1061 encode_createhow3(xdr, args); 1076 encode_createhow3(xdr, args);
1062} 1077}
@@ -1071,8 +1086,10 @@ static void nfs3_xdr_enc_create3args(struct rpc_rqst *req,
1071 */ 1086 */
1072static void nfs3_xdr_enc_mkdir3args(struct rpc_rqst *req, 1087static void nfs3_xdr_enc_mkdir3args(struct rpc_rqst *req,
1073 struct xdr_stream *xdr, 1088 struct xdr_stream *xdr,
1074 const struct nfs3_mkdirargs *args) 1089 const void *data)
1075{ 1090{
1091 const struct nfs3_mkdirargs *args = data;
1092
1076 encode_diropargs3(xdr, args->fh, args->name, args->len); 1093 encode_diropargs3(xdr, args->fh, args->name, args->len);
1077 encode_sattr3(xdr, args->sattr); 1094 encode_sattr3(xdr, args->sattr);
1078} 1095}
@@ -1091,16 +1108,20 @@ static void nfs3_xdr_enc_mkdir3args(struct rpc_rqst *req,
1091 * }; 1108 * };
1092 */ 1109 */
1093static void encode_symlinkdata3(struct xdr_stream *xdr, 1110static void encode_symlinkdata3(struct xdr_stream *xdr,
1094 const struct nfs3_symlinkargs *args) 1111 const void *data)
1095{ 1112{
1113 const struct nfs3_symlinkargs *args = data;
1114
1096 encode_sattr3(xdr, args->sattr); 1115 encode_sattr3(xdr, args->sattr);
1097 encode_nfspath3(xdr, args->pages, args->pathlen); 1116 encode_nfspath3(xdr, args->pages, args->pathlen);
1098} 1117}
1099 1118
1100static void nfs3_xdr_enc_symlink3args(struct rpc_rqst *req, 1119static void nfs3_xdr_enc_symlink3args(struct rpc_rqst *req,
1101 struct xdr_stream *xdr, 1120 struct xdr_stream *xdr,
1102 const struct nfs3_symlinkargs *args) 1121 const void *data)
1103{ 1122{
1123 const struct nfs3_symlinkargs *args = data;
1124
1104 encode_diropargs3(xdr, args->fromfh, args->fromname, args->fromlen); 1125 encode_diropargs3(xdr, args->fromfh, args->fromname, args->fromlen);
1105 encode_symlinkdata3(xdr, args); 1126 encode_symlinkdata3(xdr, args);
1106 xdr->buf->flags |= XDRBUF_WRITE; 1127 xdr->buf->flags |= XDRBUF_WRITE;
@@ -1160,8 +1181,10 @@ static void encode_mknoddata3(struct xdr_stream *xdr,
1160 1181
1161static void nfs3_xdr_enc_mknod3args(struct rpc_rqst *req, 1182static void nfs3_xdr_enc_mknod3args(struct rpc_rqst *req,
1162 struct xdr_stream *xdr, 1183 struct xdr_stream *xdr,
1163 const struct nfs3_mknodargs *args) 1184 const void *data)
1164{ 1185{
1186 const struct nfs3_mknodargs *args = data;
1187
1165 encode_diropargs3(xdr, args->fh, args->name, args->len); 1188 encode_diropargs3(xdr, args->fh, args->name, args->len);
1166 encode_mknoddata3(xdr, args); 1189 encode_mknoddata3(xdr, args);
1167} 1190}
@@ -1175,8 +1198,10 @@ static void nfs3_xdr_enc_mknod3args(struct rpc_rqst *req,
1175 */ 1198 */
1176static void nfs3_xdr_enc_remove3args(struct rpc_rqst *req, 1199static void nfs3_xdr_enc_remove3args(struct rpc_rqst *req,
1177 struct xdr_stream *xdr, 1200 struct xdr_stream *xdr,
1178 const struct nfs_removeargs *args) 1201 const void *data)
1179{ 1202{
1203 const struct nfs_removeargs *args = data;
1204
1180 encode_diropargs3(xdr, args->fh, args->name.name, args->name.len); 1205 encode_diropargs3(xdr, args->fh, args->name.name, args->name.len);
1181} 1206}
1182 1207
@@ -1190,8 +1215,9 @@ static void nfs3_xdr_enc_remove3args(struct rpc_rqst *req,
1190 */ 1215 */
1191static void nfs3_xdr_enc_rename3args(struct rpc_rqst *req, 1216static void nfs3_xdr_enc_rename3args(struct rpc_rqst *req,
1192 struct xdr_stream *xdr, 1217 struct xdr_stream *xdr,
1193 const struct nfs_renameargs *args) 1218 const void *data)
1194{ 1219{
1220 const struct nfs_renameargs *args = data;
1195 const struct qstr *old = args->old_name; 1221 const struct qstr *old = args->old_name;
1196 const struct qstr *new = args->new_name; 1222 const struct qstr *new = args->new_name;
1197 1223
@@ -1209,8 +1235,10 @@ static void nfs3_xdr_enc_rename3args(struct rpc_rqst *req,
1209 */ 1235 */
1210static void nfs3_xdr_enc_link3args(struct rpc_rqst *req, 1236static void nfs3_xdr_enc_link3args(struct rpc_rqst *req,
1211 struct xdr_stream *xdr, 1237 struct xdr_stream *xdr,
1212 const struct nfs3_linkargs *args) 1238 const void *data)
1213{ 1239{
1240 const struct nfs3_linkargs *args = data;
1241
1214 encode_nfs_fh3(xdr, args->fromfh); 1242 encode_nfs_fh3(xdr, args->fromfh);
1215 encode_diropargs3(xdr, args->tofh, args->toname, args->tolen); 1243 encode_diropargs3(xdr, args->tofh, args->toname, args->tolen);
1216} 1244}
@@ -1240,8 +1268,10 @@ static void encode_readdir3args(struct xdr_stream *xdr,
1240 1268
1241static void nfs3_xdr_enc_readdir3args(struct rpc_rqst *req, 1269static void nfs3_xdr_enc_readdir3args(struct rpc_rqst *req,
1242 struct xdr_stream *xdr, 1270 struct xdr_stream *xdr,
1243 const struct nfs3_readdirargs *args) 1271 const void *data)
1244{ 1272{
1273 const struct nfs3_readdirargs *args = data;
1274
1245 encode_readdir3args(xdr, args); 1275 encode_readdir3args(xdr, args);
1246 prepare_reply_buffer(req, args->pages, 0, 1276 prepare_reply_buffer(req, args->pages, 0,
1247 args->count, NFS3_readdirres_sz); 1277 args->count, NFS3_readdirres_sz);
@@ -1280,8 +1310,10 @@ static void encode_readdirplus3args(struct xdr_stream *xdr,
1280 1310
1281static void nfs3_xdr_enc_readdirplus3args(struct rpc_rqst *req, 1311static void nfs3_xdr_enc_readdirplus3args(struct rpc_rqst *req,
1282 struct xdr_stream *xdr, 1312 struct xdr_stream *xdr,
1283 const struct nfs3_readdirargs *args) 1313 const void *data)
1284{ 1314{
1315 const struct nfs3_readdirargs *args = data;
1316
1285 encode_readdirplus3args(xdr, args); 1317 encode_readdirplus3args(xdr, args);
1286 prepare_reply_buffer(req, args->pages, 0, 1318 prepare_reply_buffer(req, args->pages, 0,
1287 args->count, NFS3_readdirres_sz); 1319 args->count, NFS3_readdirres_sz);
@@ -1310,8 +1342,10 @@ static void encode_commit3args(struct xdr_stream *xdr,
1310 1342
1311static void nfs3_xdr_enc_commit3args(struct rpc_rqst *req, 1343static void nfs3_xdr_enc_commit3args(struct rpc_rqst *req,
1312 struct xdr_stream *xdr, 1344 struct xdr_stream *xdr,
1313 const struct nfs_commitargs *args) 1345 const void *data)
1314{ 1346{
1347 const struct nfs_commitargs *args = data;
1348
1315 encode_commit3args(xdr, args); 1349 encode_commit3args(xdr, args);
1316} 1350}
1317 1351
@@ -1319,8 +1353,10 @@ static void nfs3_xdr_enc_commit3args(struct rpc_rqst *req,
1319 1353
1320static void nfs3_xdr_enc_getacl3args(struct rpc_rqst *req, 1354static void nfs3_xdr_enc_getacl3args(struct rpc_rqst *req,
1321 struct xdr_stream *xdr, 1355 struct xdr_stream *xdr,
1322 const struct nfs3_getaclargs *args) 1356 const void *data)
1323{ 1357{
1358 const struct nfs3_getaclargs *args = data;
1359
1324 encode_nfs_fh3(xdr, args->fh); 1360 encode_nfs_fh3(xdr, args->fh);
1325 encode_uint32(xdr, args->mask); 1361 encode_uint32(xdr, args->mask);
1326 if (args->mask & (NFS_ACL | NFS_DFACL)) 1362 if (args->mask & (NFS_ACL | NFS_DFACL))
@@ -1331,8 +1367,9 @@ static void nfs3_xdr_enc_getacl3args(struct rpc_rqst *req,
1331 1367
1332static void nfs3_xdr_enc_setacl3args(struct rpc_rqst *req, 1368static void nfs3_xdr_enc_setacl3args(struct rpc_rqst *req,
1333 struct xdr_stream *xdr, 1369 struct xdr_stream *xdr,
1334 const struct nfs3_setaclargs *args) 1370 const void *data)
1335{ 1371{
1372 const struct nfs3_setaclargs *args = data;
1336 unsigned int base; 1373 unsigned int base;
1337 int error; 1374 int error;
1338 1375
@@ -1382,7 +1419,7 @@ static void nfs3_xdr_enc_setacl3args(struct rpc_rqst *req,
1382 */ 1419 */
1383static int nfs3_xdr_dec_getattr3res(struct rpc_rqst *req, 1420static int nfs3_xdr_dec_getattr3res(struct rpc_rqst *req,
1384 struct xdr_stream *xdr, 1421 struct xdr_stream *xdr,
1385 struct nfs_fattr *result) 1422 void *result)
1386{ 1423{
1387 enum nfs_stat status; 1424 enum nfs_stat status;
1388 int error; 1425 int error;
@@ -1419,7 +1456,7 @@ out_default:
1419 */ 1456 */
1420static int nfs3_xdr_dec_setattr3res(struct rpc_rqst *req, 1457static int nfs3_xdr_dec_setattr3res(struct rpc_rqst *req,
1421 struct xdr_stream *xdr, 1458 struct xdr_stream *xdr,
1422 struct nfs_fattr *result) 1459 void *result)
1423{ 1460{
1424 enum nfs_stat status; 1461 enum nfs_stat status;
1425 int error; 1462 int error;
@@ -1460,8 +1497,9 @@ out_status:
1460 */ 1497 */
1461static int nfs3_xdr_dec_lookup3res(struct rpc_rqst *req, 1498static int nfs3_xdr_dec_lookup3res(struct rpc_rqst *req,
1462 struct xdr_stream *xdr, 1499 struct xdr_stream *xdr,
1463 struct nfs3_diropres *result) 1500 void *data)
1464{ 1501{
1502 struct nfs3_diropres *result = data;
1465 enum nfs_stat status; 1503 enum nfs_stat status;
1466 int error; 1504 int error;
1467 1505
@@ -1507,8 +1545,9 @@ out_default:
1507 */ 1545 */
1508static int nfs3_xdr_dec_access3res(struct rpc_rqst *req, 1546static int nfs3_xdr_dec_access3res(struct rpc_rqst *req,
1509 struct xdr_stream *xdr, 1547 struct xdr_stream *xdr,
1510 struct nfs3_accessres *result) 1548 void *data)
1511{ 1549{
1550 struct nfs3_accessres *result = data;
1512 enum nfs_stat status; 1551 enum nfs_stat status;
1513 int error; 1552 int error;
1514 1553
@@ -1548,7 +1587,7 @@ out_default:
1548 */ 1587 */
1549static int nfs3_xdr_dec_readlink3res(struct rpc_rqst *req, 1588static int nfs3_xdr_dec_readlink3res(struct rpc_rqst *req,
1550 struct xdr_stream *xdr, 1589 struct xdr_stream *xdr,
1551 struct nfs_fattr *result) 1590 void *result)
1552{ 1591{
1553 enum nfs_stat status; 1592 enum nfs_stat status;
1554 int error; 1593 int error;
@@ -1626,8 +1665,9 @@ out_overflow:
1626} 1665}
1627 1666
1628static int nfs3_xdr_dec_read3res(struct rpc_rqst *req, struct xdr_stream *xdr, 1667static int nfs3_xdr_dec_read3res(struct rpc_rqst *req, struct xdr_stream *xdr,
1629 struct nfs_pgio_res *result) 1668 void *data)
1630{ 1669{
1670 struct nfs_pgio_res *result = data;
1631 enum nfs_stat status; 1671 enum nfs_stat status;
1632 int error; 1672 int error;
1633 1673
@@ -1699,8 +1739,9 @@ out_eio:
1699} 1739}
1700 1740
1701static int nfs3_xdr_dec_write3res(struct rpc_rqst *req, struct xdr_stream *xdr, 1741static int nfs3_xdr_dec_write3res(struct rpc_rqst *req, struct xdr_stream *xdr,
1702 struct nfs_pgio_res *result) 1742 void *data)
1703{ 1743{
1744 struct nfs_pgio_res *result = data;
1704 enum nfs_stat status; 1745 enum nfs_stat status;
1705 int error; 1746 int error;
1706 1747
@@ -1764,8 +1805,9 @@ out:
1764 1805
1765static int nfs3_xdr_dec_create3res(struct rpc_rqst *req, 1806static int nfs3_xdr_dec_create3res(struct rpc_rqst *req,
1766 struct xdr_stream *xdr, 1807 struct xdr_stream *xdr,
1767 struct nfs3_diropres *result) 1808 void *data)
1768{ 1809{
1810 struct nfs3_diropres *result = data;
1769 enum nfs_stat status; 1811 enum nfs_stat status;
1770 int error; 1812 int error;
1771 1813
@@ -1804,8 +1846,9 @@ out_default:
1804 */ 1846 */
1805static int nfs3_xdr_dec_remove3res(struct rpc_rqst *req, 1847static int nfs3_xdr_dec_remove3res(struct rpc_rqst *req,
1806 struct xdr_stream *xdr, 1848 struct xdr_stream *xdr,
1807 struct nfs_removeres *result) 1849 void *data)
1808{ 1850{
1851 struct nfs_removeres *result = data;
1809 enum nfs_stat status; 1852 enum nfs_stat status;
1810 int error; 1853 int error;
1811 1854
@@ -1845,8 +1888,9 @@ out_status:
1845 */ 1888 */
1846static int nfs3_xdr_dec_rename3res(struct rpc_rqst *req, 1889static int nfs3_xdr_dec_rename3res(struct rpc_rqst *req,
1847 struct xdr_stream *xdr, 1890 struct xdr_stream *xdr,
1848 struct nfs_renameres *result) 1891 void *data)
1849{ 1892{
1893 struct nfs_renameres *result = data;
1850 enum nfs_stat status; 1894 enum nfs_stat status;
1851 int error; 1895 int error;
1852 1896
@@ -1888,8 +1932,9 @@ out_status:
1888 * }; 1932 * };
1889 */ 1933 */
1890static int nfs3_xdr_dec_link3res(struct rpc_rqst *req, struct xdr_stream *xdr, 1934static int nfs3_xdr_dec_link3res(struct rpc_rqst *req, struct xdr_stream *xdr,
1891 struct nfs3_linkres *result) 1935 void *data)
1892{ 1936{
1937 struct nfs3_linkres *result = data;
1893 enum nfs_stat status; 1938 enum nfs_stat status;
1894 int error; 1939 int error;
1895 1940
@@ -2072,8 +2117,9 @@ out:
2072 2117
2073static int nfs3_xdr_dec_readdir3res(struct rpc_rqst *req, 2118static int nfs3_xdr_dec_readdir3res(struct rpc_rqst *req,
2074 struct xdr_stream *xdr, 2119 struct xdr_stream *xdr,
2075 struct nfs3_readdirres *result) 2120 void *data)
2076{ 2121{
2122 struct nfs3_readdirres *result = data;
2077 enum nfs_stat status; 2123 enum nfs_stat status;
2078 int error; 2124 int error;
2079 2125
@@ -2140,8 +2186,9 @@ out_overflow:
2140 2186
2141static int nfs3_xdr_dec_fsstat3res(struct rpc_rqst *req, 2187static int nfs3_xdr_dec_fsstat3res(struct rpc_rqst *req,
2142 struct xdr_stream *xdr, 2188 struct xdr_stream *xdr,
2143 struct nfs_fsstat *result) 2189 void *data)
2144{ 2190{
2191 struct nfs_fsstat *result = data;
2145 enum nfs_stat status; 2192 enum nfs_stat status;
2146 int error; 2193 int error;
2147 2194
@@ -2216,8 +2263,9 @@ out_overflow:
2216 2263
2217static int nfs3_xdr_dec_fsinfo3res(struct rpc_rqst *req, 2264static int nfs3_xdr_dec_fsinfo3res(struct rpc_rqst *req,
2218 struct xdr_stream *xdr, 2265 struct xdr_stream *xdr,
2219 struct nfs_fsinfo *result) 2266 void *data)
2220{ 2267{
2268 struct nfs_fsinfo *result = data;
2221 enum nfs_stat status; 2269 enum nfs_stat status;
2222 int error; 2270 int error;
2223 2271
@@ -2279,8 +2327,9 @@ out_overflow:
2279 2327
2280static int nfs3_xdr_dec_pathconf3res(struct rpc_rqst *req, 2328static int nfs3_xdr_dec_pathconf3res(struct rpc_rqst *req,
2281 struct xdr_stream *xdr, 2329 struct xdr_stream *xdr,
2282 struct nfs_pathconf *result) 2330 void *data)
2283{ 2331{
2332 struct nfs_pathconf *result = data;
2284 enum nfs_stat status; 2333 enum nfs_stat status;
2285 int error; 2334 int error;
2286 2335
@@ -2320,8 +2369,9 @@ out_status:
2320 */ 2369 */
2321static int nfs3_xdr_dec_commit3res(struct rpc_rqst *req, 2370static int nfs3_xdr_dec_commit3res(struct rpc_rqst *req,
2322 struct xdr_stream *xdr, 2371 struct xdr_stream *xdr,
2323 struct nfs_commitres *result) 2372 void *data)
2324{ 2373{
2374 struct nfs_commitres *result = data;
2325 enum nfs_stat status; 2375 enum nfs_stat status;
2326 int error; 2376 int error;
2327 2377
@@ -2389,7 +2439,7 @@ out:
2389 2439
2390static int nfs3_xdr_dec_getacl3res(struct rpc_rqst *req, 2440static int nfs3_xdr_dec_getacl3res(struct rpc_rqst *req,
2391 struct xdr_stream *xdr, 2441 struct xdr_stream *xdr,
2392 struct nfs3_getaclres *result) 2442 void *result)
2393{ 2443{
2394 enum nfs_stat status; 2444 enum nfs_stat status;
2395 int error; 2445 int error;
@@ -2408,7 +2458,7 @@ out_default:
2408 2458
2409static int nfs3_xdr_dec_setacl3res(struct rpc_rqst *req, 2459static int nfs3_xdr_dec_setacl3res(struct rpc_rqst *req,
2410 struct xdr_stream *xdr, 2460 struct xdr_stream *xdr,
2411 struct nfs_fattr *result) 2461 void *result)
2412{ 2462{
2413 enum nfs_stat status; 2463 enum nfs_stat status;
2414 int error; 2464 int error;
@@ -2495,8 +2545,8 @@ static int nfs3_stat_to_errno(enum nfs_stat status)
2495#define PROC(proc, argtype, restype, timer) \ 2545#define PROC(proc, argtype, restype, timer) \
2496[NFS3PROC_##proc] = { \ 2546[NFS3PROC_##proc] = { \
2497 .p_proc = NFS3PROC_##proc, \ 2547 .p_proc = NFS3PROC_##proc, \
2498 .p_encode = (kxdreproc_t)nfs3_xdr_enc_##argtype##3args, \ 2548 .p_encode = nfs3_xdr_enc_##argtype##3args, \
2499 .p_decode = (kxdrdproc_t)nfs3_xdr_dec_##restype##3res, \ 2549 .p_decode = nfs3_xdr_dec_##restype##3res, \
2500 .p_arglen = NFS3_##argtype##args_sz, \ 2550 .p_arglen = NFS3_##argtype##args_sz, \
2501 .p_replen = NFS3_##restype##res_sz, \ 2551 .p_replen = NFS3_##restype##res_sz, \
2502 .p_timer = timer, \ 2552 .p_timer = timer, \
@@ -2504,7 +2554,7 @@ static int nfs3_stat_to_errno(enum nfs_stat status)
2504 .p_name = #proc, \ 2554 .p_name = #proc, \
2505 } 2555 }
2506 2556
2507struct rpc_procinfo nfs3_procedures[] = { 2557const struct rpc_procinfo nfs3_procedures[] = {
2508 PROC(GETATTR, getattr, getattr, 1), 2558 PROC(GETATTR, getattr, getattr, 1),
2509 PROC(SETATTR, setattr, setattr, 0), 2559 PROC(SETATTR, setattr, setattr, 0),
2510 PROC(LOOKUP, lookup, lookup, 2), 2560 PROC(LOOKUP, lookup, lookup, 2),
@@ -2528,18 +2578,20 @@ struct rpc_procinfo nfs3_procedures[] = {
2528 PROC(COMMIT, commit, commit, 5), 2578 PROC(COMMIT, commit, commit, 5),
2529}; 2579};
2530 2580
2581static unsigned int nfs_version3_counts[ARRAY_SIZE(nfs3_procedures)];
2531const struct rpc_version nfs_version3 = { 2582const struct rpc_version nfs_version3 = {
2532 .number = 3, 2583 .number = 3,
2533 .nrprocs = ARRAY_SIZE(nfs3_procedures), 2584 .nrprocs = ARRAY_SIZE(nfs3_procedures),
2534 .procs = nfs3_procedures 2585 .procs = nfs3_procedures,
2586 .counts = nfs_version3_counts,
2535}; 2587};
2536 2588
2537#ifdef CONFIG_NFS_V3_ACL 2589#ifdef CONFIG_NFS_V3_ACL
2538static struct rpc_procinfo nfs3_acl_procedures[] = { 2590static const struct rpc_procinfo nfs3_acl_procedures[] = {
2539 [ACLPROC3_GETACL] = { 2591 [ACLPROC3_GETACL] = {
2540 .p_proc = ACLPROC3_GETACL, 2592 .p_proc = ACLPROC3_GETACL,
2541 .p_encode = (kxdreproc_t)nfs3_xdr_enc_getacl3args, 2593 .p_encode = nfs3_xdr_enc_getacl3args,
2542 .p_decode = (kxdrdproc_t)nfs3_xdr_dec_getacl3res, 2594 .p_decode = nfs3_xdr_dec_getacl3res,
2543 .p_arglen = ACL3_getaclargs_sz, 2595 .p_arglen = ACL3_getaclargs_sz,
2544 .p_replen = ACL3_getaclres_sz, 2596 .p_replen = ACL3_getaclres_sz,
2545 .p_timer = 1, 2597 .p_timer = 1,
@@ -2547,8 +2599,8 @@ static struct rpc_procinfo nfs3_acl_procedures[] = {
2547 }, 2599 },
2548 [ACLPROC3_SETACL] = { 2600 [ACLPROC3_SETACL] = {
2549 .p_proc = ACLPROC3_SETACL, 2601 .p_proc = ACLPROC3_SETACL,
2550 .p_encode = (kxdreproc_t)nfs3_xdr_enc_setacl3args, 2602 .p_encode = nfs3_xdr_enc_setacl3args,
2551 .p_decode = (kxdrdproc_t)nfs3_xdr_dec_setacl3res, 2603 .p_decode = nfs3_xdr_dec_setacl3res,
2552 .p_arglen = ACL3_setaclargs_sz, 2604 .p_arglen = ACL3_setaclargs_sz,
2553 .p_replen = ACL3_setaclres_sz, 2605 .p_replen = ACL3_setaclres_sz,
2554 .p_timer = 0, 2606 .p_timer = 0,
@@ -2556,10 +2608,11 @@ static struct rpc_procinfo nfs3_acl_procedures[] = {
2556 }, 2608 },
2557}; 2609};
2558 2610
2611static unsigned int nfs3_acl_counts[ARRAY_SIZE(nfs3_acl_procedures)];
2559const struct rpc_version nfsacl_version3 = { 2612const struct rpc_version nfsacl_version3 = {
2560 .number = 3, 2613 .number = 3,
2561 .nrprocs = sizeof(nfs3_acl_procedures)/ 2614 .nrprocs = ARRAY_SIZE(nfs3_acl_procedures),
2562 sizeof(nfs3_acl_procedures[0]),
2563 .procs = nfs3_acl_procedures, 2615 .procs = nfs3_acl_procedures,
2616 .counts = nfs3_acl_counts,
2564}; 2617};
2565#endif /* CONFIG_NFS_V3_ACL */ 2618#endif /* CONFIG_NFS_V3_ACL */
diff --git a/fs/nfs/nfs42xdr.c b/fs/nfs/nfs42xdr.c
index 528362f69cc1..5ee1b0f0d904 100644
--- a/fs/nfs/nfs42xdr.c
+++ b/fs/nfs/nfs42xdr.c
@@ -112,7 +112,7 @@
112 decode_getattr_maxsz) 112 decode_getattr_maxsz)
113 113
114static void encode_fallocate(struct xdr_stream *xdr, 114static void encode_fallocate(struct xdr_stream *xdr,
115 struct nfs42_falloc_args *args) 115 const struct nfs42_falloc_args *args)
116{ 116{
117 encode_nfs4_stateid(xdr, &args->falloc_stateid); 117 encode_nfs4_stateid(xdr, &args->falloc_stateid);
118 encode_uint64(xdr, args->falloc_offset); 118 encode_uint64(xdr, args->falloc_offset);
@@ -120,7 +120,7 @@ static void encode_fallocate(struct xdr_stream *xdr,
120} 120}
121 121
122static void encode_allocate(struct xdr_stream *xdr, 122static void encode_allocate(struct xdr_stream *xdr,
123 struct nfs42_falloc_args *args, 123 const struct nfs42_falloc_args *args,
124 struct compound_hdr *hdr) 124 struct compound_hdr *hdr)
125{ 125{
126 encode_op_hdr(xdr, OP_ALLOCATE, decode_allocate_maxsz, hdr); 126 encode_op_hdr(xdr, OP_ALLOCATE, decode_allocate_maxsz, hdr);
@@ -128,7 +128,7 @@ static void encode_allocate(struct xdr_stream *xdr,
128} 128}
129 129
130static void encode_copy(struct xdr_stream *xdr, 130static void encode_copy(struct xdr_stream *xdr,
131 struct nfs42_copy_args *args, 131 const struct nfs42_copy_args *args,
132 struct compound_hdr *hdr) 132 struct compound_hdr *hdr)
133{ 133{
134 encode_op_hdr(xdr, OP_COPY, decode_copy_maxsz, hdr); 134 encode_op_hdr(xdr, OP_COPY, decode_copy_maxsz, hdr);
@@ -145,7 +145,7 @@ static void encode_copy(struct xdr_stream *xdr,
145} 145}
146 146
147static void encode_deallocate(struct xdr_stream *xdr, 147static void encode_deallocate(struct xdr_stream *xdr,
148 struct nfs42_falloc_args *args, 148 const struct nfs42_falloc_args *args,
149 struct compound_hdr *hdr) 149 struct compound_hdr *hdr)
150{ 150{
151 encode_op_hdr(xdr, OP_DEALLOCATE, decode_deallocate_maxsz, hdr); 151 encode_op_hdr(xdr, OP_DEALLOCATE, decode_deallocate_maxsz, hdr);
@@ -153,7 +153,7 @@ static void encode_deallocate(struct xdr_stream *xdr,
153} 153}
154 154
155static void encode_seek(struct xdr_stream *xdr, 155static void encode_seek(struct xdr_stream *xdr,
156 struct nfs42_seek_args *args, 156 const struct nfs42_seek_args *args,
157 struct compound_hdr *hdr) 157 struct compound_hdr *hdr)
158{ 158{
159 encode_op_hdr(xdr, OP_SEEK, decode_seek_maxsz, hdr); 159 encode_op_hdr(xdr, OP_SEEK, decode_seek_maxsz, hdr);
@@ -163,7 +163,7 @@ static void encode_seek(struct xdr_stream *xdr,
163} 163}
164 164
165static void encode_layoutstats(struct xdr_stream *xdr, 165static void encode_layoutstats(struct xdr_stream *xdr,
166 struct nfs42_layoutstat_args *args, 166 const struct nfs42_layoutstat_args *args,
167 struct nfs42_layoutstat_devinfo *devinfo, 167 struct nfs42_layoutstat_devinfo *devinfo,
168 struct compound_hdr *hdr) 168 struct compound_hdr *hdr)
169{ 169{
@@ -191,7 +191,7 @@ static void encode_layoutstats(struct xdr_stream *xdr,
191} 191}
192 192
193static void encode_clone(struct xdr_stream *xdr, 193static void encode_clone(struct xdr_stream *xdr,
194 struct nfs42_clone_args *args, 194 const struct nfs42_clone_args *args,
195 struct compound_hdr *hdr) 195 struct compound_hdr *hdr)
196{ 196{
197 __be32 *p; 197 __be32 *p;
@@ -210,8 +210,9 @@ static void encode_clone(struct xdr_stream *xdr,
210 */ 210 */
211static void nfs4_xdr_enc_allocate(struct rpc_rqst *req, 211static void nfs4_xdr_enc_allocate(struct rpc_rqst *req,
212 struct xdr_stream *xdr, 212 struct xdr_stream *xdr,
213 struct nfs42_falloc_args *args) 213 const void *data)
214{ 214{
215 const struct nfs42_falloc_args *args = data;
215 struct compound_hdr hdr = { 216 struct compound_hdr hdr = {
216 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 217 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
217 }; 218 };
@@ -225,7 +226,7 @@ static void nfs4_xdr_enc_allocate(struct rpc_rqst *req,
225} 226}
226 227
227static void encode_copy_commit(struct xdr_stream *xdr, 228static void encode_copy_commit(struct xdr_stream *xdr,
228 struct nfs42_copy_args *args, 229 const struct nfs42_copy_args *args,
229 struct compound_hdr *hdr) 230 struct compound_hdr *hdr)
230{ 231{
231 __be32 *p; 232 __be32 *p;
@@ -241,8 +242,9 @@ static void encode_copy_commit(struct xdr_stream *xdr,
241 */ 242 */
242static void nfs4_xdr_enc_copy(struct rpc_rqst *req, 243static void nfs4_xdr_enc_copy(struct rpc_rqst *req,
243 struct xdr_stream *xdr, 244 struct xdr_stream *xdr,
244 struct nfs42_copy_args *args) 245 const void *data)
245{ 246{
247 const struct nfs42_copy_args *args = data;
246 struct compound_hdr hdr = { 248 struct compound_hdr hdr = {
247 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 249 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
248 }; 250 };
@@ -262,8 +264,9 @@ static void nfs4_xdr_enc_copy(struct rpc_rqst *req,
262 */ 264 */
263static void nfs4_xdr_enc_deallocate(struct rpc_rqst *req, 265static void nfs4_xdr_enc_deallocate(struct rpc_rqst *req,
264 struct xdr_stream *xdr, 266 struct xdr_stream *xdr,
265 struct nfs42_falloc_args *args) 267 const void *data)
266{ 268{
269 const struct nfs42_falloc_args *args = data;
267 struct compound_hdr hdr = { 270 struct compound_hdr hdr = {
268 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 271 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
269 }; 272 };
@@ -281,8 +284,9 @@ static void nfs4_xdr_enc_deallocate(struct rpc_rqst *req,
281 */ 284 */
282static void nfs4_xdr_enc_seek(struct rpc_rqst *req, 285static void nfs4_xdr_enc_seek(struct rpc_rqst *req,
283 struct xdr_stream *xdr, 286 struct xdr_stream *xdr,
284 struct nfs42_seek_args *args) 287 const void *data)
285{ 288{
289 const struct nfs42_seek_args *args = data;
286 struct compound_hdr hdr = { 290 struct compound_hdr hdr = {
287 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 291 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
288 }; 292 };
@@ -299,8 +303,9 @@ static void nfs4_xdr_enc_seek(struct rpc_rqst *req,
299 */ 303 */
300static void nfs4_xdr_enc_layoutstats(struct rpc_rqst *req, 304static void nfs4_xdr_enc_layoutstats(struct rpc_rqst *req,
301 struct xdr_stream *xdr, 305 struct xdr_stream *xdr,
302 struct nfs42_layoutstat_args *args) 306 const void *data)
303{ 307{
308 const struct nfs42_layoutstat_args *args = data;
304 int i; 309 int i;
305 310
306 struct compound_hdr hdr = { 311 struct compound_hdr hdr = {
@@ -321,8 +326,9 @@ static void nfs4_xdr_enc_layoutstats(struct rpc_rqst *req,
321 */ 326 */
322static void nfs4_xdr_enc_clone(struct rpc_rqst *req, 327static void nfs4_xdr_enc_clone(struct rpc_rqst *req,
323 struct xdr_stream *xdr, 328 struct xdr_stream *xdr,
324 struct nfs42_clone_args *args) 329 const void *data)
325{ 330{
331 const struct nfs42_clone_args *args = data;
326 struct compound_hdr hdr = { 332 struct compound_hdr hdr = {
327 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 333 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
328 }; 334 };
@@ -448,8 +454,9 @@ static int decode_clone(struct xdr_stream *xdr)
448 */ 454 */
449static int nfs4_xdr_dec_allocate(struct rpc_rqst *rqstp, 455static int nfs4_xdr_dec_allocate(struct rpc_rqst *rqstp,
450 struct xdr_stream *xdr, 456 struct xdr_stream *xdr,
451 struct nfs42_falloc_res *res) 457 void *data)
452{ 458{
459 struct nfs42_falloc_res *res = data;
453 struct compound_hdr hdr; 460 struct compound_hdr hdr;
454 int status; 461 int status;
455 462
@@ -475,8 +482,9 @@ out:
475 */ 482 */
476static int nfs4_xdr_dec_copy(struct rpc_rqst *rqstp, 483static int nfs4_xdr_dec_copy(struct rpc_rqst *rqstp,
477 struct xdr_stream *xdr, 484 struct xdr_stream *xdr,
478 struct nfs42_copy_res *res) 485 void *data)
479{ 486{
487 struct nfs42_copy_res *res = data;
480 struct compound_hdr hdr; 488 struct compound_hdr hdr;
481 int status; 489 int status;
482 490
@@ -508,8 +516,9 @@ out:
508 */ 516 */
509static int nfs4_xdr_dec_deallocate(struct rpc_rqst *rqstp, 517static int nfs4_xdr_dec_deallocate(struct rpc_rqst *rqstp,
510 struct xdr_stream *xdr, 518 struct xdr_stream *xdr,
511 struct nfs42_falloc_res *res) 519 void *data)
512{ 520{
521 struct nfs42_falloc_res *res = data;
513 struct compound_hdr hdr; 522 struct compound_hdr hdr;
514 int status; 523 int status;
515 524
@@ -535,8 +544,9 @@ out:
535 */ 544 */
536static int nfs4_xdr_dec_seek(struct rpc_rqst *rqstp, 545static int nfs4_xdr_dec_seek(struct rpc_rqst *rqstp,
537 struct xdr_stream *xdr, 546 struct xdr_stream *xdr,
538 struct nfs42_seek_res *res) 547 void *data)
539{ 548{
549 struct nfs42_seek_res *res = data;
540 struct compound_hdr hdr; 550 struct compound_hdr hdr;
541 int status; 551 int status;
542 552
@@ -559,8 +569,9 @@ out:
559 */ 569 */
560static int nfs4_xdr_dec_layoutstats(struct rpc_rqst *rqstp, 570static int nfs4_xdr_dec_layoutstats(struct rpc_rqst *rqstp,
561 struct xdr_stream *xdr, 571 struct xdr_stream *xdr,
562 struct nfs42_layoutstat_res *res) 572 void *data)
563{ 573{
574 struct nfs42_layoutstat_res *res = data;
564 struct compound_hdr hdr; 575 struct compound_hdr hdr;
565 int status, i; 576 int status, i;
566 577
@@ -589,8 +600,9 @@ out:
589 */ 600 */
590static int nfs4_xdr_dec_clone(struct rpc_rqst *rqstp, 601static int nfs4_xdr_dec_clone(struct rpc_rqst *rqstp,
591 struct xdr_stream *xdr, 602 struct xdr_stream *xdr,
592 struct nfs42_clone_res *res) 603 void *data)
593{ 604{
605 struct nfs42_clone_res *res = data;
594 struct compound_hdr hdr; 606 struct compound_hdr hdr;
595 int status; 607 int status;
596 608
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index af285cc27ccf..40bd05f05e74 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -493,13 +493,13 @@ static inline void nfs4_unregister_sysctl(void)
493#endif 493#endif
494 494
495/* nfs4xdr.c */ 495/* nfs4xdr.c */
496extern struct rpc_procinfo nfs4_procedures[]; 496extern const struct rpc_procinfo nfs4_procedures[];
497 497
498struct nfs4_mount_data; 498struct nfs4_mount_data;
499 499
500/* callback_xdr.c */ 500/* callback_xdr.c */
501extern struct svc_version nfs4_callback_version1; 501extern const struct svc_version nfs4_callback_version1;
502extern struct svc_version nfs4_callback_version4; 502extern const struct svc_version nfs4_callback_version4;
503 503
504static inline void nfs4_stateid_copy(nfs4_stateid *dst, const nfs4_stateid *src) 504static inline void nfs4_stateid_copy(nfs4_stateid *dst, const nfs4_stateid *src)
505{ 505{
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 3aebfdc82b30..0f1f290c97cd 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -1651,7 +1651,8 @@ encode_restorefh(struct xdr_stream *xdr, struct compound_hdr *hdr)
1651} 1651}
1652 1652
1653static void 1653static void
1654encode_setacl(struct xdr_stream *xdr, struct nfs_setaclargs *arg, struct compound_hdr *hdr) 1654encode_setacl(struct xdr_stream *xdr, const struct nfs_setaclargs *arg,
1655 struct compound_hdr *hdr)
1655{ 1656{
1656 __be32 *p; 1657 __be32 *p;
1657 1658
@@ -1735,7 +1736,7 @@ static void encode_secinfo(struct xdr_stream *xdr, const struct qstr *name, stru
1735#if defined(CONFIG_NFS_V4_1) 1736#if defined(CONFIG_NFS_V4_1)
1736/* NFSv4.1 operations */ 1737/* NFSv4.1 operations */
1737static void encode_bind_conn_to_session(struct xdr_stream *xdr, 1738static void encode_bind_conn_to_session(struct xdr_stream *xdr,
1738 struct nfs41_bind_conn_to_session_args *args, 1739 const struct nfs41_bind_conn_to_session_args *args,
1739 struct compound_hdr *hdr) 1740 struct compound_hdr *hdr)
1740{ 1741{
1741 __be32 *p; 1742 __be32 *p;
@@ -1748,7 +1749,7 @@ static void encode_bind_conn_to_session(struct xdr_stream *xdr,
1748 *p = (args->use_conn_in_rdma_mode) ? cpu_to_be32(1) : cpu_to_be32(0); 1749 *p = (args->use_conn_in_rdma_mode) ? cpu_to_be32(1) : cpu_to_be32(0);
1749} 1750}
1750 1751
1751static void encode_op_map(struct xdr_stream *xdr, struct nfs4_op_map *op_map) 1752static void encode_op_map(struct xdr_stream *xdr, const struct nfs4_op_map *op_map)
1752{ 1753{
1753 unsigned int i; 1754 unsigned int i;
1754 encode_uint32(xdr, NFS4_OP_MAP_NUM_WORDS); 1755 encode_uint32(xdr, NFS4_OP_MAP_NUM_WORDS);
@@ -1757,7 +1758,7 @@ static void encode_op_map(struct xdr_stream *xdr, struct nfs4_op_map *op_map)
1757} 1758}
1758 1759
1759static void encode_exchange_id(struct xdr_stream *xdr, 1760static void encode_exchange_id(struct xdr_stream *xdr,
1760 struct nfs41_exchange_id_args *args, 1761 const struct nfs41_exchange_id_args *args,
1761 struct compound_hdr *hdr) 1762 struct compound_hdr *hdr)
1762{ 1763{
1763 __be32 *p; 1764 __be32 *p;
@@ -1809,7 +1810,7 @@ static void encode_exchange_id(struct xdr_stream *xdr,
1809} 1810}
1810 1811
1811static void encode_create_session(struct xdr_stream *xdr, 1812static void encode_create_session(struct xdr_stream *xdr,
1812 struct nfs41_create_session_args *args, 1813 const struct nfs41_create_session_args *args,
1813 struct compound_hdr *hdr) 1814 struct compound_hdr *hdr)
1814{ 1815{
1815 __be32 *p; 1816 __be32 *p;
@@ -1862,7 +1863,7 @@ static void encode_create_session(struct xdr_stream *xdr,
1862} 1863}
1863 1864
1864static void encode_destroy_session(struct xdr_stream *xdr, 1865static void encode_destroy_session(struct xdr_stream *xdr,
1865 struct nfs4_session *session, 1866 const struct nfs4_session *session,
1866 struct compound_hdr *hdr) 1867 struct compound_hdr *hdr)
1867{ 1868{
1868 encode_op_hdr(xdr, OP_DESTROY_SESSION, decode_destroy_session_maxsz, hdr); 1869 encode_op_hdr(xdr, OP_DESTROY_SESSION, decode_destroy_session_maxsz, hdr);
@@ -1878,7 +1879,7 @@ static void encode_destroy_clientid(struct xdr_stream *xdr,
1878} 1879}
1879 1880
1880static void encode_reclaim_complete(struct xdr_stream *xdr, 1881static void encode_reclaim_complete(struct xdr_stream *xdr,
1881 struct nfs41_reclaim_complete_args *args, 1882 const struct nfs41_reclaim_complete_args *args,
1882 struct compound_hdr *hdr) 1883 struct compound_hdr *hdr)
1883{ 1884{
1884 encode_op_hdr(xdr, OP_RECLAIM_COMPLETE, decode_reclaim_complete_maxsz, hdr); 1885 encode_op_hdr(xdr, OP_RECLAIM_COMPLETE, decode_reclaim_complete_maxsz, hdr);
@@ -1974,7 +1975,7 @@ encode_layoutget(struct xdr_stream *xdr,
1974static int 1975static int
1975encode_layoutcommit(struct xdr_stream *xdr, 1976encode_layoutcommit(struct xdr_stream *xdr,
1976 struct inode *inode, 1977 struct inode *inode,
1977 struct nfs4_layoutcommit_args *args, 1978 const struct nfs4_layoutcommit_args *args,
1978 struct compound_hdr *hdr) 1979 struct compound_hdr *hdr)
1979{ 1980{
1980 __be32 *p; 1981 __be32 *p;
@@ -2044,7 +2045,7 @@ encode_secinfo_no_name(struct xdr_stream *xdr,
2044} 2045}
2045 2046
2046static void encode_test_stateid(struct xdr_stream *xdr, 2047static void encode_test_stateid(struct xdr_stream *xdr,
2047 struct nfs41_test_stateid_args *args, 2048 const struct nfs41_test_stateid_args *args,
2048 struct compound_hdr *hdr) 2049 struct compound_hdr *hdr)
2049{ 2050{
2050 encode_op_hdr(xdr, OP_TEST_STATEID, decode_test_stateid_maxsz, hdr); 2051 encode_op_hdr(xdr, OP_TEST_STATEID, decode_test_stateid_maxsz, hdr);
@@ -2053,7 +2054,7 @@ static void encode_test_stateid(struct xdr_stream *xdr,
2053} 2054}
2054 2055
2055static void encode_free_stateid(struct xdr_stream *xdr, 2056static void encode_free_stateid(struct xdr_stream *xdr,
2056 struct nfs41_free_stateid_args *args, 2057 const struct nfs41_free_stateid_args *args,
2057 struct compound_hdr *hdr) 2058 struct compound_hdr *hdr)
2058{ 2059{
2059 encode_op_hdr(xdr, OP_FREE_STATEID, decode_free_stateid_maxsz, hdr); 2060 encode_op_hdr(xdr, OP_FREE_STATEID, decode_free_stateid_maxsz, hdr);
@@ -2086,8 +2087,9 @@ static u32 nfs4_xdr_minorversion(const struct nfs4_sequence_args *args)
2086 * Encode an ACCESS request 2087 * Encode an ACCESS request
2087 */ 2088 */
2088static void nfs4_xdr_enc_access(struct rpc_rqst *req, struct xdr_stream *xdr, 2089static void nfs4_xdr_enc_access(struct rpc_rqst *req, struct xdr_stream *xdr,
2089 const struct nfs4_accessargs *args) 2090 const void *data)
2090{ 2091{
2092 const struct nfs4_accessargs *args = data;
2091 struct compound_hdr hdr = { 2093 struct compound_hdr hdr = {
2092 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 2094 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
2093 }; 2095 };
@@ -2104,8 +2106,9 @@ static void nfs4_xdr_enc_access(struct rpc_rqst *req, struct xdr_stream *xdr,
2104 * Encode LOOKUP request 2106 * Encode LOOKUP request
2105 */ 2107 */
2106static void nfs4_xdr_enc_lookup(struct rpc_rqst *req, struct xdr_stream *xdr, 2108static void nfs4_xdr_enc_lookup(struct rpc_rqst *req, struct xdr_stream *xdr,
2107 const struct nfs4_lookup_arg *args) 2109 const void *data)
2108{ 2110{
2111 const struct nfs4_lookup_arg *args = data;
2109 struct compound_hdr hdr = { 2112 struct compound_hdr hdr = {
2110 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 2113 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
2111 }; 2114 };
@@ -2124,8 +2127,9 @@ static void nfs4_xdr_enc_lookup(struct rpc_rqst *req, struct xdr_stream *xdr,
2124 */ 2127 */
2125static void nfs4_xdr_enc_lookup_root(struct rpc_rqst *req, 2128static void nfs4_xdr_enc_lookup_root(struct rpc_rqst *req,
2126 struct xdr_stream *xdr, 2129 struct xdr_stream *xdr,
2127 const struct nfs4_lookup_root_arg *args) 2130 const void *data)
2128{ 2131{
2132 const struct nfs4_lookup_root_arg *args = data;
2129 struct compound_hdr hdr = { 2133 struct compound_hdr hdr = {
2130 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 2134 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
2131 }; 2135 };
@@ -2142,8 +2146,9 @@ static void nfs4_xdr_enc_lookup_root(struct rpc_rqst *req,
2142 * Encode REMOVE request 2146 * Encode REMOVE request
2143 */ 2147 */
2144static void nfs4_xdr_enc_remove(struct rpc_rqst *req, struct xdr_stream *xdr, 2148static void nfs4_xdr_enc_remove(struct rpc_rqst *req, struct xdr_stream *xdr,
2145 const struct nfs_removeargs *args) 2149 const void *data)
2146{ 2150{
2151 const struct nfs_removeargs *args = data;
2147 struct compound_hdr hdr = { 2152 struct compound_hdr hdr = {
2148 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 2153 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
2149 }; 2154 };
@@ -2159,8 +2164,9 @@ static void nfs4_xdr_enc_remove(struct rpc_rqst *req, struct xdr_stream *xdr,
2159 * Encode RENAME request 2164 * Encode RENAME request
2160 */ 2165 */
2161static void nfs4_xdr_enc_rename(struct rpc_rqst *req, struct xdr_stream *xdr, 2166static void nfs4_xdr_enc_rename(struct rpc_rqst *req, struct xdr_stream *xdr,
2162 const struct nfs_renameargs *args) 2167 const void *data)
2163{ 2168{
2169 const struct nfs_renameargs *args = data;
2164 struct compound_hdr hdr = { 2170 struct compound_hdr hdr = {
2165 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 2171 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
2166 }; 2172 };
@@ -2178,8 +2184,9 @@ static void nfs4_xdr_enc_rename(struct rpc_rqst *req, struct xdr_stream *xdr,
2178 * Encode LINK request 2184 * Encode LINK request
2179 */ 2185 */
2180static void nfs4_xdr_enc_link(struct rpc_rqst *req, struct xdr_stream *xdr, 2186static void nfs4_xdr_enc_link(struct rpc_rqst *req, struct xdr_stream *xdr,
2181 const struct nfs4_link_arg *args) 2187 const void *data)
2182{ 2188{
2189 const struct nfs4_link_arg *args = data;
2183 struct compound_hdr hdr = { 2190 struct compound_hdr hdr = {
2184 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 2191 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
2185 }; 2192 };
@@ -2199,8 +2206,9 @@ static void nfs4_xdr_enc_link(struct rpc_rqst *req, struct xdr_stream *xdr,
2199 * Encode CREATE request 2206 * Encode CREATE request
2200 */ 2207 */
2201static void nfs4_xdr_enc_create(struct rpc_rqst *req, struct xdr_stream *xdr, 2208static void nfs4_xdr_enc_create(struct rpc_rqst *req, struct xdr_stream *xdr,
2202 const struct nfs4_create_arg *args) 2209 const void *data)
2203{ 2210{
2211 const struct nfs4_create_arg *args = data;
2204 struct compound_hdr hdr = { 2212 struct compound_hdr hdr = {
2205 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 2213 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
2206 }; 2214 };
@@ -2218,8 +2226,10 @@ static void nfs4_xdr_enc_create(struct rpc_rqst *req, struct xdr_stream *xdr,
2218 * Encode SYMLINK request 2226 * Encode SYMLINK request
2219 */ 2227 */
2220static void nfs4_xdr_enc_symlink(struct rpc_rqst *req, struct xdr_stream *xdr, 2228static void nfs4_xdr_enc_symlink(struct rpc_rqst *req, struct xdr_stream *xdr,
2221 const struct nfs4_create_arg *args) 2229 const void *data)
2222{ 2230{
2231 const struct nfs4_create_arg *args = data;
2232
2223 nfs4_xdr_enc_create(req, xdr, args); 2233 nfs4_xdr_enc_create(req, xdr, args);
2224} 2234}
2225 2235
@@ -2227,8 +2237,9 @@ static void nfs4_xdr_enc_symlink(struct rpc_rqst *req, struct xdr_stream *xdr,
2227 * Encode GETATTR request 2237 * Encode GETATTR request
2228 */ 2238 */
2229static void nfs4_xdr_enc_getattr(struct rpc_rqst *req, struct xdr_stream *xdr, 2239static void nfs4_xdr_enc_getattr(struct rpc_rqst *req, struct xdr_stream *xdr,
2230 const struct nfs4_getattr_arg *args) 2240 const void *data)
2231{ 2241{
2242 const struct nfs4_getattr_arg *args = data;
2232 struct compound_hdr hdr = { 2243 struct compound_hdr hdr = {
2233 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 2244 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
2234 }; 2245 };
@@ -2244,8 +2255,9 @@ static void nfs4_xdr_enc_getattr(struct rpc_rqst *req, struct xdr_stream *xdr,
2244 * Encode a CLOSE request 2255 * Encode a CLOSE request
2245 */ 2256 */
2246static void nfs4_xdr_enc_close(struct rpc_rqst *req, struct xdr_stream *xdr, 2257static void nfs4_xdr_enc_close(struct rpc_rqst *req, struct xdr_stream *xdr,
2247 struct nfs_closeargs *args) 2258 const void *data)
2248{ 2259{
2260 const struct nfs_closeargs *args = data;
2249 struct compound_hdr hdr = { 2261 struct compound_hdr hdr = {
2250 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 2262 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
2251 }; 2263 };
@@ -2265,8 +2277,9 @@ static void nfs4_xdr_enc_close(struct rpc_rqst *req, struct xdr_stream *xdr,
2265 * Encode an OPEN request 2277 * Encode an OPEN request
2266 */ 2278 */
2267static void nfs4_xdr_enc_open(struct rpc_rqst *req, struct xdr_stream *xdr, 2279static void nfs4_xdr_enc_open(struct rpc_rqst *req, struct xdr_stream *xdr,
2268 struct nfs_openargs *args) 2280 const void *data)
2269{ 2281{
2282 const struct nfs_openargs *args = data;
2270 struct compound_hdr hdr = { 2283 struct compound_hdr hdr = {
2271 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 2284 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
2272 }; 2285 };
@@ -2287,8 +2300,9 @@ static void nfs4_xdr_enc_open(struct rpc_rqst *req, struct xdr_stream *xdr,
2287 */ 2300 */
2288static void nfs4_xdr_enc_open_confirm(struct rpc_rqst *req, 2301static void nfs4_xdr_enc_open_confirm(struct rpc_rqst *req,
2289 struct xdr_stream *xdr, 2302 struct xdr_stream *xdr,
2290 struct nfs_open_confirmargs *args) 2303 const void *data)
2291{ 2304{
2305 const struct nfs_open_confirmargs *args = data;
2292 struct compound_hdr hdr = { 2306 struct compound_hdr hdr = {
2293 .nops = 0, 2307 .nops = 0,
2294 }; 2308 };
@@ -2304,8 +2318,9 @@ static void nfs4_xdr_enc_open_confirm(struct rpc_rqst *req,
2304 */ 2318 */
2305static void nfs4_xdr_enc_open_noattr(struct rpc_rqst *req, 2319static void nfs4_xdr_enc_open_noattr(struct rpc_rqst *req,
2306 struct xdr_stream *xdr, 2320 struct xdr_stream *xdr,
2307 struct nfs_openargs *args) 2321 const void *data)
2308{ 2322{
2323 const struct nfs_openargs *args = data;
2309 struct compound_hdr hdr = { 2324 struct compound_hdr hdr = {
2310 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 2325 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
2311 }; 2326 };
@@ -2325,8 +2340,9 @@ static void nfs4_xdr_enc_open_noattr(struct rpc_rqst *req,
2325 */ 2340 */
2326static void nfs4_xdr_enc_open_downgrade(struct rpc_rqst *req, 2341static void nfs4_xdr_enc_open_downgrade(struct rpc_rqst *req,
2327 struct xdr_stream *xdr, 2342 struct xdr_stream *xdr,
2328 struct nfs_closeargs *args) 2343 const void *data)
2329{ 2344{
2345 const struct nfs_closeargs *args = data;
2330 struct compound_hdr hdr = { 2346 struct compound_hdr hdr = {
2331 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 2347 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
2332 }; 2348 };
@@ -2344,8 +2360,9 @@ static void nfs4_xdr_enc_open_downgrade(struct rpc_rqst *req,
2344 * Encode a LOCK request 2360 * Encode a LOCK request
2345 */ 2361 */
2346static void nfs4_xdr_enc_lock(struct rpc_rqst *req, struct xdr_stream *xdr, 2362static void nfs4_xdr_enc_lock(struct rpc_rqst *req, struct xdr_stream *xdr,
2347 struct nfs_lock_args *args) 2363 const void *data)
2348{ 2364{
2365 const struct nfs_lock_args *args = data;
2349 struct compound_hdr hdr = { 2366 struct compound_hdr hdr = {
2350 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 2367 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
2351 }; 2368 };
@@ -2361,8 +2378,9 @@ static void nfs4_xdr_enc_lock(struct rpc_rqst *req, struct xdr_stream *xdr,
2361 * Encode a LOCKT request 2378 * Encode a LOCKT request
2362 */ 2379 */
2363static void nfs4_xdr_enc_lockt(struct rpc_rqst *req, struct xdr_stream *xdr, 2380static void nfs4_xdr_enc_lockt(struct rpc_rqst *req, struct xdr_stream *xdr,
2364 struct nfs_lockt_args *args) 2381 const void *data)
2365{ 2382{
2383 const struct nfs_lockt_args *args = data;
2366 struct compound_hdr hdr = { 2384 struct compound_hdr hdr = {
2367 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 2385 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
2368 }; 2386 };
@@ -2378,8 +2396,9 @@ static void nfs4_xdr_enc_lockt(struct rpc_rqst *req, struct xdr_stream *xdr,
2378 * Encode a LOCKU request 2396 * Encode a LOCKU request
2379 */ 2397 */
2380static void nfs4_xdr_enc_locku(struct rpc_rqst *req, struct xdr_stream *xdr, 2398static void nfs4_xdr_enc_locku(struct rpc_rqst *req, struct xdr_stream *xdr,
2381 struct nfs_locku_args *args) 2399 const void *data)
2382{ 2400{
2401 const struct nfs_locku_args *args = data;
2383 struct compound_hdr hdr = { 2402 struct compound_hdr hdr = {
2384 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 2403 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
2385 }; 2404 };
@@ -2393,8 +2412,9 @@ static void nfs4_xdr_enc_locku(struct rpc_rqst *req, struct xdr_stream *xdr,
2393 2412
2394static void nfs4_xdr_enc_release_lockowner(struct rpc_rqst *req, 2413static void nfs4_xdr_enc_release_lockowner(struct rpc_rqst *req,
2395 struct xdr_stream *xdr, 2414 struct xdr_stream *xdr,
2396 struct nfs_release_lockowner_args *args) 2415 const void *data)
2397{ 2416{
2417 const struct nfs_release_lockowner_args *args = data;
2398 struct compound_hdr hdr = { 2418 struct compound_hdr hdr = {
2399 .minorversion = 0, 2419 .minorversion = 0,
2400 }; 2420 };
@@ -2408,8 +2428,9 @@ static void nfs4_xdr_enc_release_lockowner(struct rpc_rqst *req,
2408 * Encode a READLINK request 2428 * Encode a READLINK request
2409 */ 2429 */
2410static void nfs4_xdr_enc_readlink(struct rpc_rqst *req, struct xdr_stream *xdr, 2430static void nfs4_xdr_enc_readlink(struct rpc_rqst *req, struct xdr_stream *xdr,
2411 const struct nfs4_readlink *args) 2431 const void *data)
2412{ 2432{
2433 const struct nfs4_readlink *args = data;
2413 struct compound_hdr hdr = { 2434 struct compound_hdr hdr = {
2414 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 2435 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
2415 }; 2436 };
@@ -2428,8 +2449,9 @@ static void nfs4_xdr_enc_readlink(struct rpc_rqst *req, struct xdr_stream *xdr,
2428 * Encode a READDIR request 2449 * Encode a READDIR request
2429 */ 2450 */
2430static void nfs4_xdr_enc_readdir(struct rpc_rqst *req, struct xdr_stream *xdr, 2451static void nfs4_xdr_enc_readdir(struct rpc_rqst *req, struct xdr_stream *xdr,
2431 const struct nfs4_readdir_arg *args) 2452 const void *data)
2432{ 2453{
2454 const struct nfs4_readdir_arg *args = data;
2433 struct compound_hdr hdr = { 2455 struct compound_hdr hdr = {
2434 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 2456 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
2435 }; 2457 };
@@ -2451,8 +2473,9 @@ static void nfs4_xdr_enc_readdir(struct rpc_rqst *req, struct xdr_stream *xdr,
2451 * Encode a READ request 2473 * Encode a READ request
2452 */ 2474 */
2453static void nfs4_xdr_enc_read(struct rpc_rqst *req, struct xdr_stream *xdr, 2475static void nfs4_xdr_enc_read(struct rpc_rqst *req, struct xdr_stream *xdr,
2454 struct nfs_pgio_args *args) 2476 const void *data)
2455{ 2477{
2478 const struct nfs_pgio_args *args = data;
2456 struct compound_hdr hdr = { 2479 struct compound_hdr hdr = {
2457 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 2480 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
2458 }; 2481 };
@@ -2472,8 +2495,9 @@ static void nfs4_xdr_enc_read(struct rpc_rqst *req, struct xdr_stream *xdr,
2472 * Encode an SETATTR request 2495 * Encode an SETATTR request
2473 */ 2496 */
2474static void nfs4_xdr_enc_setattr(struct rpc_rqst *req, struct xdr_stream *xdr, 2497static void nfs4_xdr_enc_setattr(struct rpc_rqst *req, struct xdr_stream *xdr,
2475 struct nfs_setattrargs *args) 2498 const void *data)
2476{ 2499{
2500 const struct nfs_setattrargs *args = data;
2477 struct compound_hdr hdr = { 2501 struct compound_hdr hdr = {
2478 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 2502 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
2479 }; 2503 };
@@ -2490,8 +2514,9 @@ static void nfs4_xdr_enc_setattr(struct rpc_rqst *req, struct xdr_stream *xdr,
2490 * Encode a GETACL request 2514 * Encode a GETACL request
2491 */ 2515 */
2492static void nfs4_xdr_enc_getacl(struct rpc_rqst *req, struct xdr_stream *xdr, 2516static void nfs4_xdr_enc_getacl(struct rpc_rqst *req, struct xdr_stream *xdr,
2493 struct nfs_getaclargs *args) 2517 const void *data)
2494{ 2518{
2519 const struct nfs_getaclargs *args = data;
2495 struct compound_hdr hdr = { 2520 struct compound_hdr hdr = {
2496 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 2521 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
2497 }; 2522 };
@@ -2513,8 +2538,9 @@ static void nfs4_xdr_enc_getacl(struct rpc_rqst *req, struct xdr_stream *xdr,
2513 * Encode a WRITE request 2538 * Encode a WRITE request
2514 */ 2539 */
2515static void nfs4_xdr_enc_write(struct rpc_rqst *req, struct xdr_stream *xdr, 2540static void nfs4_xdr_enc_write(struct rpc_rqst *req, struct xdr_stream *xdr,
2516 struct nfs_pgio_args *args) 2541 const void *data)
2517{ 2542{
2543 const struct nfs_pgio_args *args = data;
2518 struct compound_hdr hdr = { 2544 struct compound_hdr hdr = {
2519 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 2545 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
2520 }; 2546 };
@@ -2533,8 +2559,9 @@ static void nfs4_xdr_enc_write(struct rpc_rqst *req, struct xdr_stream *xdr,
2533 * a COMMIT request 2559 * a COMMIT request
2534 */ 2560 */
2535static void nfs4_xdr_enc_commit(struct rpc_rqst *req, struct xdr_stream *xdr, 2561static void nfs4_xdr_enc_commit(struct rpc_rqst *req, struct xdr_stream *xdr,
2536 struct nfs_commitargs *args) 2562 const void *data)
2537{ 2563{
2564 const struct nfs_commitargs *args = data;
2538 struct compound_hdr hdr = { 2565 struct compound_hdr hdr = {
2539 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 2566 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
2540 }; 2567 };
@@ -2550,8 +2577,9 @@ static void nfs4_xdr_enc_commit(struct rpc_rqst *req, struct xdr_stream *xdr,
2550 * FSINFO request 2577 * FSINFO request
2551 */ 2578 */
2552static void nfs4_xdr_enc_fsinfo(struct rpc_rqst *req, struct xdr_stream *xdr, 2579static void nfs4_xdr_enc_fsinfo(struct rpc_rqst *req, struct xdr_stream *xdr,
2553 struct nfs4_fsinfo_arg *args) 2580 const void *data)
2554{ 2581{
2582 const struct nfs4_fsinfo_arg *args = data;
2555 struct compound_hdr hdr = { 2583 struct compound_hdr hdr = {
2556 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 2584 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
2557 }; 2585 };
@@ -2567,8 +2595,9 @@ static void nfs4_xdr_enc_fsinfo(struct rpc_rqst *req, struct xdr_stream *xdr,
2567 * a PATHCONF request 2595 * a PATHCONF request
2568 */ 2596 */
2569static void nfs4_xdr_enc_pathconf(struct rpc_rqst *req, struct xdr_stream *xdr, 2597static void nfs4_xdr_enc_pathconf(struct rpc_rqst *req, struct xdr_stream *xdr,
2570 const struct nfs4_pathconf_arg *args) 2598 const void *data)
2571{ 2599{
2600 const struct nfs4_pathconf_arg *args = data;
2572 struct compound_hdr hdr = { 2601 struct compound_hdr hdr = {
2573 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 2602 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
2574 }; 2603 };
@@ -2585,8 +2614,9 @@ static void nfs4_xdr_enc_pathconf(struct rpc_rqst *req, struct xdr_stream *xdr,
2585 * a STATFS request 2614 * a STATFS request
2586 */ 2615 */
2587static void nfs4_xdr_enc_statfs(struct rpc_rqst *req, struct xdr_stream *xdr, 2616static void nfs4_xdr_enc_statfs(struct rpc_rqst *req, struct xdr_stream *xdr,
2588 const struct nfs4_statfs_arg *args) 2617 const void *data)
2589{ 2618{
2619 const struct nfs4_statfs_arg *args = data;
2590 struct compound_hdr hdr = { 2620 struct compound_hdr hdr = {
2591 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 2621 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
2592 }; 2622 };
@@ -2604,8 +2634,9 @@ static void nfs4_xdr_enc_statfs(struct rpc_rqst *req, struct xdr_stream *xdr,
2604 */ 2634 */
2605static void nfs4_xdr_enc_server_caps(struct rpc_rqst *req, 2635static void nfs4_xdr_enc_server_caps(struct rpc_rqst *req,
2606 struct xdr_stream *xdr, 2636 struct xdr_stream *xdr,
2607 struct nfs4_server_caps_arg *args) 2637 const void *data)
2608{ 2638{
2639 const struct nfs4_server_caps_arg *args = data;
2609 const u32 *bitmask = args->bitmask; 2640 const u32 *bitmask = args->bitmask;
2610 struct compound_hdr hdr = { 2641 struct compound_hdr hdr = {
2611 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 2642 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
@@ -2622,8 +2653,10 @@ static void nfs4_xdr_enc_server_caps(struct rpc_rqst *req,
2622 * a RENEW request 2653 * a RENEW request
2623 */ 2654 */
2624static void nfs4_xdr_enc_renew(struct rpc_rqst *req, struct xdr_stream *xdr, 2655static void nfs4_xdr_enc_renew(struct rpc_rqst *req, struct xdr_stream *xdr,
2625 struct nfs_client *clp) 2656 const void *data)
2657
2626{ 2658{
2659 const struct nfs_client *clp = data;
2627 struct compound_hdr hdr = { 2660 struct compound_hdr hdr = {
2628 .nops = 0, 2661 .nops = 0,
2629 }; 2662 };
@@ -2638,8 +2671,9 @@ static void nfs4_xdr_enc_renew(struct rpc_rqst *req, struct xdr_stream *xdr,
2638 */ 2671 */
2639static void nfs4_xdr_enc_setclientid(struct rpc_rqst *req, 2672static void nfs4_xdr_enc_setclientid(struct rpc_rqst *req,
2640 struct xdr_stream *xdr, 2673 struct xdr_stream *xdr,
2641 struct nfs4_setclientid *sc) 2674 const void *data)
2642{ 2675{
2676 const struct nfs4_setclientid *sc = data;
2643 struct compound_hdr hdr = { 2677 struct compound_hdr hdr = {
2644 .nops = 0, 2678 .nops = 0,
2645 }; 2679 };
@@ -2654,8 +2688,9 @@ static void nfs4_xdr_enc_setclientid(struct rpc_rqst *req,
2654 */ 2688 */
2655static void nfs4_xdr_enc_setclientid_confirm(struct rpc_rqst *req, 2689static void nfs4_xdr_enc_setclientid_confirm(struct rpc_rqst *req,
2656 struct xdr_stream *xdr, 2690 struct xdr_stream *xdr,
2657 struct nfs4_setclientid_res *arg) 2691 const void *data)
2658{ 2692{
2693 const struct nfs4_setclientid_res *arg = data;
2659 struct compound_hdr hdr = { 2694 struct compound_hdr hdr = {
2660 .nops = 0, 2695 .nops = 0,
2661 }; 2696 };
@@ -2670,8 +2705,9 @@ static void nfs4_xdr_enc_setclientid_confirm(struct rpc_rqst *req,
2670 */ 2705 */
2671static void nfs4_xdr_enc_delegreturn(struct rpc_rqst *req, 2706static void nfs4_xdr_enc_delegreturn(struct rpc_rqst *req,
2672 struct xdr_stream *xdr, 2707 struct xdr_stream *xdr,
2673 const struct nfs4_delegreturnargs *args) 2708 const void *data)
2674{ 2709{
2710 const struct nfs4_delegreturnargs *args = data;
2675 struct compound_hdr hdr = { 2711 struct compound_hdr hdr = {
2676 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 2712 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
2677 }; 2713 };
@@ -2692,8 +2728,9 @@ static void nfs4_xdr_enc_delegreturn(struct rpc_rqst *req,
2692 */ 2728 */
2693static void nfs4_xdr_enc_fs_locations(struct rpc_rqst *req, 2729static void nfs4_xdr_enc_fs_locations(struct rpc_rqst *req,
2694 struct xdr_stream *xdr, 2730 struct xdr_stream *xdr,
2695 struct nfs4_fs_locations_arg *args) 2731 const void *data)
2696{ 2732{
2733 const struct nfs4_fs_locations_arg *args = data;
2697 struct compound_hdr hdr = { 2734 struct compound_hdr hdr = {
2698 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 2735 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
2699 }; 2736 };
@@ -2715,8 +2752,8 @@ static void nfs4_xdr_enc_fs_locations(struct rpc_rqst *req,
2715 } 2752 }
2716 2753
2717 /* Set up reply kvec to capture returned fs_locations array. */ 2754 /* Set up reply kvec to capture returned fs_locations array. */
2718 xdr_inline_pages(&req->rq_rcv_buf, replen << 2, &args->page, 2755 xdr_inline_pages(&req->rq_rcv_buf, replen << 2,
2719 0, PAGE_SIZE); 2756 (struct page **)&args->page, 0, PAGE_SIZE);
2720 encode_nops(&hdr); 2757 encode_nops(&hdr);
2721} 2758}
2722 2759
@@ -2725,8 +2762,9 @@ static void nfs4_xdr_enc_fs_locations(struct rpc_rqst *req,
2725 */ 2762 */
2726static void nfs4_xdr_enc_secinfo(struct rpc_rqst *req, 2763static void nfs4_xdr_enc_secinfo(struct rpc_rqst *req,
2727 struct xdr_stream *xdr, 2764 struct xdr_stream *xdr,
2728 struct nfs4_secinfo_arg *args) 2765 const void *data)
2729{ 2766{
2767 const struct nfs4_secinfo_arg *args = data;
2730 struct compound_hdr hdr = { 2768 struct compound_hdr hdr = {
2731 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 2769 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
2732 }; 2770 };
@@ -2743,8 +2781,9 @@ static void nfs4_xdr_enc_secinfo(struct rpc_rqst *req,
2743 */ 2781 */
2744static void nfs4_xdr_enc_fsid_present(struct rpc_rqst *req, 2782static void nfs4_xdr_enc_fsid_present(struct rpc_rqst *req,
2745 struct xdr_stream *xdr, 2783 struct xdr_stream *xdr,
2746 struct nfs4_fsid_present_arg *args) 2784 const void *data)
2747{ 2785{
2786 const struct nfs4_fsid_present_arg *args = data;
2748 struct compound_hdr hdr = { 2787 struct compound_hdr hdr = {
2749 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 2788 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
2750 }; 2789 };
@@ -2764,8 +2803,9 @@ static void nfs4_xdr_enc_fsid_present(struct rpc_rqst *req,
2764 */ 2803 */
2765static void nfs4_xdr_enc_bind_conn_to_session(struct rpc_rqst *req, 2804static void nfs4_xdr_enc_bind_conn_to_session(struct rpc_rqst *req,
2766 struct xdr_stream *xdr, 2805 struct xdr_stream *xdr,
2767 struct nfs41_bind_conn_to_session_args *args) 2806 const void *data)
2768{ 2807{
2808 const struct nfs41_bind_conn_to_session_args *args = data;
2769 struct compound_hdr hdr = { 2809 struct compound_hdr hdr = {
2770 .minorversion = args->client->cl_mvops->minor_version, 2810 .minorversion = args->client->cl_mvops->minor_version,
2771 }; 2811 };
@@ -2780,8 +2820,9 @@ static void nfs4_xdr_enc_bind_conn_to_session(struct rpc_rqst *req,
2780 */ 2820 */
2781static void nfs4_xdr_enc_exchange_id(struct rpc_rqst *req, 2821static void nfs4_xdr_enc_exchange_id(struct rpc_rqst *req,
2782 struct xdr_stream *xdr, 2822 struct xdr_stream *xdr,
2783 struct nfs41_exchange_id_args *args) 2823 const void *data)
2784{ 2824{
2825 const struct nfs41_exchange_id_args *args = data;
2785 struct compound_hdr hdr = { 2826 struct compound_hdr hdr = {
2786 .minorversion = args->client->cl_mvops->minor_version, 2827 .minorversion = args->client->cl_mvops->minor_version,
2787 }; 2828 };
@@ -2796,8 +2837,9 @@ static void nfs4_xdr_enc_exchange_id(struct rpc_rqst *req,
2796 */ 2837 */
2797static void nfs4_xdr_enc_create_session(struct rpc_rqst *req, 2838static void nfs4_xdr_enc_create_session(struct rpc_rqst *req,
2798 struct xdr_stream *xdr, 2839 struct xdr_stream *xdr,
2799 struct nfs41_create_session_args *args) 2840 const void *data)
2800{ 2841{
2842 const struct nfs41_create_session_args *args = data;
2801 struct compound_hdr hdr = { 2843 struct compound_hdr hdr = {
2802 .minorversion = args->client->cl_mvops->minor_version, 2844 .minorversion = args->client->cl_mvops->minor_version,
2803 }; 2845 };
@@ -2812,8 +2854,9 @@ static void nfs4_xdr_enc_create_session(struct rpc_rqst *req,
2812 */ 2854 */
2813static void nfs4_xdr_enc_destroy_session(struct rpc_rqst *req, 2855static void nfs4_xdr_enc_destroy_session(struct rpc_rqst *req,
2814 struct xdr_stream *xdr, 2856 struct xdr_stream *xdr,
2815 struct nfs4_session *session) 2857 const void *data)
2816{ 2858{
2859 const struct nfs4_session *session = data;
2817 struct compound_hdr hdr = { 2860 struct compound_hdr hdr = {
2818 .minorversion = session->clp->cl_mvops->minor_version, 2861 .minorversion = session->clp->cl_mvops->minor_version,
2819 }; 2862 };
@@ -2828,8 +2871,9 @@ static void nfs4_xdr_enc_destroy_session(struct rpc_rqst *req,
2828 */ 2871 */
2829static void nfs4_xdr_enc_destroy_clientid(struct rpc_rqst *req, 2872static void nfs4_xdr_enc_destroy_clientid(struct rpc_rqst *req,
2830 struct xdr_stream *xdr, 2873 struct xdr_stream *xdr,
2831 struct nfs_client *clp) 2874 const void *data)
2832{ 2875{
2876 const struct nfs_client *clp = data;
2833 struct compound_hdr hdr = { 2877 struct compound_hdr hdr = {
2834 .minorversion = clp->cl_mvops->minor_version, 2878 .minorversion = clp->cl_mvops->minor_version,
2835 }; 2879 };
@@ -2843,8 +2887,9 @@ static void nfs4_xdr_enc_destroy_clientid(struct rpc_rqst *req,
2843 * a SEQUENCE request 2887 * a SEQUENCE request
2844 */ 2888 */
2845static void nfs4_xdr_enc_sequence(struct rpc_rqst *req, struct xdr_stream *xdr, 2889static void nfs4_xdr_enc_sequence(struct rpc_rqst *req, struct xdr_stream *xdr,
2846 struct nfs4_sequence_args *args) 2890 const void *data)
2847{ 2891{
2892 const struct nfs4_sequence_args *args = data;
2848 struct compound_hdr hdr = { 2893 struct compound_hdr hdr = {
2849 .minorversion = nfs4_xdr_minorversion(args), 2894 .minorversion = nfs4_xdr_minorversion(args),
2850 }; 2895 };
@@ -2859,8 +2904,9 @@ static void nfs4_xdr_enc_sequence(struct rpc_rqst *req, struct xdr_stream *xdr,
2859 */ 2904 */
2860static void nfs4_xdr_enc_get_lease_time(struct rpc_rqst *req, 2905static void nfs4_xdr_enc_get_lease_time(struct rpc_rqst *req,
2861 struct xdr_stream *xdr, 2906 struct xdr_stream *xdr,
2862 struct nfs4_get_lease_time_args *args) 2907 const void *data)
2863{ 2908{
2909 const struct nfs4_get_lease_time_args *args = data;
2864 struct compound_hdr hdr = { 2910 struct compound_hdr hdr = {
2865 .minorversion = nfs4_xdr_minorversion(&args->la_seq_args), 2911 .minorversion = nfs4_xdr_minorversion(&args->la_seq_args),
2866 }; 2912 };
@@ -2878,8 +2924,9 @@ static void nfs4_xdr_enc_get_lease_time(struct rpc_rqst *req,
2878 */ 2924 */
2879static void nfs4_xdr_enc_reclaim_complete(struct rpc_rqst *req, 2925static void nfs4_xdr_enc_reclaim_complete(struct rpc_rqst *req,
2880 struct xdr_stream *xdr, 2926 struct xdr_stream *xdr,
2881 struct nfs41_reclaim_complete_args *args) 2927 const void *data)
2882{ 2928{
2929 const struct nfs41_reclaim_complete_args *args = data;
2883 struct compound_hdr hdr = { 2930 struct compound_hdr hdr = {
2884 .minorversion = nfs4_xdr_minorversion(&args->seq_args) 2931 .minorversion = nfs4_xdr_minorversion(&args->seq_args)
2885 }; 2932 };
@@ -2895,8 +2942,9 @@ static void nfs4_xdr_enc_reclaim_complete(struct rpc_rqst *req,
2895 */ 2942 */
2896static void nfs4_xdr_enc_getdeviceinfo(struct rpc_rqst *req, 2943static void nfs4_xdr_enc_getdeviceinfo(struct rpc_rqst *req,
2897 struct xdr_stream *xdr, 2944 struct xdr_stream *xdr,
2898 struct nfs4_getdeviceinfo_args *args) 2945 const void *data)
2899{ 2946{
2947 const struct nfs4_getdeviceinfo_args *args = data;
2900 struct compound_hdr hdr = { 2948 struct compound_hdr hdr = {
2901 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 2949 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
2902 }; 2950 };
@@ -2919,8 +2967,9 @@ static void nfs4_xdr_enc_getdeviceinfo(struct rpc_rqst *req,
2919 */ 2967 */
2920static void nfs4_xdr_enc_layoutget(struct rpc_rqst *req, 2968static void nfs4_xdr_enc_layoutget(struct rpc_rqst *req,
2921 struct xdr_stream *xdr, 2969 struct xdr_stream *xdr,
2922 struct nfs4_layoutget_args *args) 2970 const void *data)
2923{ 2971{
2972 const struct nfs4_layoutget_args *args = data;
2924 struct compound_hdr hdr = { 2973 struct compound_hdr hdr = {
2925 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 2974 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
2926 }; 2975 };
@@ -2941,8 +2990,9 @@ static void nfs4_xdr_enc_layoutget(struct rpc_rqst *req,
2941 */ 2990 */
2942static void nfs4_xdr_enc_layoutcommit(struct rpc_rqst *req, 2991static void nfs4_xdr_enc_layoutcommit(struct rpc_rqst *req,
2943 struct xdr_stream *xdr, 2992 struct xdr_stream *xdr,
2944 struct nfs4_layoutcommit_args *args) 2993 const void *priv)
2945{ 2994{
2995 const struct nfs4_layoutcommit_args *args = priv;
2946 struct nfs4_layoutcommit_data *data = 2996 struct nfs4_layoutcommit_data *data =
2947 container_of(args, struct nfs4_layoutcommit_data, args); 2997 container_of(args, struct nfs4_layoutcommit_data, args);
2948 struct compound_hdr hdr = { 2998 struct compound_hdr hdr = {
@@ -2962,8 +3012,9 @@ static void nfs4_xdr_enc_layoutcommit(struct rpc_rqst *req,
2962 */ 3012 */
2963static void nfs4_xdr_enc_layoutreturn(struct rpc_rqst *req, 3013static void nfs4_xdr_enc_layoutreturn(struct rpc_rqst *req,
2964 struct xdr_stream *xdr, 3014 struct xdr_stream *xdr,
2965 struct nfs4_layoutreturn_args *args) 3015 const void *data)
2966{ 3016{
3017 const struct nfs4_layoutreturn_args *args = data;
2967 struct compound_hdr hdr = { 3018 struct compound_hdr hdr = {
2968 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 3019 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
2969 }; 3020 };
@@ -2978,10 +3029,11 @@ static void nfs4_xdr_enc_layoutreturn(struct rpc_rqst *req,
2978/* 3029/*
2979 * Encode SECINFO_NO_NAME request 3030 * Encode SECINFO_NO_NAME request
2980 */ 3031 */
2981static int nfs4_xdr_enc_secinfo_no_name(struct rpc_rqst *req, 3032static void nfs4_xdr_enc_secinfo_no_name(struct rpc_rqst *req,
2982 struct xdr_stream *xdr, 3033 struct xdr_stream *xdr,
2983 struct nfs41_secinfo_no_name_args *args) 3034 const void *data)
2984{ 3035{
3036 const struct nfs41_secinfo_no_name_args *args = data;
2985 struct compound_hdr hdr = { 3037 struct compound_hdr hdr = {
2986 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 3038 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
2987 }; 3039 };
@@ -2991,7 +3043,6 @@ static int nfs4_xdr_enc_secinfo_no_name(struct rpc_rqst *req,
2991 encode_putrootfh(xdr, &hdr); 3043 encode_putrootfh(xdr, &hdr);
2992 encode_secinfo_no_name(xdr, args, &hdr); 3044 encode_secinfo_no_name(xdr, args, &hdr);
2993 encode_nops(&hdr); 3045 encode_nops(&hdr);
2994 return 0;
2995} 3046}
2996 3047
2997/* 3048/*
@@ -2999,8 +3050,9 @@ static int nfs4_xdr_enc_secinfo_no_name(struct rpc_rqst *req,
2999 */ 3050 */
3000static void nfs4_xdr_enc_test_stateid(struct rpc_rqst *req, 3051static void nfs4_xdr_enc_test_stateid(struct rpc_rqst *req,
3001 struct xdr_stream *xdr, 3052 struct xdr_stream *xdr,
3002 struct nfs41_test_stateid_args *args) 3053 const void *data)
3003{ 3054{
3055 const struct nfs41_test_stateid_args *args = data;
3004 struct compound_hdr hdr = { 3056 struct compound_hdr hdr = {
3005 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 3057 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
3006 }; 3058 };
@@ -3016,8 +3068,9 @@ static void nfs4_xdr_enc_test_stateid(struct rpc_rqst *req,
3016 */ 3068 */
3017static void nfs4_xdr_enc_free_stateid(struct rpc_rqst *req, 3069static void nfs4_xdr_enc_free_stateid(struct rpc_rqst *req,
3018 struct xdr_stream *xdr, 3070 struct xdr_stream *xdr,
3019 struct nfs41_free_stateid_args *args) 3071 const void *data)
3020{ 3072{
3073 const struct nfs41_free_stateid_args *args = data;
3021 struct compound_hdr hdr = { 3074 struct compound_hdr hdr = {
3022 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 3075 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
3023 }; 3076 };
@@ -6101,8 +6154,9 @@ int decode_layoutreturn(struct xdr_stream *xdr,
6101 */ 6154 */
6102static int nfs4_xdr_dec_open_downgrade(struct rpc_rqst *rqstp, 6155static int nfs4_xdr_dec_open_downgrade(struct rpc_rqst *rqstp,
6103 struct xdr_stream *xdr, 6156 struct xdr_stream *xdr,
6104 struct nfs_closeres *res) 6157 void *data)
6105{ 6158{
6159 struct nfs_closeres *res = data;
6106 struct compound_hdr hdr; 6160 struct compound_hdr hdr;
6107 int status; 6161 int status;
6108 6162
@@ -6130,8 +6184,9 @@ out:
6130 * Decode ACCESS response 6184 * Decode ACCESS response
6131 */ 6185 */
6132static int nfs4_xdr_dec_access(struct rpc_rqst *rqstp, struct xdr_stream *xdr, 6186static int nfs4_xdr_dec_access(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
6133 struct nfs4_accessres *res) 6187 void *data)
6134{ 6188{
6189 struct nfs4_accessres *res = data;
6135 struct compound_hdr hdr; 6190 struct compound_hdr hdr;
6136 int status; 6191 int status;
6137 6192
@@ -6156,8 +6211,9 @@ out:
6156 * Decode LOOKUP response 6211 * Decode LOOKUP response
6157 */ 6212 */
6158static int nfs4_xdr_dec_lookup(struct rpc_rqst *rqstp, struct xdr_stream *xdr, 6213static int nfs4_xdr_dec_lookup(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
6159 struct nfs4_lookup_res *res) 6214 void *data)
6160{ 6215{
6216 struct nfs4_lookup_res *res = data;
6161 struct compound_hdr hdr; 6217 struct compound_hdr hdr;
6162 int status; 6218 int status;
6163 6219
@@ -6186,8 +6242,9 @@ out:
6186 */ 6242 */
6187static int nfs4_xdr_dec_lookup_root(struct rpc_rqst *rqstp, 6243static int nfs4_xdr_dec_lookup_root(struct rpc_rqst *rqstp,
6188 struct xdr_stream *xdr, 6244 struct xdr_stream *xdr,
6189 struct nfs4_lookup_res *res) 6245 void *data)
6190{ 6246{
6247 struct nfs4_lookup_res *res = data;
6191 struct compound_hdr hdr; 6248 struct compound_hdr hdr;
6192 int status; 6249 int status;
6193 6250
@@ -6212,8 +6269,9 @@ out:
6212 * Decode REMOVE response 6269 * Decode REMOVE response
6213 */ 6270 */
6214static int nfs4_xdr_dec_remove(struct rpc_rqst *rqstp, struct xdr_stream *xdr, 6271static int nfs4_xdr_dec_remove(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
6215 struct nfs_removeres *res) 6272 void *data)
6216{ 6273{
6274 struct nfs_removeres *res = data;
6217 struct compound_hdr hdr; 6275 struct compound_hdr hdr;
6218 int status; 6276 int status;
6219 6277
@@ -6235,8 +6293,9 @@ out:
6235 * Decode RENAME response 6293 * Decode RENAME response
6236 */ 6294 */
6237static int nfs4_xdr_dec_rename(struct rpc_rqst *rqstp, struct xdr_stream *xdr, 6295static int nfs4_xdr_dec_rename(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
6238 struct nfs_renameres *res) 6296 void *data)
6239{ 6297{
6298 struct nfs_renameres *res = data;
6240 struct compound_hdr hdr; 6299 struct compound_hdr hdr;
6241 int status; 6300 int status;
6242 6301
@@ -6264,8 +6323,9 @@ out:
6264 * Decode LINK response 6323 * Decode LINK response
6265 */ 6324 */
6266static int nfs4_xdr_dec_link(struct rpc_rqst *rqstp, struct xdr_stream *xdr, 6325static int nfs4_xdr_dec_link(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
6267 struct nfs4_link_res *res) 6326 void *data)
6268{ 6327{
6328 struct nfs4_link_res *res = data;
6269 struct compound_hdr hdr; 6329 struct compound_hdr hdr;
6270 int status; 6330 int status;
6271 6331
@@ -6303,8 +6363,9 @@ out:
6303 * Decode CREATE response 6363 * Decode CREATE response
6304 */ 6364 */
6305static int nfs4_xdr_dec_create(struct rpc_rqst *rqstp, struct xdr_stream *xdr, 6365static int nfs4_xdr_dec_create(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
6306 struct nfs4_create_res *res) 6366 void *data)
6307{ 6367{
6368 struct nfs4_create_res *res = data;
6308 struct compound_hdr hdr; 6369 struct compound_hdr hdr;
6309 int status; 6370 int status;
6310 6371
@@ -6332,7 +6393,7 @@ out:
6332 * Decode SYMLINK response 6393 * Decode SYMLINK response
6333 */ 6394 */
6334static int nfs4_xdr_dec_symlink(struct rpc_rqst *rqstp, struct xdr_stream *xdr, 6395static int nfs4_xdr_dec_symlink(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
6335 struct nfs4_create_res *res) 6396 void *res)
6336{ 6397{
6337 return nfs4_xdr_dec_create(rqstp, xdr, res); 6398 return nfs4_xdr_dec_create(rqstp, xdr, res);
6338} 6399}
@@ -6341,8 +6402,9 @@ static int nfs4_xdr_dec_symlink(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
6341 * Decode GETATTR response 6402 * Decode GETATTR response
6342 */ 6403 */
6343static int nfs4_xdr_dec_getattr(struct rpc_rqst *rqstp, struct xdr_stream *xdr, 6404static int nfs4_xdr_dec_getattr(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
6344 struct nfs4_getattr_res *res) 6405 void *data)
6345{ 6406{
6407 struct nfs4_getattr_res *res = data;
6346 struct compound_hdr hdr; 6408 struct compound_hdr hdr;
6347 int status; 6409 int status;
6348 6410
@@ -6364,8 +6426,9 @@ out:
6364 * Encode an SETACL request 6426 * Encode an SETACL request
6365 */ 6427 */
6366static void nfs4_xdr_enc_setacl(struct rpc_rqst *req, struct xdr_stream *xdr, 6428static void nfs4_xdr_enc_setacl(struct rpc_rqst *req, struct xdr_stream *xdr,
6367 struct nfs_setaclargs *args) 6429 const void *data)
6368{ 6430{
6431 const struct nfs_setaclargs *args = data;
6369 struct compound_hdr hdr = { 6432 struct compound_hdr hdr = {
6370 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 6433 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
6371 }; 6434 };
@@ -6382,8 +6445,9 @@ static void nfs4_xdr_enc_setacl(struct rpc_rqst *req, struct xdr_stream *xdr,
6382 */ 6445 */
6383static int 6446static int
6384nfs4_xdr_dec_setacl(struct rpc_rqst *rqstp, struct xdr_stream *xdr, 6447nfs4_xdr_dec_setacl(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
6385 struct nfs_setaclres *res) 6448 void *data)
6386{ 6449{
6450 struct nfs_setaclres *res = data;
6387 struct compound_hdr hdr; 6451 struct compound_hdr hdr;
6388 int status; 6452 int status;
6389 6453
@@ -6406,8 +6470,9 @@ out:
6406 */ 6470 */
6407static int 6471static int
6408nfs4_xdr_dec_getacl(struct rpc_rqst *rqstp, struct xdr_stream *xdr, 6472nfs4_xdr_dec_getacl(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
6409 struct nfs_getaclres *res) 6473 void *data)
6410{ 6474{
6475 struct nfs_getaclres *res = data;
6411 struct compound_hdr hdr; 6476 struct compound_hdr hdr;
6412 int status; 6477 int status;
6413 6478
@@ -6434,8 +6499,9 @@ out:
6434 * Decode CLOSE response 6499 * Decode CLOSE response
6435 */ 6500 */
6436static int nfs4_xdr_dec_close(struct rpc_rqst *rqstp, struct xdr_stream *xdr, 6501static int nfs4_xdr_dec_close(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
6437 struct nfs_closeres *res) 6502 void *data)
6438{ 6503{
6504 struct nfs_closeres *res = data;
6439 struct compound_hdr hdr; 6505 struct compound_hdr hdr;
6440 int status; 6506 int status;
6441 6507
@@ -6468,8 +6534,9 @@ out:
6468 * Decode OPEN response 6534 * Decode OPEN response
6469 */ 6535 */
6470static int nfs4_xdr_dec_open(struct rpc_rqst *rqstp, struct xdr_stream *xdr, 6536static int nfs4_xdr_dec_open(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
6471 struct nfs_openres *res) 6537 void *data)
6472{ 6538{
6539 struct nfs_openres *res = data;
6473 struct compound_hdr hdr; 6540 struct compound_hdr hdr;
6474 int status; 6541 int status;
6475 6542
@@ -6500,8 +6567,9 @@ out:
6500 */ 6567 */
6501static int nfs4_xdr_dec_open_confirm(struct rpc_rqst *rqstp, 6568static int nfs4_xdr_dec_open_confirm(struct rpc_rqst *rqstp,
6502 struct xdr_stream *xdr, 6569 struct xdr_stream *xdr,
6503 struct nfs_open_confirmres *res) 6570 void *data)
6504{ 6571{
6572 struct nfs_open_confirmres *res = data;
6505 struct compound_hdr hdr; 6573 struct compound_hdr hdr;
6506 int status; 6574 int status;
6507 6575
@@ -6521,8 +6589,9 @@ out:
6521 */ 6589 */
6522static int nfs4_xdr_dec_open_noattr(struct rpc_rqst *rqstp, 6590static int nfs4_xdr_dec_open_noattr(struct rpc_rqst *rqstp,
6523 struct xdr_stream *xdr, 6591 struct xdr_stream *xdr,
6524 struct nfs_openres *res) 6592 void *data)
6525{ 6593{
6594 struct nfs_openres *res = data;
6526 struct compound_hdr hdr; 6595 struct compound_hdr hdr;
6527 int status; 6596 int status;
6528 6597
@@ -6550,8 +6619,9 @@ out:
6550 */ 6619 */
6551static int nfs4_xdr_dec_setattr(struct rpc_rqst *rqstp, 6620static int nfs4_xdr_dec_setattr(struct rpc_rqst *rqstp,
6552 struct xdr_stream *xdr, 6621 struct xdr_stream *xdr,
6553 struct nfs_setattrres *res) 6622 void *data)
6554{ 6623{
6624 struct nfs_setattrres *res = data;
6555 struct compound_hdr hdr; 6625 struct compound_hdr hdr;
6556 int status; 6626 int status;
6557 6627
@@ -6576,8 +6646,9 @@ out:
6576 * Decode LOCK response 6646 * Decode LOCK response
6577 */ 6647 */
6578static int nfs4_xdr_dec_lock(struct rpc_rqst *rqstp, struct xdr_stream *xdr, 6648static int nfs4_xdr_dec_lock(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
6579 struct nfs_lock_res *res) 6649 void *data)
6580{ 6650{
6651 struct nfs_lock_res *res = data;
6581 struct compound_hdr hdr; 6652 struct compound_hdr hdr;
6582 int status; 6653 int status;
6583 6654
@@ -6599,8 +6670,9 @@ out:
6599 * Decode LOCKT response 6670 * Decode LOCKT response
6600 */ 6671 */
6601static int nfs4_xdr_dec_lockt(struct rpc_rqst *rqstp, struct xdr_stream *xdr, 6672static int nfs4_xdr_dec_lockt(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
6602 struct nfs_lockt_res *res) 6673 void *data)
6603{ 6674{
6675 struct nfs_lockt_res *res = data;
6604 struct compound_hdr hdr; 6676 struct compound_hdr hdr;
6605 int status; 6677 int status;
6606 6678
@@ -6622,8 +6694,9 @@ out:
6622 * Decode LOCKU response 6694 * Decode LOCKU response
6623 */ 6695 */
6624static int nfs4_xdr_dec_locku(struct rpc_rqst *rqstp, struct xdr_stream *xdr, 6696static int nfs4_xdr_dec_locku(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
6625 struct nfs_locku_res *res) 6697 void *data)
6626{ 6698{
6699 struct nfs_locku_res *res = data;
6627 struct compound_hdr hdr; 6700 struct compound_hdr hdr;
6628 int status; 6701 int status;
6629 6702
@@ -6658,8 +6731,9 @@ static int nfs4_xdr_dec_release_lockowner(struct rpc_rqst *rqstp,
6658 */ 6731 */
6659static int nfs4_xdr_dec_readlink(struct rpc_rqst *rqstp, 6732static int nfs4_xdr_dec_readlink(struct rpc_rqst *rqstp,
6660 struct xdr_stream *xdr, 6733 struct xdr_stream *xdr,
6661 struct nfs4_readlink_res *res) 6734 void *data)
6662{ 6735{
6736 struct nfs4_readlink_res *res = data;
6663 struct compound_hdr hdr; 6737 struct compound_hdr hdr;
6664 int status; 6738 int status;
6665 6739
@@ -6681,8 +6755,9 @@ out:
6681 * Decode READDIR response 6755 * Decode READDIR response
6682 */ 6756 */
6683static int nfs4_xdr_dec_readdir(struct rpc_rqst *rqstp, struct xdr_stream *xdr, 6757static int nfs4_xdr_dec_readdir(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
6684 struct nfs4_readdir_res *res) 6758 void *data)
6685{ 6759{
6760 struct nfs4_readdir_res *res = data;
6686 struct compound_hdr hdr; 6761 struct compound_hdr hdr;
6687 int status; 6762 int status;
6688 6763
@@ -6704,8 +6779,9 @@ out:
6704 * Decode Read response 6779 * Decode Read response
6705 */ 6780 */
6706static int nfs4_xdr_dec_read(struct rpc_rqst *rqstp, struct xdr_stream *xdr, 6781static int nfs4_xdr_dec_read(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
6707 struct nfs_pgio_res *res) 6782 void *data)
6708{ 6783{
6784 struct nfs_pgio_res *res = data;
6709 struct compound_hdr hdr; 6785 struct compound_hdr hdr;
6710 int status; 6786 int status;
6711 6787
@@ -6730,8 +6806,9 @@ out:
6730 * Decode WRITE response 6806 * Decode WRITE response
6731 */ 6807 */
6732static int nfs4_xdr_dec_write(struct rpc_rqst *rqstp, struct xdr_stream *xdr, 6808static int nfs4_xdr_dec_write(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
6733 struct nfs_pgio_res *res) 6809 void *data)
6734{ 6810{
6811 struct nfs_pgio_res *res = data;
6735 struct compound_hdr hdr; 6812 struct compound_hdr hdr;
6736 int status; 6813 int status;
6737 6814
@@ -6760,8 +6837,9 @@ out:
6760 * Decode COMMIT response 6837 * Decode COMMIT response
6761 */ 6838 */
6762static int nfs4_xdr_dec_commit(struct rpc_rqst *rqstp, struct xdr_stream *xdr, 6839static int nfs4_xdr_dec_commit(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
6763 struct nfs_commitres *res) 6840 void *data)
6764{ 6841{
6842 struct nfs_commitres *res = data;
6765 struct compound_hdr hdr; 6843 struct compound_hdr hdr;
6766 int status; 6844 int status;
6767 6845
@@ -6784,8 +6862,9 @@ out:
6784 * Decode FSINFO response 6862 * Decode FSINFO response
6785 */ 6863 */
6786static int nfs4_xdr_dec_fsinfo(struct rpc_rqst *req, struct xdr_stream *xdr, 6864static int nfs4_xdr_dec_fsinfo(struct rpc_rqst *req, struct xdr_stream *xdr,
6787 struct nfs4_fsinfo_res *res) 6865 void *data)
6788{ 6866{
6867 struct nfs4_fsinfo_res *res = data;
6789 struct compound_hdr hdr; 6868 struct compound_hdr hdr;
6790 int status; 6869 int status;
6791 6870
@@ -6803,8 +6882,9 @@ static int nfs4_xdr_dec_fsinfo(struct rpc_rqst *req, struct xdr_stream *xdr,
6803 * Decode PATHCONF response 6882 * Decode PATHCONF response
6804 */ 6883 */
6805static int nfs4_xdr_dec_pathconf(struct rpc_rqst *req, struct xdr_stream *xdr, 6884static int nfs4_xdr_dec_pathconf(struct rpc_rqst *req, struct xdr_stream *xdr,
6806 struct nfs4_pathconf_res *res) 6885 void *data)
6807{ 6886{
6887 struct nfs4_pathconf_res *res = data;
6808 struct compound_hdr hdr; 6888 struct compound_hdr hdr;
6809 int status; 6889 int status;
6810 6890
@@ -6822,8 +6902,9 @@ static int nfs4_xdr_dec_pathconf(struct rpc_rqst *req, struct xdr_stream *xdr,
6822 * Decode STATFS response 6902 * Decode STATFS response
6823 */ 6903 */
6824static int nfs4_xdr_dec_statfs(struct rpc_rqst *req, struct xdr_stream *xdr, 6904static int nfs4_xdr_dec_statfs(struct rpc_rqst *req, struct xdr_stream *xdr,
6825 struct nfs4_statfs_res *res) 6905 void *data)
6826{ 6906{
6907 struct nfs4_statfs_res *res = data;
6827 struct compound_hdr hdr; 6908 struct compound_hdr hdr;
6828 int status; 6909 int status;
6829 6910
@@ -6842,8 +6923,9 @@ static int nfs4_xdr_dec_statfs(struct rpc_rqst *req, struct xdr_stream *xdr,
6842 */ 6923 */
6843static int nfs4_xdr_dec_server_caps(struct rpc_rqst *req, 6924static int nfs4_xdr_dec_server_caps(struct rpc_rqst *req,
6844 struct xdr_stream *xdr, 6925 struct xdr_stream *xdr,
6845 struct nfs4_server_caps_res *res) 6926 void *data)
6846{ 6927{
6928 struct nfs4_server_caps_res *res = data;
6847 struct compound_hdr hdr; 6929 struct compound_hdr hdr;
6848 int status; 6930 int status;
6849 6931
@@ -6881,8 +6963,9 @@ static int nfs4_xdr_dec_renew(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
6881 */ 6963 */
6882static int nfs4_xdr_dec_setclientid(struct rpc_rqst *req, 6964static int nfs4_xdr_dec_setclientid(struct rpc_rqst *req,
6883 struct xdr_stream *xdr, 6965 struct xdr_stream *xdr,
6884 struct nfs4_setclientid_res *res) 6966 void *data)
6885{ 6967{
6968 struct nfs4_setclientid_res *res = data;
6886 struct compound_hdr hdr; 6969 struct compound_hdr hdr;
6887 int status; 6970 int status;
6888 6971
@@ -6896,7 +6979,8 @@ static int nfs4_xdr_dec_setclientid(struct rpc_rqst *req,
6896 * Decode SETCLIENTID_CONFIRM response 6979 * Decode SETCLIENTID_CONFIRM response
6897 */ 6980 */
6898static int nfs4_xdr_dec_setclientid_confirm(struct rpc_rqst *req, 6981static int nfs4_xdr_dec_setclientid_confirm(struct rpc_rqst *req,
6899 struct xdr_stream *xdr) 6982 struct xdr_stream *xdr,
6983 void *data)
6900{ 6984{
6901 struct compound_hdr hdr; 6985 struct compound_hdr hdr;
6902 int status; 6986 int status;
@@ -6912,8 +6996,9 @@ static int nfs4_xdr_dec_setclientid_confirm(struct rpc_rqst *req,
6912 */ 6996 */
6913static int nfs4_xdr_dec_delegreturn(struct rpc_rqst *rqstp, 6997static int nfs4_xdr_dec_delegreturn(struct rpc_rqst *rqstp,
6914 struct xdr_stream *xdr, 6998 struct xdr_stream *xdr,
6915 struct nfs4_delegreturnres *res) 6999 void *data)
6916{ 7000{
7001 struct nfs4_delegreturnres *res = data;
6917 struct compound_hdr hdr; 7002 struct compound_hdr hdr;
6918 int status; 7003 int status;
6919 7004
@@ -6947,8 +7032,9 @@ out:
6947 */ 7032 */
6948static int nfs4_xdr_dec_fs_locations(struct rpc_rqst *req, 7033static int nfs4_xdr_dec_fs_locations(struct rpc_rqst *req,
6949 struct xdr_stream *xdr, 7034 struct xdr_stream *xdr,
6950 struct nfs4_fs_locations_res *res) 7035 void *data)
6951{ 7036{
7037 struct nfs4_fs_locations_res *res = data;
6952 struct compound_hdr hdr; 7038 struct compound_hdr hdr;
6953 int status; 7039 int status;
6954 7040
@@ -6990,8 +7076,9 @@ out:
6990 */ 7076 */
6991static int nfs4_xdr_dec_secinfo(struct rpc_rqst *rqstp, 7077static int nfs4_xdr_dec_secinfo(struct rpc_rqst *rqstp,
6992 struct xdr_stream *xdr, 7078 struct xdr_stream *xdr,
6993 struct nfs4_secinfo_res *res) 7079 void *data)
6994{ 7080{
7081 struct nfs4_secinfo_res *res = data;
6995 struct compound_hdr hdr; 7082 struct compound_hdr hdr;
6996 int status; 7083 int status;
6997 7084
@@ -7014,8 +7101,9 @@ out:
7014 */ 7101 */
7015static int nfs4_xdr_dec_fsid_present(struct rpc_rqst *rqstp, 7102static int nfs4_xdr_dec_fsid_present(struct rpc_rqst *rqstp,
7016 struct xdr_stream *xdr, 7103 struct xdr_stream *xdr,
7017 struct nfs4_fsid_present_res *res) 7104 void *data)
7018{ 7105{
7106 struct nfs4_fsid_present_res *res = data;
7019 struct compound_hdr hdr; 7107 struct compound_hdr hdr;
7020 int status; 7108 int status;
7021 7109
@@ -7075,7 +7163,7 @@ static int nfs4_xdr_dec_exchange_id(struct rpc_rqst *rqstp,
7075 */ 7163 */
7076static int nfs4_xdr_dec_create_session(struct rpc_rqst *rqstp, 7164static int nfs4_xdr_dec_create_session(struct rpc_rqst *rqstp,
7077 struct xdr_stream *xdr, 7165 struct xdr_stream *xdr,
7078 struct nfs41_create_session_res *res) 7166 void *res)
7079{ 7167{
7080 struct compound_hdr hdr; 7168 struct compound_hdr hdr;
7081 int status; 7169 int status;
@@ -7123,7 +7211,7 @@ static int nfs4_xdr_dec_destroy_clientid(struct rpc_rqst *rqstp,
7123 */ 7211 */
7124static int nfs4_xdr_dec_sequence(struct rpc_rqst *rqstp, 7212static int nfs4_xdr_dec_sequence(struct rpc_rqst *rqstp,
7125 struct xdr_stream *xdr, 7213 struct xdr_stream *xdr,
7126 struct nfs4_sequence_res *res) 7214 void *res)
7127{ 7215{
7128 struct compound_hdr hdr; 7216 struct compound_hdr hdr;
7129 int status; 7217 int status;
@@ -7139,8 +7227,9 @@ static int nfs4_xdr_dec_sequence(struct rpc_rqst *rqstp,
7139 */ 7227 */
7140static int nfs4_xdr_dec_get_lease_time(struct rpc_rqst *rqstp, 7228static int nfs4_xdr_dec_get_lease_time(struct rpc_rqst *rqstp,
7141 struct xdr_stream *xdr, 7229 struct xdr_stream *xdr,
7142 struct nfs4_get_lease_time_res *res) 7230 void *data)
7143{ 7231{
7232 struct nfs4_get_lease_time_res *res = data;
7144 struct compound_hdr hdr; 7233 struct compound_hdr hdr;
7145 int status; 7234 int status;
7146 7235
@@ -7159,8 +7248,9 @@ static int nfs4_xdr_dec_get_lease_time(struct rpc_rqst *rqstp,
7159 */ 7248 */
7160static int nfs4_xdr_dec_reclaim_complete(struct rpc_rqst *rqstp, 7249static int nfs4_xdr_dec_reclaim_complete(struct rpc_rqst *rqstp,
7161 struct xdr_stream *xdr, 7250 struct xdr_stream *xdr,
7162 struct nfs41_reclaim_complete_res *res) 7251 void *data)
7163{ 7252{
7253 struct nfs41_reclaim_complete_res *res = data;
7164 struct compound_hdr hdr; 7254 struct compound_hdr hdr;
7165 int status; 7255 int status;
7166 7256
@@ -7177,8 +7267,9 @@ static int nfs4_xdr_dec_reclaim_complete(struct rpc_rqst *rqstp,
7177 */ 7267 */
7178static int nfs4_xdr_dec_getdeviceinfo(struct rpc_rqst *rqstp, 7268static int nfs4_xdr_dec_getdeviceinfo(struct rpc_rqst *rqstp,
7179 struct xdr_stream *xdr, 7269 struct xdr_stream *xdr,
7180 struct nfs4_getdeviceinfo_res *res) 7270 void *data)
7181{ 7271{
7272 struct nfs4_getdeviceinfo_res *res = data;
7182 struct compound_hdr hdr; 7273 struct compound_hdr hdr;
7183 int status; 7274 int status;
7184 7275
@@ -7198,8 +7289,9 @@ out:
7198 */ 7289 */
7199static int nfs4_xdr_dec_layoutget(struct rpc_rqst *rqstp, 7290static int nfs4_xdr_dec_layoutget(struct rpc_rqst *rqstp,
7200 struct xdr_stream *xdr, 7291 struct xdr_stream *xdr,
7201 struct nfs4_layoutget_res *res) 7292 void *data)
7202{ 7293{
7294 struct nfs4_layoutget_res *res = data;
7203 struct compound_hdr hdr; 7295 struct compound_hdr hdr;
7204 int status; 7296 int status;
7205 7297
@@ -7222,8 +7314,9 @@ out:
7222 */ 7314 */
7223static int nfs4_xdr_dec_layoutreturn(struct rpc_rqst *rqstp, 7315static int nfs4_xdr_dec_layoutreturn(struct rpc_rqst *rqstp,
7224 struct xdr_stream *xdr, 7316 struct xdr_stream *xdr,
7225 struct nfs4_layoutreturn_res *res) 7317 void *data)
7226{ 7318{
7319 struct nfs4_layoutreturn_res *res = data;
7227 struct compound_hdr hdr; 7320 struct compound_hdr hdr;
7228 int status; 7321 int status;
7229 7322
@@ -7246,8 +7339,9 @@ out:
7246 */ 7339 */
7247static int nfs4_xdr_dec_layoutcommit(struct rpc_rqst *rqstp, 7340static int nfs4_xdr_dec_layoutcommit(struct rpc_rqst *rqstp,
7248 struct xdr_stream *xdr, 7341 struct xdr_stream *xdr,
7249 struct nfs4_layoutcommit_res *res) 7342 void *data)
7250{ 7343{
7344 struct nfs4_layoutcommit_res *res = data;
7251 struct compound_hdr hdr; 7345 struct compound_hdr hdr;
7252 int status; 7346 int status;
7253 7347
@@ -7273,8 +7367,9 @@ out:
7273 */ 7367 */
7274static int nfs4_xdr_dec_secinfo_no_name(struct rpc_rqst *rqstp, 7368static int nfs4_xdr_dec_secinfo_no_name(struct rpc_rqst *rqstp,
7275 struct xdr_stream *xdr, 7369 struct xdr_stream *xdr,
7276 struct nfs4_secinfo_res *res) 7370 void *data)
7277{ 7371{
7372 struct nfs4_secinfo_res *res = data;
7278 struct compound_hdr hdr; 7373 struct compound_hdr hdr;
7279 int status; 7374 int status;
7280 7375
@@ -7297,8 +7392,9 @@ out:
7297 */ 7392 */
7298static int nfs4_xdr_dec_test_stateid(struct rpc_rqst *rqstp, 7393static int nfs4_xdr_dec_test_stateid(struct rpc_rqst *rqstp,
7299 struct xdr_stream *xdr, 7394 struct xdr_stream *xdr,
7300 struct nfs41_test_stateid_res *res) 7395 void *data)
7301{ 7396{
7397 struct nfs41_test_stateid_res *res = data;
7302 struct compound_hdr hdr; 7398 struct compound_hdr hdr;
7303 int status; 7399 int status;
7304 7400
@@ -7318,8 +7414,9 @@ out:
7318 */ 7414 */
7319static int nfs4_xdr_dec_free_stateid(struct rpc_rqst *rqstp, 7415static int nfs4_xdr_dec_free_stateid(struct rpc_rqst *rqstp,
7320 struct xdr_stream *xdr, 7416 struct xdr_stream *xdr,
7321 struct nfs41_free_stateid_res *res) 7417 void *data)
7322{ 7418{
7419 struct nfs41_free_stateid_res *res = data;
7323 struct compound_hdr hdr; 7420 struct compound_hdr hdr;
7324 int status; 7421 int status;
7325 7422
@@ -7484,8 +7581,8 @@ nfs4_stat_to_errno(int stat)
7484#define PROC(proc, argtype, restype) \ 7581#define PROC(proc, argtype, restype) \
7485[NFSPROC4_CLNT_##proc] = { \ 7582[NFSPROC4_CLNT_##proc] = { \
7486 .p_proc = NFSPROC4_COMPOUND, \ 7583 .p_proc = NFSPROC4_COMPOUND, \
7487 .p_encode = (kxdreproc_t)nfs4_xdr_##argtype, \ 7584 .p_encode = nfs4_xdr_##argtype, \
7488 .p_decode = (kxdrdproc_t)nfs4_xdr_##restype, \ 7585 .p_decode = nfs4_xdr_##restype, \
7489 .p_arglen = NFS4_##argtype##_sz, \ 7586 .p_arglen = NFS4_##argtype##_sz, \
7490 .p_replen = NFS4_##restype##_sz, \ 7587 .p_replen = NFS4_##restype##_sz, \
7491 .p_statidx = NFSPROC4_CLNT_##proc, \ 7588 .p_statidx = NFSPROC4_CLNT_##proc, \
@@ -7497,7 +7594,7 @@ nfs4_stat_to_errno(int stat)
7497 .p_name = #proc, \ 7594 .p_name = #proc, \
7498} 7595}
7499 7596
7500struct rpc_procinfo nfs4_procedures[] = { 7597const struct rpc_procinfo nfs4_procedures[] = {
7501 PROC(READ, enc_read, dec_read), 7598 PROC(READ, enc_read, dec_read),
7502 PROC(WRITE, enc_write, dec_write), 7599 PROC(WRITE, enc_write, dec_write),
7503 PROC(COMMIT, enc_commit, dec_commit), 7600 PROC(COMMIT, enc_commit, dec_commit),
@@ -7564,10 +7661,12 @@ struct rpc_procinfo nfs4_procedures[] = {
7564#endif /* CONFIG_NFS_V4_2 */ 7661#endif /* CONFIG_NFS_V4_2 */
7565}; 7662};
7566 7663
7664static unsigned int nfs_version4_counts[ARRAY_SIZE(nfs4_procedures)];
7567const struct rpc_version nfs_version4 = { 7665const struct rpc_version nfs_version4 = {
7568 .number = 4, 7666 .number = 4,
7569 .nrprocs = ARRAY_SIZE(nfs4_procedures), 7667 .nrprocs = ARRAY_SIZE(nfs4_procedures),
7570 .procs = nfs4_procedures 7668 .procs = nfs4_procedures,
7669 .counts = nfs_version4_counts,
7571}; 7670};
7572 7671
7573/* 7672/*
diff --git a/fs/nfsd/current_stateid.h b/fs/nfsd/current_stateid.h
index 4123551208d8..34075cee573a 100644
--- a/fs/nfsd/current_stateid.h
+++ b/fs/nfsd/current_stateid.h
@@ -8,21 +8,33 @@ extern void clear_current_stateid(struct nfsd4_compound_state *cstate);
8/* 8/*
9 * functions to set current state id 9 * functions to set current state id
10 */ 10 */
11extern void nfsd4_set_opendowngradestateid(struct nfsd4_compound_state *cstate, struct nfsd4_open_downgrade *); 11extern void nfsd4_set_opendowngradestateid(struct nfsd4_compound_state *,
12extern void nfsd4_set_openstateid(struct nfsd4_compound_state *, struct nfsd4_open *); 12 union nfsd4_op_u *);
13extern void nfsd4_set_lockstateid(struct nfsd4_compound_state *, struct nfsd4_lock *); 13extern void nfsd4_set_openstateid(struct nfsd4_compound_state *,
14extern void nfsd4_set_closestateid(struct nfsd4_compound_state *, struct nfsd4_close *); 14 union nfsd4_op_u *);
15extern void nfsd4_set_lockstateid(struct nfsd4_compound_state *,
16 union nfsd4_op_u *);
17extern void nfsd4_set_closestateid(struct nfsd4_compound_state *,
18 union nfsd4_op_u *);
15 19
16/* 20/*
17 * functions to consume current state id 21 * functions to consume current state id
18 */ 22 */
19extern void nfsd4_get_opendowngradestateid(struct nfsd4_compound_state *cstate, struct nfsd4_open_downgrade *); 23extern void nfsd4_get_opendowngradestateid(struct nfsd4_compound_state *,
20extern void nfsd4_get_delegreturnstateid(struct nfsd4_compound_state *, struct nfsd4_delegreturn *); 24 union nfsd4_op_u *);
21extern void nfsd4_get_freestateid(struct nfsd4_compound_state *, struct nfsd4_free_stateid *); 25extern void nfsd4_get_delegreturnstateid(struct nfsd4_compound_state *,
22extern void nfsd4_get_setattrstateid(struct nfsd4_compound_state *, struct nfsd4_setattr *); 26 union nfsd4_op_u *);
23extern void nfsd4_get_closestateid(struct nfsd4_compound_state *, struct nfsd4_close *); 27extern void nfsd4_get_freestateid(struct nfsd4_compound_state *,
24extern void nfsd4_get_lockustateid(struct nfsd4_compound_state *, struct nfsd4_locku *); 28 union nfsd4_op_u *);
25extern void nfsd4_get_readstateid(struct nfsd4_compound_state *, struct nfsd4_read *); 29extern void nfsd4_get_setattrstateid(struct nfsd4_compound_state *,
26extern void nfsd4_get_writestateid(struct nfsd4_compound_state *, struct nfsd4_write *); 30 union nfsd4_op_u *);
31extern void nfsd4_get_closestateid(struct nfsd4_compound_state *,
32 union nfsd4_op_u *);
33extern void nfsd4_get_lockustateid(struct nfsd4_compound_state *,
34 union nfsd4_op_u *);
35extern void nfsd4_get_readstateid(struct nfsd4_compound_state *,
36 union nfsd4_op_u *);
37extern void nfsd4_get_writestateid(struct nfsd4_compound_state *,
38 union nfsd4_op_u *);
27 39
28#endif /* _NFSD4_CURRENT_STATE_H */ 40#endif /* _NFSD4_CURRENT_STATE_H */
diff --git a/fs/nfsd/nfs2acl.c b/fs/nfsd/nfs2acl.c
index 838f90f3f890..6276ec8608b0 100644
--- a/fs/nfsd/nfs2acl.c
+++ b/fs/nfsd/nfs2acl.c
@@ -19,7 +19,7 @@
19 * NULL call. 19 * NULL call.
20 */ 20 */
21static __be32 21static __be32
22nfsacld_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) 22nfsacld_proc_null(struct svc_rqst *rqstp)
23{ 23{
24 return nfs_ok; 24 return nfs_ok;
25} 25}
@@ -27,9 +27,10 @@ nfsacld_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)
27/* 27/*
28 * Get the Access and/or Default ACL of a file. 28 * Get the Access and/or Default ACL of a file.
29 */ 29 */
30static __be32 nfsacld_proc_getacl(struct svc_rqst * rqstp, 30static __be32 nfsacld_proc_getacl(struct svc_rqst *rqstp)
31 struct nfsd3_getaclargs *argp, struct nfsd3_getaclres *resp)
32{ 31{
32 struct nfsd3_getaclargs *argp = rqstp->rq_argp;
33 struct nfsd3_getaclres *resp = rqstp->rq_resp;
33 struct posix_acl *acl; 34 struct posix_acl *acl;
34 struct inode *inode; 35 struct inode *inode;
35 svc_fh *fh; 36 svc_fh *fh;
@@ -87,10 +88,10 @@ fail:
87/* 88/*
88 * Set the Access and/or Default ACL of a file. 89 * Set the Access and/or Default ACL of a file.
89 */ 90 */
90static __be32 nfsacld_proc_setacl(struct svc_rqst * rqstp, 91static __be32 nfsacld_proc_setacl(struct svc_rqst *rqstp)
91 struct nfsd3_setaclargs *argp,
92 struct nfsd_attrstat *resp)
93{ 92{
93 struct nfsd3_setaclargs *argp = rqstp->rq_argp;
94 struct nfsd_attrstat *resp = rqstp->rq_resp;
94 struct inode *inode; 95 struct inode *inode;
95 svc_fh *fh; 96 svc_fh *fh;
96 __be32 nfserr = 0; 97 __be32 nfserr = 0;
@@ -141,9 +142,10 @@ out_errno:
141/* 142/*
142 * Check file attributes 143 * Check file attributes
143 */ 144 */
144static __be32 nfsacld_proc_getattr(struct svc_rqst * rqstp, 145static __be32 nfsacld_proc_getattr(struct svc_rqst *rqstp)
145 struct nfsd_fhandle *argp, struct nfsd_attrstat *resp)
146{ 146{
147 struct nfsd_fhandle *argp = rqstp->rq_argp;
148 struct nfsd_attrstat *resp = rqstp->rq_resp;
147 __be32 nfserr; 149 __be32 nfserr;
148 dprintk("nfsd: GETATTR %s\n", SVCFH_fmt(&argp->fh)); 150 dprintk("nfsd: GETATTR %s\n", SVCFH_fmt(&argp->fh));
149 151
@@ -158,9 +160,10 @@ static __be32 nfsacld_proc_getattr(struct svc_rqst * rqstp,
158/* 160/*
159 * Check file access 161 * Check file access
160 */ 162 */
161static __be32 nfsacld_proc_access(struct svc_rqst *rqstp, struct nfsd3_accessargs *argp, 163static __be32 nfsacld_proc_access(struct svc_rqst *rqstp)
162 struct nfsd3_accessres *resp)
163{ 164{
165 struct nfsd3_accessargs *argp = rqstp->rq_argp;
166 struct nfsd3_accessres *resp = rqstp->rq_resp;
164 __be32 nfserr; 167 __be32 nfserr;
165 168
166 dprintk("nfsd: ACCESS(2acl) %s 0x%x\n", 169 dprintk("nfsd: ACCESS(2acl) %s 0x%x\n",
@@ -179,9 +182,10 @@ static __be32 nfsacld_proc_access(struct svc_rqst *rqstp, struct nfsd3_accessarg
179/* 182/*
180 * XDR decode functions 183 * XDR decode functions
181 */ 184 */
182static int nfsaclsvc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p, 185static int nfsaclsvc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p)
183 struct nfsd3_getaclargs *argp)
184{ 186{
187 struct nfsd3_getaclargs *argp = rqstp->rq_argp;
188
185 p = nfs2svc_decode_fh(p, &argp->fh); 189 p = nfs2svc_decode_fh(p, &argp->fh);
186 if (!p) 190 if (!p)
187 return 0; 191 return 0;
@@ -191,9 +195,9 @@ static int nfsaclsvc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p,
191} 195}
192 196
193 197
194static int nfsaclsvc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p, 198static int nfsaclsvc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p)
195 struct nfsd3_setaclargs *argp)
196{ 199{
200 struct nfsd3_setaclargs *argp = rqstp->rq_argp;
197 struct kvec *head = rqstp->rq_arg.head; 201 struct kvec *head = rqstp->rq_arg.head;
198 unsigned int base; 202 unsigned int base;
199 int n; 203 int n;
@@ -217,18 +221,20 @@ static int nfsaclsvc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p,
217 return (n > 0); 221 return (n > 0);
218} 222}
219 223
220static int nfsaclsvc_decode_fhandleargs(struct svc_rqst *rqstp, __be32 *p, 224static int nfsaclsvc_decode_fhandleargs(struct svc_rqst *rqstp, __be32 *p)
221 struct nfsd_fhandle *argp)
222{ 225{
226 struct nfsd_fhandle *argp = rqstp->rq_argp;
227
223 p = nfs2svc_decode_fh(p, &argp->fh); 228 p = nfs2svc_decode_fh(p, &argp->fh);
224 if (!p) 229 if (!p)
225 return 0; 230 return 0;
226 return xdr_argsize_check(rqstp, p); 231 return xdr_argsize_check(rqstp, p);
227} 232}
228 233
229static int nfsaclsvc_decode_accessargs(struct svc_rqst *rqstp, __be32 *p, 234static int nfsaclsvc_decode_accessargs(struct svc_rqst *rqstp, __be32 *p)
230 struct nfsd3_accessargs *argp)
231{ 235{
236 struct nfsd3_accessargs *argp = rqstp->rq_argp;
237
232 p = nfs2svc_decode_fh(p, &argp->fh); 238 p = nfs2svc_decode_fh(p, &argp->fh);
233 if (!p) 239 if (!p)
234 return 0; 240 return 0;
@@ -245,15 +251,15 @@ static int nfsaclsvc_decode_accessargs(struct svc_rqst *rqstp, __be32 *p,
245 * There must be an encoding function for void results so svc_process 251 * There must be an encoding function for void results so svc_process
246 * will work properly. 252 * will work properly.
247 */ 253 */
248static int nfsaclsvc_encode_voidres(struct svc_rqst *rqstp, __be32 *p, void *dummy) 254static int nfsaclsvc_encode_voidres(struct svc_rqst *rqstp, __be32 *p)
249{ 255{
250 return xdr_ressize_check(rqstp, p); 256 return xdr_ressize_check(rqstp, p);
251} 257}
252 258
253/* GETACL */ 259/* GETACL */
254static int nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p, 260static int nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p)
255 struct nfsd3_getaclres *resp)
256{ 261{
262 struct nfsd3_getaclres *resp = rqstp->rq_resp;
257 struct dentry *dentry = resp->fh.fh_dentry; 263 struct dentry *dentry = resp->fh.fh_dentry;
258 struct inode *inode; 264 struct inode *inode;
259 struct kvec *head = rqstp->rq_res.head; 265 struct kvec *head = rqstp->rq_res.head;
@@ -296,17 +302,19 @@ static int nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p,
296 return (n > 0); 302 return (n > 0);
297} 303}
298 304
299static int nfsaclsvc_encode_attrstatres(struct svc_rqst *rqstp, __be32 *p, 305static int nfsaclsvc_encode_attrstatres(struct svc_rqst *rqstp, __be32 *p)
300 struct nfsd_attrstat *resp)
301{ 306{
307 struct nfsd_attrstat *resp = rqstp->rq_resp;
308
302 p = nfs2svc_encode_fattr(rqstp, p, &resp->fh, &resp->stat); 309 p = nfs2svc_encode_fattr(rqstp, p, &resp->fh, &resp->stat);
303 return xdr_ressize_check(rqstp, p); 310 return xdr_ressize_check(rqstp, p);
304} 311}
305 312
306/* ACCESS */ 313/* ACCESS */
307static int nfsaclsvc_encode_accessres(struct svc_rqst *rqstp, __be32 *p, 314static int nfsaclsvc_encode_accessres(struct svc_rqst *rqstp, __be32 *p)
308 struct nfsd3_accessres *resp)
309{ 315{
316 struct nfsd3_accessres *resp = rqstp->rq_resp;
317
310 p = nfs2svc_encode_fattr(rqstp, p, &resp->fh, &resp->stat); 318 p = nfs2svc_encode_fattr(rqstp, p, &resp->fh, &resp->stat);
311 *p++ = htonl(resp->access); 319 *p++ = htonl(resp->access);
312 return xdr_ressize_check(rqstp, p); 320 return xdr_ressize_check(rqstp, p);
@@ -315,27 +323,27 @@ static int nfsaclsvc_encode_accessres(struct svc_rqst *rqstp, __be32 *p,
315/* 323/*
316 * XDR release functions 324 * XDR release functions
317 */ 325 */
318static int nfsaclsvc_release_getacl(struct svc_rqst *rqstp, __be32 *p, 326static void nfsaclsvc_release_getacl(struct svc_rqst *rqstp)
319 struct nfsd3_getaclres *resp)
320{ 327{
328 struct nfsd3_getaclres *resp = rqstp->rq_resp;
329
321 fh_put(&resp->fh); 330 fh_put(&resp->fh);
322 posix_acl_release(resp->acl_access); 331 posix_acl_release(resp->acl_access);
323 posix_acl_release(resp->acl_default); 332 posix_acl_release(resp->acl_default);
324 return 1;
325} 333}
326 334
327static int nfsaclsvc_release_attrstat(struct svc_rqst *rqstp, __be32 *p, 335static void nfsaclsvc_release_attrstat(struct svc_rqst *rqstp)
328 struct nfsd_attrstat *resp)
329{ 336{
337 struct nfsd_attrstat *resp = rqstp->rq_resp;
338
330 fh_put(&resp->fh); 339 fh_put(&resp->fh);
331 return 1;
332} 340}
333 341
334static int nfsaclsvc_release_access(struct svc_rqst *rqstp, __be32 *p, 342static void nfsaclsvc_release_access(struct svc_rqst *rqstp)
335 struct nfsd3_accessres *resp)
336{ 343{
337 fh_put(&resp->fh); 344 struct nfsd3_accessres *resp = rqstp->rq_resp;
338 return 1; 345
346 fh_put(&resp->fh);
339} 347}
340 348
341#define nfsaclsvc_decode_voidargs NULL 349#define nfsaclsvc_decode_voidargs NULL
@@ -345,24 +353,24 @@ static int nfsaclsvc_release_access(struct svc_rqst *rqstp, __be32 *p,
345#define nfsd3_voidres nfsd3_voidargs 353#define nfsd3_voidres nfsd3_voidargs
346struct nfsd3_voidargs { int dummy; }; 354struct nfsd3_voidargs { int dummy; };
347 355
348#define PROC(name, argt, rest, relt, cache, respsize) \ 356#define PROC(name, argt, rest, relt, cache, respsize) \
349 { (svc_procfunc) nfsacld_proc_##name, \ 357{ \
350 (kxdrproc_t) nfsaclsvc_decode_##argt##args, \ 358 .pc_func = nfsacld_proc_##name, \
351 (kxdrproc_t) nfsaclsvc_encode_##rest##res, \ 359 .pc_decode = nfsaclsvc_decode_##argt##args, \
352 (kxdrproc_t) nfsaclsvc_release_##relt, \ 360 .pc_encode = nfsaclsvc_encode_##rest##res, \
353 sizeof(struct nfsd3_##argt##args), \ 361 .pc_release = nfsaclsvc_release_##relt, \
354 sizeof(struct nfsd3_##rest##res), \ 362 .pc_argsize = sizeof(struct nfsd3_##argt##args), \
355 0, \ 363 .pc_ressize = sizeof(struct nfsd3_##rest##res), \
356 cache, \ 364 .pc_cachetype = cache, \
357 respsize, \ 365 .pc_xdrressize = respsize, \
358 } 366}
359 367
360#define ST 1 /* status*/ 368#define ST 1 /* status*/
361#define AT 21 /* attributes */ 369#define AT 21 /* attributes */
362#define pAT (1+AT) /* post attributes - conditional */ 370#define pAT (1+AT) /* post attributes - conditional */
363#define ACL (1+NFS_ACL_MAX_ENTRIES*3) /* Access Control List */ 371#define ACL (1+NFS_ACL_MAX_ENTRIES*3) /* Access Control List */
364 372
365static struct svc_procedure nfsd_acl_procedures2[] = { 373static const struct svc_procedure nfsd_acl_procedures2[] = {
366 PROC(null, void, void, void, RC_NOCACHE, ST), 374 PROC(null, void, void, void, RC_NOCACHE, ST),
367 PROC(getacl, getacl, getacl, getacl, RC_NOCACHE, ST+1+2*(1+ACL)), 375 PROC(getacl, getacl, getacl, getacl, RC_NOCACHE, ST+1+2*(1+ACL)),
368 PROC(setacl, setacl, attrstat, attrstat, RC_NOCACHE, ST+AT), 376 PROC(setacl, setacl, attrstat, attrstat, RC_NOCACHE, ST+AT),
@@ -370,10 +378,12 @@ static struct svc_procedure nfsd_acl_procedures2[] = {
370 PROC(access, access, access, access, RC_NOCACHE, ST+AT+1), 378 PROC(access, access, access, access, RC_NOCACHE, ST+AT+1),
371}; 379};
372 380
373struct svc_version nfsd_acl_version2 = { 381static unsigned int nfsd_acl_count2[ARRAY_SIZE(nfsd_acl_procedures2)];
374 .vs_vers = 2, 382const struct svc_version nfsd_acl_version2 = {
375 .vs_nproc = 5, 383 .vs_vers = 2,
376 .vs_proc = nfsd_acl_procedures2, 384 .vs_nproc = 5,
377 .vs_dispatch = nfsd_dispatch, 385 .vs_proc = nfsd_acl_procedures2,
378 .vs_xdrsize = NFS3_SVC_XDRSIZE, 386 .vs_count = nfsd_acl_count2,
387 .vs_dispatch = nfsd_dispatch,
388 .vs_xdrsize = NFS3_SVC_XDRSIZE,
379}; 389};
diff --git a/fs/nfsd/nfs3acl.c b/fs/nfsd/nfs3acl.c
index dcb5f79076c0..01976529f042 100644
--- a/fs/nfsd/nfs3acl.c
+++ b/fs/nfsd/nfs3acl.c
@@ -18,7 +18,7 @@
18 * NULL call. 18 * NULL call.
19 */ 19 */
20static __be32 20static __be32
21nfsd3_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) 21nfsd3_proc_null(struct svc_rqst *rqstp)
22{ 22{
23 return nfs_ok; 23 return nfs_ok;
24} 24}
@@ -26,9 +26,10 @@ nfsd3_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)
26/* 26/*
27 * Get the Access and/or Default ACL of a file. 27 * Get the Access and/or Default ACL of a file.
28 */ 28 */
29static __be32 nfsd3_proc_getacl(struct svc_rqst * rqstp, 29static __be32 nfsd3_proc_getacl(struct svc_rqst *rqstp)
30 struct nfsd3_getaclargs *argp, struct nfsd3_getaclres *resp)
31{ 30{
31 struct nfsd3_getaclargs *argp = rqstp->rq_argp;
32 struct nfsd3_getaclres *resp = rqstp->rq_resp;
32 struct posix_acl *acl; 33 struct posix_acl *acl;
33 struct inode *inode; 34 struct inode *inode;
34 svc_fh *fh; 35 svc_fh *fh;
@@ -80,10 +81,10 @@ fail:
80/* 81/*
81 * Set the Access and/or Default ACL of a file. 82 * Set the Access and/or Default ACL of a file.
82 */ 83 */
83static __be32 nfsd3_proc_setacl(struct svc_rqst * rqstp, 84static __be32 nfsd3_proc_setacl(struct svc_rqst *rqstp)
84 struct nfsd3_setaclargs *argp,
85 struct nfsd3_attrstat *resp)
86{ 85{
86 struct nfsd3_setaclargs *argp = rqstp->rq_argp;
87 struct nfsd3_attrstat *resp = rqstp->rq_resp;
87 struct inode *inode; 88 struct inode *inode;
88 svc_fh *fh; 89 svc_fh *fh;
89 __be32 nfserr = 0; 90 __be32 nfserr = 0;
@@ -123,9 +124,10 @@ out:
123/* 124/*
124 * XDR decode functions 125 * XDR decode functions
125 */ 126 */
126static int nfs3svc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p, 127static int nfs3svc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p)
127 struct nfsd3_getaclargs *args)
128{ 128{
129 struct nfsd3_getaclargs *args = rqstp->rq_argp;
130
129 p = nfs3svc_decode_fh(p, &args->fh); 131 p = nfs3svc_decode_fh(p, &args->fh);
130 if (!p) 132 if (!p)
131 return 0; 133 return 0;
@@ -135,9 +137,9 @@ static int nfs3svc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p,
135} 137}
136 138
137 139
138static int nfs3svc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p, 140static int nfs3svc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p)
139 struct nfsd3_setaclargs *args)
140{ 141{
142 struct nfsd3_setaclargs *args = rqstp->rq_argp;
141 struct kvec *head = rqstp->rq_arg.head; 143 struct kvec *head = rqstp->rq_arg.head;
142 unsigned int base; 144 unsigned int base;
143 int n; 145 int n;
@@ -166,9 +168,9 @@ static int nfs3svc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p,
166 */ 168 */
167 169
168/* GETACL */ 170/* GETACL */
169static int nfs3svc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p, 171static int nfs3svc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p)
170 struct nfsd3_getaclres *resp)
171{ 172{
173 struct nfsd3_getaclres *resp = rqstp->rq_resp;
172 struct dentry *dentry = resp->fh.fh_dentry; 174 struct dentry *dentry = resp->fh.fh_dentry;
173 175
174 p = nfs3svc_encode_post_op_attr(rqstp, p, &resp->fh); 176 p = nfs3svc_encode_post_op_attr(rqstp, p, &resp->fh);
@@ -211,9 +213,10 @@ static int nfs3svc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p,
211} 213}
212 214
213/* SETACL */ 215/* SETACL */
214static int nfs3svc_encode_setaclres(struct svc_rqst *rqstp, __be32 *p, 216static int nfs3svc_encode_setaclres(struct svc_rqst *rqstp, __be32 *p)
215 struct nfsd3_attrstat *resp)
216{ 217{
218 struct nfsd3_attrstat *resp = rqstp->rq_resp;
219
217 p = nfs3svc_encode_post_op_attr(rqstp, p, &resp->fh); 220 p = nfs3svc_encode_post_op_attr(rqstp, p, &resp->fh);
218 221
219 return xdr_ressize_check(rqstp, p); 222 return xdr_ressize_check(rqstp, p);
@@ -222,13 +225,13 @@ static int nfs3svc_encode_setaclres(struct svc_rqst *rqstp, __be32 *p,
222/* 225/*
223 * XDR release functions 226 * XDR release functions
224 */ 227 */
225static int nfs3svc_release_getacl(struct svc_rqst *rqstp, __be32 *p, 228static void nfs3svc_release_getacl(struct svc_rqst *rqstp)
226 struct nfsd3_getaclres *resp)
227{ 229{
230 struct nfsd3_getaclres *resp = rqstp->rq_resp;
231
228 fh_put(&resp->fh); 232 fh_put(&resp->fh);
229 posix_acl_release(resp->acl_access); 233 posix_acl_release(resp->acl_access);
230 posix_acl_release(resp->acl_default); 234 posix_acl_release(resp->acl_default);
231 return 1;
232} 235}
233 236
234#define nfs3svc_decode_voidargs NULL 237#define nfs3svc_decode_voidargs NULL
@@ -237,34 +240,36 @@ static int nfs3svc_release_getacl(struct svc_rqst *rqstp, __be32 *p,
237#define nfsd3_voidres nfsd3_voidargs 240#define nfsd3_voidres nfsd3_voidargs
238struct nfsd3_voidargs { int dummy; }; 241struct nfsd3_voidargs { int dummy; };
239 242
240#define PROC(name, argt, rest, relt, cache, respsize) \ 243#define PROC(name, argt, rest, relt, cache, respsize) \
241 { (svc_procfunc) nfsd3_proc_##name, \ 244{ \
242 (kxdrproc_t) nfs3svc_decode_##argt##args, \ 245 .pc_func = nfsd3_proc_##name, \
243 (kxdrproc_t) nfs3svc_encode_##rest##res, \ 246 .pc_decode = nfs3svc_decode_##argt##args, \
244 (kxdrproc_t) nfs3svc_release_##relt, \ 247 .pc_encode = nfs3svc_encode_##rest##res, \
245 sizeof(struct nfsd3_##argt##args), \ 248 .pc_release = nfs3svc_release_##relt, \
246 sizeof(struct nfsd3_##rest##res), \ 249 .pc_argsize = sizeof(struct nfsd3_##argt##args), \
247 0, \ 250 .pc_ressize = sizeof(struct nfsd3_##rest##res), \
248 cache, \ 251 .pc_cachetype = cache, \
249 respsize, \ 252 .pc_xdrressize = respsize, \
250 } 253}
251 254
252#define ST 1 /* status*/ 255#define ST 1 /* status*/
253#define AT 21 /* attributes */ 256#define AT 21 /* attributes */
254#define pAT (1+AT) /* post attributes - conditional */ 257#define pAT (1+AT) /* post attributes - conditional */
255#define ACL (1+NFS_ACL_MAX_ENTRIES*3) /* Access Control List */ 258#define ACL (1+NFS_ACL_MAX_ENTRIES*3) /* Access Control List */
256 259
257static struct svc_procedure nfsd_acl_procedures3[] = { 260static const struct svc_procedure nfsd_acl_procedures3[] = {
258 PROC(null, void, void, void, RC_NOCACHE, ST), 261 PROC(null, void, void, void, RC_NOCACHE, ST),
259 PROC(getacl, getacl, getacl, getacl, RC_NOCACHE, ST+1+2*(1+ACL)), 262 PROC(getacl, getacl, getacl, getacl, RC_NOCACHE, ST+1+2*(1+ACL)),
260 PROC(setacl, setacl, setacl, fhandle, RC_NOCACHE, ST+pAT), 263 PROC(setacl, setacl, setacl, fhandle, RC_NOCACHE, ST+pAT),
261}; 264};
262 265
263struct svc_version nfsd_acl_version3 = { 266static unsigned int nfsd_acl_count3[ARRAY_SIZE(nfsd_acl_procedures3)];
264 .vs_vers = 3, 267const struct svc_version nfsd_acl_version3 = {
265 .vs_nproc = 3, 268 .vs_vers = 3,
266 .vs_proc = nfsd_acl_procedures3, 269 .vs_nproc = 3,
267 .vs_dispatch = nfsd_dispatch, 270 .vs_proc = nfsd_acl_procedures3,
268 .vs_xdrsize = NFS3_SVC_XDRSIZE, 271 .vs_count = nfsd_acl_count3,
272 .vs_dispatch = nfsd_dispatch,
273 .vs_xdrsize = NFS3_SVC_XDRSIZE,
269}; 274};
270 275
diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
index 045c9081eabe..2cb56a0d6625 100644
--- a/fs/nfsd/nfs3proc.c
+++ b/fs/nfsd/nfs3proc.c
@@ -31,7 +31,7 @@ static int nfs3_ftypes[] = {
31 * NULL call. 31 * NULL call.
32 */ 32 */
33static __be32 33static __be32
34nfsd3_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) 34nfsd3_proc_null(struct svc_rqst *rqstp)
35{ 35{
36 return nfs_ok; 36 return nfs_ok;
37} 37}
@@ -40,9 +40,10 @@ nfsd3_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)
40 * Get a file's attributes 40 * Get a file's attributes
41 */ 41 */
42static __be32 42static __be32
43nfsd3_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp, 43nfsd3_proc_getattr(struct svc_rqst *rqstp)
44 struct nfsd3_attrstat *resp)
45{ 44{
45 struct nfsd_fhandle *argp = rqstp->rq_argp;
46 struct nfsd3_attrstat *resp = rqstp->rq_resp;
46 __be32 nfserr; 47 __be32 nfserr;
47 48
48 dprintk("nfsd: GETATTR(3) %s\n", 49 dprintk("nfsd: GETATTR(3) %s\n",
@@ -63,9 +64,10 @@ nfsd3_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp,
63 * Set a file's attributes 64 * Set a file's attributes
64 */ 65 */
65static __be32 66static __be32
66nfsd3_proc_setattr(struct svc_rqst *rqstp, struct nfsd3_sattrargs *argp, 67nfsd3_proc_setattr(struct svc_rqst *rqstp)
67 struct nfsd3_attrstat *resp)
68{ 68{
69 struct nfsd3_sattrargs *argp = rqstp->rq_argp;
70 struct nfsd3_attrstat *resp = rqstp->rq_resp;
69 __be32 nfserr; 71 __be32 nfserr;
70 72
71 dprintk("nfsd: SETATTR(3) %s\n", 73 dprintk("nfsd: SETATTR(3) %s\n",
@@ -81,9 +83,10 @@ nfsd3_proc_setattr(struct svc_rqst *rqstp, struct nfsd3_sattrargs *argp,
81 * Look up a path name component 83 * Look up a path name component
82 */ 84 */
83static __be32 85static __be32
84nfsd3_proc_lookup(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp, 86nfsd3_proc_lookup(struct svc_rqst *rqstp)
85 struct nfsd3_diropres *resp)
86{ 87{
88 struct nfsd3_diropargs *argp = rqstp->rq_argp;
89 struct nfsd3_diropres *resp = rqstp->rq_resp;
87 __be32 nfserr; 90 __be32 nfserr;
88 91
89 dprintk("nfsd: LOOKUP(3) %s %.*s\n", 92 dprintk("nfsd: LOOKUP(3) %s %.*s\n",
@@ -105,9 +108,10 @@ nfsd3_proc_lookup(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp,
105 * Check file access 108 * Check file access
106 */ 109 */
107static __be32 110static __be32
108nfsd3_proc_access(struct svc_rqst *rqstp, struct nfsd3_accessargs *argp, 111nfsd3_proc_access(struct svc_rqst *rqstp)
109 struct nfsd3_accessres *resp)
110{ 112{
113 struct nfsd3_accessargs *argp = rqstp->rq_argp;
114 struct nfsd3_accessres *resp = rqstp->rq_resp;
111 __be32 nfserr; 115 __be32 nfserr;
112 116
113 dprintk("nfsd: ACCESS(3) %s 0x%x\n", 117 dprintk("nfsd: ACCESS(3) %s 0x%x\n",
@@ -124,9 +128,10 @@ nfsd3_proc_access(struct svc_rqst *rqstp, struct nfsd3_accessargs *argp,
124 * Read a symlink. 128 * Read a symlink.
125 */ 129 */
126static __be32 130static __be32
127nfsd3_proc_readlink(struct svc_rqst *rqstp, struct nfsd3_readlinkargs *argp, 131nfsd3_proc_readlink(struct svc_rqst *rqstp)
128 struct nfsd3_readlinkres *resp)
129{ 132{
133 struct nfsd3_readlinkargs *argp = rqstp->rq_argp;
134 struct nfsd3_readlinkres *resp = rqstp->rq_resp;
130 __be32 nfserr; 135 __be32 nfserr;
131 136
132 dprintk("nfsd: READLINK(3) %s\n", SVCFH_fmt(&argp->fh)); 137 dprintk("nfsd: READLINK(3) %s\n", SVCFH_fmt(&argp->fh));
@@ -142,9 +147,10 @@ nfsd3_proc_readlink(struct svc_rqst *rqstp, struct nfsd3_readlinkargs *argp,
142 * Read a portion of a file. 147 * Read a portion of a file.
143 */ 148 */
144static __be32 149static __be32
145nfsd3_proc_read(struct svc_rqst *rqstp, struct nfsd3_readargs *argp, 150nfsd3_proc_read(struct svc_rqst *rqstp)
146 struct nfsd3_readres *resp)
147{ 151{
152 struct nfsd3_readargs *argp = rqstp->rq_argp;
153 struct nfsd3_readres *resp = rqstp->rq_resp;
148 __be32 nfserr; 154 __be32 nfserr;
149 u32 max_blocksize = svc_max_payload(rqstp); 155 u32 max_blocksize = svc_max_payload(rqstp);
150 unsigned long cnt = min(argp->count, max_blocksize); 156 unsigned long cnt = min(argp->count, max_blocksize);
@@ -179,9 +185,10 @@ nfsd3_proc_read(struct svc_rqst *rqstp, struct nfsd3_readargs *argp,
179 * Write data to a file 185 * Write data to a file
180 */ 186 */
181static __be32 187static __be32
182nfsd3_proc_write(struct svc_rqst *rqstp, struct nfsd3_writeargs *argp, 188nfsd3_proc_write(struct svc_rqst *rqstp)
183 struct nfsd3_writeres *resp)
184{ 189{
190 struct nfsd3_writeargs *argp = rqstp->rq_argp;
191 struct nfsd3_writeres *resp = rqstp->rq_resp;
185 __be32 nfserr; 192 __be32 nfserr;
186 unsigned long cnt = argp->len; 193 unsigned long cnt = argp->len;
187 194
@@ -206,9 +213,10 @@ nfsd3_proc_write(struct svc_rqst *rqstp, struct nfsd3_writeargs *argp,
206 * first reports about SunOS compatibility problems start to pour in... 213 * first reports about SunOS compatibility problems start to pour in...
207 */ 214 */
208static __be32 215static __be32
209nfsd3_proc_create(struct svc_rqst *rqstp, struct nfsd3_createargs *argp, 216nfsd3_proc_create(struct svc_rqst *rqstp)
210 struct nfsd3_diropres *resp)
211{ 217{
218 struct nfsd3_createargs *argp = rqstp->rq_argp;
219 struct nfsd3_diropres *resp = rqstp->rq_resp;
212 svc_fh *dirfhp, *newfhp = NULL; 220 svc_fh *dirfhp, *newfhp = NULL;
213 struct iattr *attr; 221 struct iattr *attr;
214 __be32 nfserr; 222 __be32 nfserr;
@@ -243,9 +251,10 @@ nfsd3_proc_create(struct svc_rqst *rqstp, struct nfsd3_createargs *argp,
243 * Make directory. This operation is not idempotent. 251 * Make directory. This operation is not idempotent.
244 */ 252 */
245static __be32 253static __be32
246nfsd3_proc_mkdir(struct svc_rqst *rqstp, struct nfsd3_createargs *argp, 254nfsd3_proc_mkdir(struct svc_rqst *rqstp)
247 struct nfsd3_diropres *resp)
248{ 255{
256 struct nfsd3_createargs *argp = rqstp->rq_argp;
257 struct nfsd3_diropres *resp = rqstp->rq_resp;
249 __be32 nfserr; 258 __be32 nfserr;
250 259
251 dprintk("nfsd: MKDIR(3) %s %.*s\n", 260 dprintk("nfsd: MKDIR(3) %s %.*s\n",
@@ -263,9 +272,10 @@ nfsd3_proc_mkdir(struct svc_rqst *rqstp, struct nfsd3_createargs *argp,
263} 272}
264 273
265static __be32 274static __be32
266nfsd3_proc_symlink(struct svc_rqst *rqstp, struct nfsd3_symlinkargs *argp, 275nfsd3_proc_symlink(struct svc_rqst *rqstp)
267 struct nfsd3_diropres *resp)
268{ 276{
277 struct nfsd3_symlinkargs *argp = rqstp->rq_argp;
278 struct nfsd3_diropres *resp = rqstp->rq_resp;
269 __be32 nfserr; 279 __be32 nfserr;
270 280
271 dprintk("nfsd: SYMLINK(3) %s %.*s -> %.*s\n", 281 dprintk("nfsd: SYMLINK(3) %s %.*s -> %.*s\n",
@@ -284,9 +294,10 @@ nfsd3_proc_symlink(struct svc_rqst *rqstp, struct nfsd3_symlinkargs *argp,
284 * Make socket/fifo/device. 294 * Make socket/fifo/device.
285 */ 295 */
286static __be32 296static __be32
287nfsd3_proc_mknod(struct svc_rqst *rqstp, struct nfsd3_mknodargs *argp, 297nfsd3_proc_mknod(struct svc_rqst *rqstp)
288 struct nfsd3_diropres *resp)
289{ 298{
299 struct nfsd3_mknodargs *argp = rqstp->rq_argp;
300 struct nfsd3_diropres *resp = rqstp->rq_resp;
290 __be32 nfserr; 301 __be32 nfserr;
291 int type; 302 int type;
292 dev_t rdev = 0; 303 dev_t rdev = 0;
@@ -321,9 +332,10 @@ nfsd3_proc_mknod(struct svc_rqst *rqstp, struct nfsd3_mknodargs *argp,
321 * Remove file/fifo/socket etc. 332 * Remove file/fifo/socket etc.
322 */ 333 */
323static __be32 334static __be32
324nfsd3_proc_remove(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp, 335nfsd3_proc_remove(struct svc_rqst *rqstp)
325 struct nfsd3_attrstat *resp)
326{ 336{
337 struct nfsd3_diropargs *argp = rqstp->rq_argp;
338 struct nfsd3_attrstat *resp = rqstp->rq_resp;
327 __be32 nfserr; 339 __be32 nfserr;
328 340
329 dprintk("nfsd: REMOVE(3) %s %.*s\n", 341 dprintk("nfsd: REMOVE(3) %s %.*s\n",
@@ -342,9 +354,10 @@ nfsd3_proc_remove(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp,
342 * Remove a directory 354 * Remove a directory
343 */ 355 */
344static __be32 356static __be32
345nfsd3_proc_rmdir(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp, 357nfsd3_proc_rmdir(struct svc_rqst *rqstp)
346 struct nfsd3_attrstat *resp)
347{ 358{
359 struct nfsd3_diropargs *argp = rqstp->rq_argp;
360 struct nfsd3_attrstat *resp = rqstp->rq_resp;
348 __be32 nfserr; 361 __be32 nfserr;
349 362
350 dprintk("nfsd: RMDIR(3) %s %.*s\n", 363 dprintk("nfsd: RMDIR(3) %s %.*s\n",
@@ -359,9 +372,10 @@ nfsd3_proc_rmdir(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp,
359} 372}
360 373
361static __be32 374static __be32
362nfsd3_proc_rename(struct svc_rqst *rqstp, struct nfsd3_renameargs *argp, 375nfsd3_proc_rename(struct svc_rqst *rqstp)
363 struct nfsd3_renameres *resp)
364{ 376{
377 struct nfsd3_renameargs *argp = rqstp->rq_argp;
378 struct nfsd3_renameres *resp = rqstp->rq_resp;
365 __be32 nfserr; 379 __be32 nfserr;
366 380
367 dprintk("nfsd: RENAME(3) %s %.*s ->\n", 381 dprintk("nfsd: RENAME(3) %s %.*s ->\n",
@@ -381,9 +395,10 @@ nfsd3_proc_rename(struct svc_rqst *rqstp, struct nfsd3_renameargs *argp,
381} 395}
382 396
383static __be32 397static __be32
384nfsd3_proc_link(struct svc_rqst *rqstp, struct nfsd3_linkargs *argp, 398nfsd3_proc_link(struct svc_rqst *rqstp)
385 struct nfsd3_linkres *resp)
386{ 399{
400 struct nfsd3_linkargs *argp = rqstp->rq_argp;
401 struct nfsd3_linkres *resp = rqstp->rq_resp;
387 __be32 nfserr; 402 __be32 nfserr;
388 403
389 dprintk("nfsd: LINK(3) %s ->\n", 404 dprintk("nfsd: LINK(3) %s ->\n",
@@ -404,9 +419,10 @@ nfsd3_proc_link(struct svc_rqst *rqstp, struct nfsd3_linkargs *argp,
404 * Read a portion of a directory. 419 * Read a portion of a directory.
405 */ 420 */
406static __be32 421static __be32
407nfsd3_proc_readdir(struct svc_rqst *rqstp, struct nfsd3_readdirargs *argp, 422nfsd3_proc_readdir(struct svc_rqst *rqstp)
408 struct nfsd3_readdirres *resp)
409{ 423{
424 struct nfsd3_readdirargs *argp = rqstp->rq_argp;
425 struct nfsd3_readdirres *resp = rqstp->rq_resp;
410 __be32 nfserr; 426 __be32 nfserr;
411 int count; 427 int count;
412 428
@@ -440,9 +456,10 @@ nfsd3_proc_readdir(struct svc_rqst *rqstp, struct nfsd3_readdirargs *argp,
440 * For now, we choose to ignore the dircount parameter. 456 * For now, we choose to ignore the dircount parameter.
441 */ 457 */
442static __be32 458static __be32
443nfsd3_proc_readdirplus(struct svc_rqst *rqstp, struct nfsd3_readdirargs *argp, 459nfsd3_proc_readdirplus(struct svc_rqst *rqstp)
444 struct nfsd3_readdirres *resp)
445{ 460{
461 struct nfsd3_readdirargs *argp = rqstp->rq_argp;
462 struct nfsd3_readdirres *resp = rqstp->rq_resp;
446 __be32 nfserr; 463 __be32 nfserr;
447 int count = 0; 464 int count = 0;
448 loff_t offset; 465 loff_t offset;
@@ -507,9 +524,10 @@ nfsd3_proc_readdirplus(struct svc_rqst *rqstp, struct nfsd3_readdirargs *argp,
507 * Get file system stats 524 * Get file system stats
508 */ 525 */
509static __be32 526static __be32
510nfsd3_proc_fsstat(struct svc_rqst * rqstp, struct nfsd_fhandle *argp, 527nfsd3_proc_fsstat(struct svc_rqst *rqstp)
511 struct nfsd3_fsstatres *resp)
512{ 528{
529 struct nfsd_fhandle *argp = rqstp->rq_argp;
530 struct nfsd3_fsstatres *resp = rqstp->rq_resp;
513 __be32 nfserr; 531 __be32 nfserr;
514 532
515 dprintk("nfsd: FSSTAT(3) %s\n", 533 dprintk("nfsd: FSSTAT(3) %s\n",
@@ -524,9 +542,10 @@ nfsd3_proc_fsstat(struct svc_rqst * rqstp, struct nfsd_fhandle *argp,
524 * Get file system info 542 * Get file system info
525 */ 543 */
526static __be32 544static __be32
527nfsd3_proc_fsinfo(struct svc_rqst * rqstp, struct nfsd_fhandle *argp, 545nfsd3_proc_fsinfo(struct svc_rqst *rqstp)
528 struct nfsd3_fsinfores *resp)
529{ 546{
547 struct nfsd_fhandle *argp = rqstp->rq_argp;
548 struct nfsd3_fsinfores *resp = rqstp->rq_resp;
530 __be32 nfserr; 549 __be32 nfserr;
531 u32 max_blocksize = svc_max_payload(rqstp); 550 u32 max_blocksize = svc_max_payload(rqstp);
532 551
@@ -567,9 +586,10 @@ nfsd3_proc_fsinfo(struct svc_rqst * rqstp, struct nfsd_fhandle *argp,
567 * Get pathconf info for the specified file 586 * Get pathconf info for the specified file
568 */ 587 */
569static __be32 588static __be32
570nfsd3_proc_pathconf(struct svc_rqst * rqstp, struct nfsd_fhandle *argp, 589nfsd3_proc_pathconf(struct svc_rqst *rqstp)
571 struct nfsd3_pathconfres *resp)
572{ 590{
591 struct nfsd_fhandle *argp = rqstp->rq_argp;
592 struct nfsd3_pathconfres *resp = rqstp->rq_resp;
573 __be32 nfserr; 593 __be32 nfserr;
574 594
575 dprintk("nfsd: PATHCONF(3) %s\n", 595 dprintk("nfsd: PATHCONF(3) %s\n",
@@ -610,9 +630,10 @@ nfsd3_proc_pathconf(struct svc_rqst * rqstp, struct nfsd_fhandle *argp,
610 * Commit a file (range) to stable storage. 630 * Commit a file (range) to stable storage.
611 */ 631 */
612static __be32 632static __be32
613nfsd3_proc_commit(struct svc_rqst * rqstp, struct nfsd3_commitargs *argp, 633nfsd3_proc_commit(struct svc_rqst *rqstp)
614 struct nfsd3_commitres *resp)
615{ 634{
635 struct nfsd3_commitargs *argp = rqstp->rq_argp;
636 struct nfsd3_commitres *resp = rqstp->rq_resp;
616 __be32 nfserr; 637 __be32 nfserr;
617 638
618 dprintk("nfsd: COMMIT(3) %s %u@%Lu\n", 639 dprintk("nfsd: COMMIT(3) %s %u@%Lu\n",
@@ -647,233 +668,221 @@ nfsd3_proc_commit(struct svc_rqst * rqstp, struct nfsd3_commitargs *argp,
647#define nfsd3_voidres nfsd3_voidargs 668#define nfsd3_voidres nfsd3_voidargs
648struct nfsd3_voidargs { int dummy; }; 669struct nfsd3_voidargs { int dummy; };
649 670
650#define PROC(name, argt, rest, relt, cache, respsize) \
651 { (svc_procfunc) nfsd3_proc_##name, \
652 (kxdrproc_t) nfs3svc_decode_##argt##args, \
653 (kxdrproc_t) nfs3svc_encode_##rest##res, \
654 (kxdrproc_t) nfs3svc_release_##relt, \
655 sizeof(struct nfsd3_##argt##args), \
656 sizeof(struct nfsd3_##rest##res), \
657 0, \
658 cache, \
659 respsize, \
660 }
661
662#define ST 1 /* status*/ 671#define ST 1 /* status*/
663#define FH 17 /* filehandle with length */ 672#define FH 17 /* filehandle with length */
664#define AT 21 /* attributes */ 673#define AT 21 /* attributes */
665#define pAT (1+AT) /* post attributes - conditional */ 674#define pAT (1+AT) /* post attributes - conditional */
666#define WC (7+pAT) /* WCC attributes */ 675#define WC (7+pAT) /* WCC attributes */
667 676
668static struct svc_procedure nfsd_procedures3[22] = { 677static const struct svc_procedure nfsd_procedures3[22] = {
669 [NFS3PROC_NULL] = { 678 [NFS3PROC_NULL] = {
670 .pc_func = (svc_procfunc) nfsd3_proc_null, 679 .pc_func = nfsd3_proc_null,
671 .pc_encode = (kxdrproc_t) nfs3svc_encode_voidres, 680 .pc_encode = nfs3svc_encode_voidres,
672 .pc_argsize = sizeof(struct nfsd3_voidargs), 681 .pc_argsize = sizeof(struct nfsd3_voidargs),
673 .pc_ressize = sizeof(struct nfsd3_voidres), 682 .pc_ressize = sizeof(struct nfsd3_voidres),
674 .pc_cachetype = RC_NOCACHE, 683 .pc_cachetype = RC_NOCACHE,
675 .pc_xdrressize = ST, 684 .pc_xdrressize = ST,
676 }, 685 },
677 [NFS3PROC_GETATTR] = { 686 [NFS3PROC_GETATTR] = {
678 .pc_func = (svc_procfunc) nfsd3_proc_getattr, 687 .pc_func = nfsd3_proc_getattr,
679 .pc_decode = (kxdrproc_t) nfs3svc_decode_fhandleargs, 688 .pc_decode = nfs3svc_decode_fhandleargs,
680 .pc_encode = (kxdrproc_t) nfs3svc_encode_attrstatres, 689 .pc_encode = nfs3svc_encode_attrstatres,
681 .pc_release = (kxdrproc_t) nfs3svc_release_fhandle, 690 .pc_release = nfs3svc_release_fhandle,
682 .pc_argsize = sizeof(struct nfsd3_fhandleargs), 691 .pc_argsize = sizeof(struct nfsd3_fhandleargs),
683 .pc_ressize = sizeof(struct nfsd3_attrstatres), 692 .pc_ressize = sizeof(struct nfsd3_attrstatres),
684 .pc_cachetype = RC_NOCACHE, 693 .pc_cachetype = RC_NOCACHE,
685 .pc_xdrressize = ST+AT, 694 .pc_xdrressize = ST+AT,
686 }, 695 },
687 [NFS3PROC_SETATTR] = { 696 [NFS3PROC_SETATTR] = {
688 .pc_func = (svc_procfunc) nfsd3_proc_setattr, 697 .pc_func = nfsd3_proc_setattr,
689 .pc_decode = (kxdrproc_t) nfs3svc_decode_sattrargs, 698 .pc_decode = nfs3svc_decode_sattrargs,
690 .pc_encode = (kxdrproc_t) nfs3svc_encode_wccstatres, 699 .pc_encode = nfs3svc_encode_wccstatres,
691 .pc_release = (kxdrproc_t) nfs3svc_release_fhandle, 700 .pc_release = nfs3svc_release_fhandle,
692 .pc_argsize = sizeof(struct nfsd3_sattrargs), 701 .pc_argsize = sizeof(struct nfsd3_sattrargs),
693 .pc_ressize = sizeof(struct nfsd3_wccstatres), 702 .pc_ressize = sizeof(struct nfsd3_wccstatres),
694 .pc_cachetype = RC_REPLBUFF, 703 .pc_cachetype = RC_REPLBUFF,
695 .pc_xdrressize = ST+WC, 704 .pc_xdrressize = ST+WC,
696 }, 705 },
697 [NFS3PROC_LOOKUP] = { 706 [NFS3PROC_LOOKUP] = {
698 .pc_func = (svc_procfunc) nfsd3_proc_lookup, 707 .pc_func = nfsd3_proc_lookup,
699 .pc_decode = (kxdrproc_t) nfs3svc_decode_diropargs, 708 .pc_decode = nfs3svc_decode_diropargs,
700 .pc_encode = (kxdrproc_t) nfs3svc_encode_diropres, 709 .pc_encode = nfs3svc_encode_diropres,
701 .pc_release = (kxdrproc_t) nfs3svc_release_fhandle2, 710 .pc_release = nfs3svc_release_fhandle2,
702 .pc_argsize = sizeof(struct nfsd3_diropargs), 711 .pc_argsize = sizeof(struct nfsd3_diropargs),
703 .pc_ressize = sizeof(struct nfsd3_diropres), 712 .pc_ressize = sizeof(struct nfsd3_diropres),
704 .pc_cachetype = RC_NOCACHE, 713 .pc_cachetype = RC_NOCACHE,
705 .pc_xdrressize = ST+FH+pAT+pAT, 714 .pc_xdrressize = ST+FH+pAT+pAT,
706 }, 715 },
707 [NFS3PROC_ACCESS] = { 716 [NFS3PROC_ACCESS] = {
708 .pc_func = (svc_procfunc) nfsd3_proc_access, 717 .pc_func = nfsd3_proc_access,
709 .pc_decode = (kxdrproc_t) nfs3svc_decode_accessargs, 718 .pc_decode = nfs3svc_decode_accessargs,
710 .pc_encode = (kxdrproc_t) nfs3svc_encode_accessres, 719 .pc_encode = nfs3svc_encode_accessres,
711 .pc_release = (kxdrproc_t) nfs3svc_release_fhandle, 720 .pc_release = nfs3svc_release_fhandle,
712 .pc_argsize = sizeof(struct nfsd3_accessargs), 721 .pc_argsize = sizeof(struct nfsd3_accessargs),
713 .pc_ressize = sizeof(struct nfsd3_accessres), 722 .pc_ressize = sizeof(struct nfsd3_accessres),
714 .pc_cachetype = RC_NOCACHE, 723 .pc_cachetype = RC_NOCACHE,
715 .pc_xdrressize = ST+pAT+1, 724 .pc_xdrressize = ST+pAT+1,
716 }, 725 },
717 [NFS3PROC_READLINK] = { 726 [NFS3PROC_READLINK] = {
718 .pc_func = (svc_procfunc) nfsd3_proc_readlink, 727 .pc_func = nfsd3_proc_readlink,
719 .pc_decode = (kxdrproc_t) nfs3svc_decode_readlinkargs, 728 .pc_decode = nfs3svc_decode_readlinkargs,
720 .pc_encode = (kxdrproc_t) nfs3svc_encode_readlinkres, 729 .pc_encode = nfs3svc_encode_readlinkres,
721 .pc_release = (kxdrproc_t) nfs3svc_release_fhandle, 730 .pc_release = nfs3svc_release_fhandle,
722 .pc_argsize = sizeof(struct nfsd3_readlinkargs), 731 .pc_argsize = sizeof(struct nfsd3_readlinkargs),
723 .pc_ressize = sizeof(struct nfsd3_readlinkres), 732 .pc_ressize = sizeof(struct nfsd3_readlinkres),
724 .pc_cachetype = RC_NOCACHE, 733 .pc_cachetype = RC_NOCACHE,
725 .pc_xdrressize = ST+pAT+1+NFS3_MAXPATHLEN/4, 734 .pc_xdrressize = ST+pAT+1+NFS3_MAXPATHLEN/4,
726 }, 735 },
727 [NFS3PROC_READ] = { 736 [NFS3PROC_READ] = {
728 .pc_func = (svc_procfunc) nfsd3_proc_read, 737 .pc_func = nfsd3_proc_read,
729 .pc_decode = (kxdrproc_t) nfs3svc_decode_readargs, 738 .pc_decode = nfs3svc_decode_readargs,
730 .pc_encode = (kxdrproc_t) nfs3svc_encode_readres, 739 .pc_encode = nfs3svc_encode_readres,
731 .pc_release = (kxdrproc_t) nfs3svc_release_fhandle, 740 .pc_release = nfs3svc_release_fhandle,
732 .pc_argsize = sizeof(struct nfsd3_readargs), 741 .pc_argsize = sizeof(struct nfsd3_readargs),
733 .pc_ressize = sizeof(struct nfsd3_readres), 742 .pc_ressize = sizeof(struct nfsd3_readres),
734 .pc_cachetype = RC_NOCACHE, 743 .pc_cachetype = RC_NOCACHE,
735 .pc_xdrressize = ST+pAT+4+NFSSVC_MAXBLKSIZE/4, 744 .pc_xdrressize = ST+pAT+4+NFSSVC_MAXBLKSIZE/4,
736 }, 745 },
737 [NFS3PROC_WRITE] = { 746 [NFS3PROC_WRITE] = {
738 .pc_func = (svc_procfunc) nfsd3_proc_write, 747 .pc_func = nfsd3_proc_write,
739 .pc_decode = (kxdrproc_t) nfs3svc_decode_writeargs, 748 .pc_decode = nfs3svc_decode_writeargs,
740 .pc_encode = (kxdrproc_t) nfs3svc_encode_writeres, 749 .pc_encode = nfs3svc_encode_writeres,
741 .pc_release = (kxdrproc_t) nfs3svc_release_fhandle, 750 .pc_release = nfs3svc_release_fhandle,
742 .pc_argsize = sizeof(struct nfsd3_writeargs), 751 .pc_argsize = sizeof(struct nfsd3_writeargs),
743 .pc_ressize = sizeof(struct nfsd3_writeres), 752 .pc_ressize = sizeof(struct nfsd3_writeres),
744 .pc_cachetype = RC_REPLBUFF, 753 .pc_cachetype = RC_REPLBUFF,
745 .pc_xdrressize = ST+WC+4, 754 .pc_xdrressize = ST+WC+4,
746 }, 755 },
747 [NFS3PROC_CREATE] = { 756 [NFS3PROC_CREATE] = {
748 .pc_func = (svc_procfunc) nfsd3_proc_create, 757 .pc_func = nfsd3_proc_create,
749 .pc_decode = (kxdrproc_t) nfs3svc_decode_createargs, 758 .pc_decode = nfs3svc_decode_createargs,
750 .pc_encode = (kxdrproc_t) nfs3svc_encode_createres, 759 .pc_encode = nfs3svc_encode_createres,
751 .pc_release = (kxdrproc_t) nfs3svc_release_fhandle2, 760 .pc_release = nfs3svc_release_fhandle2,
752 .pc_argsize = sizeof(struct nfsd3_createargs), 761 .pc_argsize = sizeof(struct nfsd3_createargs),
753 .pc_ressize = sizeof(struct nfsd3_createres), 762 .pc_ressize = sizeof(struct nfsd3_createres),
754 .pc_cachetype = RC_REPLBUFF, 763 .pc_cachetype = RC_REPLBUFF,
755 .pc_xdrressize = ST+(1+FH+pAT)+WC, 764 .pc_xdrressize = ST+(1+FH+pAT)+WC,
756 }, 765 },
757 [NFS3PROC_MKDIR] = { 766 [NFS3PROC_MKDIR] = {
758 .pc_func = (svc_procfunc) nfsd3_proc_mkdir, 767 .pc_func = nfsd3_proc_mkdir,
759 .pc_decode = (kxdrproc_t) nfs3svc_decode_mkdirargs, 768 .pc_decode = nfs3svc_decode_mkdirargs,
760 .pc_encode = (kxdrproc_t) nfs3svc_encode_createres, 769 .pc_encode = nfs3svc_encode_createres,
761 .pc_release = (kxdrproc_t) nfs3svc_release_fhandle2, 770 .pc_release = nfs3svc_release_fhandle2,
762 .pc_argsize = sizeof(struct nfsd3_mkdirargs), 771 .pc_argsize = sizeof(struct nfsd3_mkdirargs),
763 .pc_ressize = sizeof(struct nfsd3_createres), 772 .pc_ressize = sizeof(struct nfsd3_createres),
764 .pc_cachetype = RC_REPLBUFF, 773 .pc_cachetype = RC_REPLBUFF,
765 .pc_xdrressize = ST+(1+FH+pAT)+WC, 774 .pc_xdrressize = ST+(1+FH+pAT)+WC,
766 }, 775 },
767 [NFS3PROC_SYMLINK] = { 776 [NFS3PROC_SYMLINK] = {
768 .pc_func = (svc_procfunc) nfsd3_proc_symlink, 777 .pc_func = nfsd3_proc_symlink,
769 .pc_decode = (kxdrproc_t) nfs3svc_decode_symlinkargs, 778 .pc_decode = nfs3svc_decode_symlinkargs,
770 .pc_encode = (kxdrproc_t) nfs3svc_encode_createres, 779 .pc_encode = nfs3svc_encode_createres,
771 .pc_release = (kxdrproc_t) nfs3svc_release_fhandle2, 780 .pc_release = nfs3svc_release_fhandle2,
772 .pc_argsize = sizeof(struct nfsd3_symlinkargs), 781 .pc_argsize = sizeof(struct nfsd3_symlinkargs),
773 .pc_ressize = sizeof(struct nfsd3_createres), 782 .pc_ressize = sizeof(struct nfsd3_createres),
774 .pc_cachetype = RC_REPLBUFF, 783 .pc_cachetype = RC_REPLBUFF,
775 .pc_xdrressize = ST+(1+FH+pAT)+WC, 784 .pc_xdrressize = ST+(1+FH+pAT)+WC,
776 }, 785 },
777 [NFS3PROC_MKNOD] = { 786 [NFS3PROC_MKNOD] = {
778 .pc_func = (svc_procfunc) nfsd3_proc_mknod, 787 .pc_func = nfsd3_proc_mknod,
779 .pc_decode = (kxdrproc_t) nfs3svc_decode_mknodargs, 788 .pc_decode = nfs3svc_decode_mknodargs,
780 .pc_encode = (kxdrproc_t) nfs3svc_encode_createres, 789 .pc_encode = nfs3svc_encode_createres,
781 .pc_release = (kxdrproc_t) nfs3svc_release_fhandle2, 790 .pc_release = nfs3svc_release_fhandle2,
782 .pc_argsize = sizeof(struct nfsd3_mknodargs), 791 .pc_argsize = sizeof(struct nfsd3_mknodargs),
783 .pc_ressize = sizeof(struct nfsd3_createres), 792 .pc_ressize = sizeof(struct nfsd3_createres),
784 .pc_cachetype = RC_REPLBUFF, 793 .pc_cachetype = RC_REPLBUFF,
785 .pc_xdrressize = ST+(1+FH+pAT)+WC, 794 .pc_xdrressize = ST+(1+FH+pAT)+WC,
786 }, 795 },
787 [NFS3PROC_REMOVE] = { 796 [NFS3PROC_REMOVE] = {
788 .pc_func = (svc_procfunc) nfsd3_proc_remove, 797 .pc_func = nfsd3_proc_remove,
789 .pc_decode = (kxdrproc_t) nfs3svc_decode_diropargs, 798 .pc_decode = nfs3svc_decode_diropargs,
790 .pc_encode = (kxdrproc_t) nfs3svc_encode_wccstatres, 799 .pc_encode = nfs3svc_encode_wccstatres,
791 .pc_release = (kxdrproc_t) nfs3svc_release_fhandle, 800 .pc_release = nfs3svc_release_fhandle,
792 .pc_argsize = sizeof(struct nfsd3_diropargs), 801 .pc_argsize = sizeof(struct nfsd3_diropargs),
793 .pc_ressize = sizeof(struct nfsd3_wccstatres), 802 .pc_ressize = sizeof(struct nfsd3_wccstatres),
794 .pc_cachetype = RC_REPLBUFF, 803 .pc_cachetype = RC_REPLBUFF,
795 .pc_xdrressize = ST+WC, 804 .pc_xdrressize = ST+WC,
796 }, 805 },
797 [NFS3PROC_RMDIR] = { 806 [NFS3PROC_RMDIR] = {
798 .pc_func = (svc_procfunc) nfsd3_proc_rmdir, 807 .pc_func = nfsd3_proc_rmdir,
799 .pc_decode = (kxdrproc_t) nfs3svc_decode_diropargs, 808 .pc_decode = nfs3svc_decode_diropargs,
800 .pc_encode = (kxdrproc_t) nfs3svc_encode_wccstatres, 809 .pc_encode = nfs3svc_encode_wccstatres,
801 .pc_release = (kxdrproc_t) nfs3svc_release_fhandle, 810 .pc_release = nfs3svc_release_fhandle,
802 .pc_argsize = sizeof(struct nfsd3_diropargs), 811 .pc_argsize = sizeof(struct nfsd3_diropargs),
803 .pc_ressize = sizeof(struct nfsd3_wccstatres), 812 .pc_ressize = sizeof(struct nfsd3_wccstatres),
804 .pc_cachetype = RC_REPLBUFF, 813 .pc_cachetype = RC_REPLBUFF,
805 .pc_xdrressize = ST+WC, 814 .pc_xdrressize = ST+WC,
806 }, 815 },
807 [NFS3PROC_RENAME] = { 816 [NFS3PROC_RENAME] = {
808 .pc_func = (svc_procfunc) nfsd3_proc_rename, 817 .pc_func = nfsd3_proc_rename,
809 .pc_decode = (kxdrproc_t) nfs3svc_decode_renameargs, 818 .pc_decode = nfs3svc_decode_renameargs,
810 .pc_encode = (kxdrproc_t) nfs3svc_encode_renameres, 819 .pc_encode = nfs3svc_encode_renameres,
811 .pc_release = (kxdrproc_t) nfs3svc_release_fhandle2, 820 .pc_release = nfs3svc_release_fhandle2,
812 .pc_argsize = sizeof(struct nfsd3_renameargs), 821 .pc_argsize = sizeof(struct nfsd3_renameargs),
813 .pc_ressize = sizeof(struct nfsd3_renameres), 822 .pc_ressize = sizeof(struct nfsd3_renameres),
814 .pc_cachetype = RC_REPLBUFF, 823 .pc_cachetype = RC_REPLBUFF,
815 .pc_xdrressize = ST+WC+WC, 824 .pc_xdrressize = ST+WC+WC,
816 }, 825 },
817 [NFS3PROC_LINK] = { 826 [NFS3PROC_LINK] = {
818 .pc_func = (svc_procfunc) nfsd3_proc_link, 827 .pc_func = nfsd3_proc_link,
819 .pc_decode = (kxdrproc_t) nfs3svc_decode_linkargs, 828 .pc_decode = nfs3svc_decode_linkargs,
820 .pc_encode = (kxdrproc_t) nfs3svc_encode_linkres, 829 .pc_encode = nfs3svc_encode_linkres,
821 .pc_release = (kxdrproc_t) nfs3svc_release_fhandle2, 830 .pc_release = nfs3svc_release_fhandle2,
822 .pc_argsize = sizeof(struct nfsd3_linkargs), 831 .pc_argsize = sizeof(struct nfsd3_linkargs),
823 .pc_ressize = sizeof(struct nfsd3_linkres), 832 .pc_ressize = sizeof(struct nfsd3_linkres),
824 .pc_cachetype = RC_REPLBUFF, 833 .pc_cachetype = RC_REPLBUFF,
825 .pc_xdrressize = ST+pAT+WC, 834 .pc_xdrressize = ST+pAT+WC,
826 }, 835 },
827 [NFS3PROC_READDIR] = { 836 [NFS3PROC_READDIR] = {
828 .pc_func = (svc_procfunc) nfsd3_proc_readdir, 837 .pc_func = nfsd3_proc_readdir,
829 .pc_decode = (kxdrproc_t) nfs3svc_decode_readdirargs, 838 .pc_decode = nfs3svc_decode_readdirargs,
830 .pc_encode = (kxdrproc_t) nfs3svc_encode_readdirres, 839 .pc_encode = nfs3svc_encode_readdirres,
831 .pc_release = (kxdrproc_t) nfs3svc_release_fhandle, 840 .pc_release = nfs3svc_release_fhandle,
832 .pc_argsize = sizeof(struct nfsd3_readdirargs), 841 .pc_argsize = sizeof(struct nfsd3_readdirargs),
833 .pc_ressize = sizeof(struct nfsd3_readdirres), 842 .pc_ressize = sizeof(struct nfsd3_readdirres),
834 .pc_cachetype = RC_NOCACHE, 843 .pc_cachetype = RC_NOCACHE,
835 }, 844 },
836 [NFS3PROC_READDIRPLUS] = { 845 [NFS3PROC_READDIRPLUS] = {
837 .pc_func = (svc_procfunc) nfsd3_proc_readdirplus, 846 .pc_func = nfsd3_proc_readdirplus,
838 .pc_decode = (kxdrproc_t) nfs3svc_decode_readdirplusargs, 847 .pc_decode = nfs3svc_decode_readdirplusargs,
839 .pc_encode = (kxdrproc_t) nfs3svc_encode_readdirres, 848 .pc_encode = nfs3svc_encode_readdirres,
840 .pc_release = (kxdrproc_t) nfs3svc_release_fhandle, 849 .pc_release = nfs3svc_release_fhandle,
841 .pc_argsize = sizeof(struct nfsd3_readdirplusargs), 850 .pc_argsize = sizeof(struct nfsd3_readdirplusargs),
842 .pc_ressize = sizeof(struct nfsd3_readdirres), 851 .pc_ressize = sizeof(struct nfsd3_readdirres),
843 .pc_cachetype = RC_NOCACHE, 852 .pc_cachetype = RC_NOCACHE,
844 }, 853 },
845 [NFS3PROC_FSSTAT] = { 854 [NFS3PROC_FSSTAT] = {
846 .pc_func = (svc_procfunc) nfsd3_proc_fsstat, 855 .pc_func = nfsd3_proc_fsstat,
847 .pc_decode = (kxdrproc_t) nfs3svc_decode_fhandleargs, 856 .pc_decode = nfs3svc_decode_fhandleargs,
848 .pc_encode = (kxdrproc_t) nfs3svc_encode_fsstatres, 857 .pc_encode = nfs3svc_encode_fsstatres,
849 .pc_argsize = sizeof(struct nfsd3_fhandleargs), 858 .pc_argsize = sizeof(struct nfsd3_fhandleargs),
850 .pc_ressize = sizeof(struct nfsd3_fsstatres), 859 .pc_ressize = sizeof(struct nfsd3_fsstatres),
851 .pc_cachetype = RC_NOCACHE, 860 .pc_cachetype = RC_NOCACHE,
852 .pc_xdrressize = ST+pAT+2*6+1, 861 .pc_xdrressize = ST+pAT+2*6+1,
853 }, 862 },
854 [NFS3PROC_FSINFO] = { 863 [NFS3PROC_FSINFO] = {
855 .pc_func = (svc_procfunc) nfsd3_proc_fsinfo, 864 .pc_func = nfsd3_proc_fsinfo,
856 .pc_decode = (kxdrproc_t) nfs3svc_decode_fhandleargs, 865 .pc_decode = nfs3svc_decode_fhandleargs,
857 .pc_encode = (kxdrproc_t) nfs3svc_encode_fsinfores, 866 .pc_encode = nfs3svc_encode_fsinfores,
858 .pc_argsize = sizeof(struct nfsd3_fhandleargs), 867 .pc_argsize = sizeof(struct nfsd3_fhandleargs),
859 .pc_ressize = sizeof(struct nfsd3_fsinfores), 868 .pc_ressize = sizeof(struct nfsd3_fsinfores),
860 .pc_cachetype = RC_NOCACHE, 869 .pc_cachetype = RC_NOCACHE,
861 .pc_xdrressize = ST+pAT+12, 870 .pc_xdrressize = ST+pAT+12,
862 }, 871 },
863 [NFS3PROC_PATHCONF] = { 872 [NFS3PROC_PATHCONF] = {
864 .pc_func = (svc_procfunc) nfsd3_proc_pathconf, 873 .pc_func = nfsd3_proc_pathconf,
865 .pc_decode = (kxdrproc_t) nfs3svc_decode_fhandleargs, 874 .pc_decode = nfs3svc_decode_fhandleargs,
866 .pc_encode = (kxdrproc_t) nfs3svc_encode_pathconfres, 875 .pc_encode = nfs3svc_encode_pathconfres,
867 .pc_argsize = sizeof(struct nfsd3_fhandleargs), 876 .pc_argsize = sizeof(struct nfsd3_fhandleargs),
868 .pc_ressize = sizeof(struct nfsd3_pathconfres), 877 .pc_ressize = sizeof(struct nfsd3_pathconfres),
869 .pc_cachetype = RC_NOCACHE, 878 .pc_cachetype = RC_NOCACHE,
870 .pc_xdrressize = ST+pAT+6, 879 .pc_xdrressize = ST+pAT+6,
871 }, 880 },
872 [NFS3PROC_COMMIT] = { 881 [NFS3PROC_COMMIT] = {
873 .pc_func = (svc_procfunc) nfsd3_proc_commit, 882 .pc_func = nfsd3_proc_commit,
874 .pc_decode = (kxdrproc_t) nfs3svc_decode_commitargs, 883 .pc_decode = nfs3svc_decode_commitargs,
875 .pc_encode = (kxdrproc_t) nfs3svc_encode_commitres, 884 .pc_encode = nfs3svc_encode_commitres,
876 .pc_release = (kxdrproc_t) nfs3svc_release_fhandle, 885 .pc_release = nfs3svc_release_fhandle,
877 .pc_argsize = sizeof(struct nfsd3_commitargs), 886 .pc_argsize = sizeof(struct nfsd3_commitargs),
878 .pc_ressize = sizeof(struct nfsd3_commitres), 887 .pc_ressize = sizeof(struct nfsd3_commitres),
879 .pc_cachetype = RC_NOCACHE, 888 .pc_cachetype = RC_NOCACHE,
@@ -881,10 +890,12 @@ static struct svc_procedure nfsd_procedures3[22] = {
881 }, 890 },
882}; 891};
883 892
884struct svc_version nfsd_version3 = { 893static unsigned int nfsd_count3[ARRAY_SIZE(nfsd_procedures3)];
885 .vs_vers = 3, 894const struct svc_version nfsd_version3 = {
886 .vs_nproc = 22, 895 .vs_vers = 3,
887 .vs_proc = nfsd_procedures3, 896 .vs_nproc = 22,
888 .vs_dispatch = nfsd_dispatch, 897 .vs_proc = nfsd_procedures3,
889 .vs_xdrsize = NFS3_SVC_XDRSIZE, 898 .vs_dispatch = nfsd_dispatch,
899 .vs_count = nfsd_count3,
900 .vs_xdrsize = NFS3_SVC_XDRSIZE,
890}; 901};
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
index 452334694a5d..bf444b664011 100644
--- a/fs/nfsd/nfs3xdr.c
+++ b/fs/nfsd/nfs3xdr.c
@@ -260,7 +260,7 @@ void fill_post_wcc(struct svc_fh *fhp)
260 printk("nfsd: inode locked twice during operation.\n"); 260 printk("nfsd: inode locked twice during operation.\n");
261 261
262 err = fh_getattr(fhp, &fhp->fh_post_attr); 262 err = fh_getattr(fhp, &fhp->fh_post_attr);
263 fhp->fh_post_change = d_inode(fhp->fh_dentry)->i_version; 263 fhp->fh_post_change = nfsd4_change_attribute(d_inode(fhp->fh_dentry));
264 if (err) { 264 if (err) {
265 fhp->fh_post_saved = false; 265 fhp->fh_post_saved = false;
266 /* Grab the ctime anyway - set_change_info might use it */ 266 /* Grab the ctime anyway - set_change_info might use it */
@@ -273,8 +273,10 @@ void fill_post_wcc(struct svc_fh *fhp)
273 * XDR decode functions 273 * XDR decode functions
274 */ 274 */
275int 275int
276nfs3svc_decode_fhandle(struct svc_rqst *rqstp, __be32 *p, struct nfsd_fhandle *args) 276nfs3svc_decode_fhandle(struct svc_rqst *rqstp, __be32 *p)
277{ 277{
278 struct nfsd_fhandle *args = rqstp->rq_argp;
279
278 p = decode_fh(p, &args->fh); 280 p = decode_fh(p, &args->fh);
279 if (!p) 281 if (!p)
280 return 0; 282 return 0;
@@ -282,9 +284,10 @@ nfs3svc_decode_fhandle(struct svc_rqst *rqstp, __be32 *p, struct nfsd_fhandle *a
282} 284}
283 285
284int 286int
285nfs3svc_decode_sattrargs(struct svc_rqst *rqstp, __be32 *p, 287nfs3svc_decode_sattrargs(struct svc_rqst *rqstp, __be32 *p)
286 struct nfsd3_sattrargs *args)
287{ 288{
289 struct nfsd3_sattrargs *args = rqstp->rq_argp;
290
288 p = decode_fh(p, &args->fh); 291 p = decode_fh(p, &args->fh);
289 if (!p) 292 if (!p)
290 return 0; 293 return 0;
@@ -300,9 +303,10 @@ nfs3svc_decode_sattrargs(struct svc_rqst *rqstp, __be32 *p,
300} 303}
301 304
302int 305int
303nfs3svc_decode_diropargs(struct svc_rqst *rqstp, __be32 *p, 306nfs3svc_decode_diropargs(struct svc_rqst *rqstp, __be32 *p)
304 struct nfsd3_diropargs *args)
305{ 307{
308 struct nfsd3_diropargs *args = rqstp->rq_argp;
309
306 if (!(p = decode_fh(p, &args->fh)) 310 if (!(p = decode_fh(p, &args->fh))
307 || !(p = decode_filename(p, &args->name, &args->len))) 311 || !(p = decode_filename(p, &args->name, &args->len)))
308 return 0; 312 return 0;
@@ -311,9 +315,10 @@ nfs3svc_decode_diropargs(struct svc_rqst *rqstp, __be32 *p,
311} 315}
312 316
313int 317int
314nfs3svc_decode_accessargs(struct svc_rqst *rqstp, __be32 *p, 318nfs3svc_decode_accessargs(struct svc_rqst *rqstp, __be32 *p)
315 struct nfsd3_accessargs *args)
316{ 319{
320 struct nfsd3_accessargs *args = rqstp->rq_argp;
321
317 p = decode_fh(p, &args->fh); 322 p = decode_fh(p, &args->fh);
318 if (!p) 323 if (!p)
319 return 0; 324 return 0;
@@ -323,9 +328,9 @@ nfs3svc_decode_accessargs(struct svc_rqst *rqstp, __be32 *p,
323} 328}
324 329
325int 330int
326nfs3svc_decode_readargs(struct svc_rqst *rqstp, __be32 *p, 331nfs3svc_decode_readargs(struct svc_rqst *rqstp, __be32 *p)
327 struct nfsd3_readargs *args)
328{ 332{
333 struct nfsd3_readargs *args = rqstp->rq_argp;
329 unsigned int len; 334 unsigned int len;
330 int v; 335 int v;
331 u32 max_blocksize = svc_max_payload(rqstp); 336 u32 max_blocksize = svc_max_payload(rqstp);
@@ -353,9 +358,9 @@ nfs3svc_decode_readargs(struct svc_rqst *rqstp, __be32 *p,
353} 358}
354 359
355int 360int
356nfs3svc_decode_writeargs(struct svc_rqst *rqstp, __be32 *p, 361nfs3svc_decode_writeargs(struct svc_rqst *rqstp, __be32 *p)
357 struct nfsd3_writeargs *args)
358{ 362{
363 struct nfsd3_writeargs *args = rqstp->rq_argp;
359 unsigned int len, v, hdr, dlen; 364 unsigned int len, v, hdr, dlen;
360 u32 max_blocksize = svc_max_payload(rqstp); 365 u32 max_blocksize = svc_max_payload(rqstp);
361 struct kvec *head = rqstp->rq_arg.head; 366 struct kvec *head = rqstp->rq_arg.head;
@@ -413,9 +418,10 @@ nfs3svc_decode_writeargs(struct svc_rqst *rqstp, __be32 *p,
413} 418}
414 419
415int 420int
416nfs3svc_decode_createargs(struct svc_rqst *rqstp, __be32 *p, 421nfs3svc_decode_createargs(struct svc_rqst *rqstp, __be32 *p)
417 struct nfsd3_createargs *args)
418{ 422{
423 struct nfsd3_createargs *args = rqstp->rq_argp;
424
419 if (!(p = decode_fh(p, &args->fh)) 425 if (!(p = decode_fh(p, &args->fh))
420 || !(p = decode_filename(p, &args->name, &args->len))) 426 || !(p = decode_filename(p, &args->name, &args->len)))
421 return 0; 427 return 0;
@@ -435,10 +441,12 @@ nfs3svc_decode_createargs(struct svc_rqst *rqstp, __be32 *p,
435 441
436 return xdr_argsize_check(rqstp, p); 442 return xdr_argsize_check(rqstp, p);
437} 443}
444
438int 445int
439nfs3svc_decode_mkdirargs(struct svc_rqst *rqstp, __be32 *p, 446nfs3svc_decode_mkdirargs(struct svc_rqst *rqstp, __be32 *p)
440 struct nfsd3_createargs *args)
441{ 447{
448 struct nfsd3_createargs *args = rqstp->rq_argp;
449
442 if (!(p = decode_fh(p, &args->fh)) || 450 if (!(p = decode_fh(p, &args->fh)) ||
443 !(p = decode_filename(p, &args->name, &args->len))) 451 !(p = decode_filename(p, &args->name, &args->len)))
444 return 0; 452 return 0;
@@ -448,9 +456,9 @@ nfs3svc_decode_mkdirargs(struct svc_rqst *rqstp, __be32 *p,
448} 456}
449 457
450int 458int
451nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, __be32 *p, 459nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, __be32 *p)
452 struct nfsd3_symlinkargs *args)
453{ 460{
461 struct nfsd3_symlinkargs *args = rqstp->rq_argp;
454 unsigned int len, avail; 462 unsigned int len, avail;
455 char *old, *new; 463 char *old, *new;
456 struct kvec *vec; 464 struct kvec *vec;
@@ -500,9 +508,10 @@ nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, __be32 *p,
500} 508}
501 509
502int 510int
503nfs3svc_decode_mknodargs(struct svc_rqst *rqstp, __be32 *p, 511nfs3svc_decode_mknodargs(struct svc_rqst *rqstp, __be32 *p)
504 struct nfsd3_mknodargs *args)
505{ 512{
513 struct nfsd3_mknodargs *args = rqstp->rq_argp;
514
506 if (!(p = decode_fh(p, &args->fh)) 515 if (!(p = decode_fh(p, &args->fh))
507 || !(p = decode_filename(p, &args->name, &args->len))) 516 || !(p = decode_filename(p, &args->name, &args->len)))
508 return 0; 517 return 0;
@@ -522,9 +531,10 @@ nfs3svc_decode_mknodargs(struct svc_rqst *rqstp, __be32 *p,
522} 531}
523 532
524int 533int
525nfs3svc_decode_renameargs(struct svc_rqst *rqstp, __be32 *p, 534nfs3svc_decode_renameargs(struct svc_rqst *rqstp, __be32 *p)
526 struct nfsd3_renameargs *args)
527{ 535{
536 struct nfsd3_renameargs *args = rqstp->rq_argp;
537
528 if (!(p = decode_fh(p, &args->ffh)) 538 if (!(p = decode_fh(p, &args->ffh))
529 || !(p = decode_filename(p, &args->fname, &args->flen)) 539 || !(p = decode_filename(p, &args->fname, &args->flen))
530 || !(p = decode_fh(p, &args->tfh)) 540 || !(p = decode_fh(p, &args->tfh))
@@ -535,9 +545,10 @@ nfs3svc_decode_renameargs(struct svc_rqst *rqstp, __be32 *p,
535} 545}
536 546
537int 547int
538nfs3svc_decode_readlinkargs(struct svc_rqst *rqstp, __be32 *p, 548nfs3svc_decode_readlinkargs(struct svc_rqst *rqstp, __be32 *p)
539 struct nfsd3_readlinkargs *args)
540{ 549{
550 struct nfsd3_readlinkargs *args = rqstp->rq_argp;
551
541 p = decode_fh(p, &args->fh); 552 p = decode_fh(p, &args->fh);
542 if (!p) 553 if (!p)
543 return 0; 554 return 0;
@@ -547,9 +558,10 @@ nfs3svc_decode_readlinkargs(struct svc_rqst *rqstp, __be32 *p,
547} 558}
548 559
549int 560int
550nfs3svc_decode_linkargs(struct svc_rqst *rqstp, __be32 *p, 561nfs3svc_decode_linkargs(struct svc_rqst *rqstp, __be32 *p)
551 struct nfsd3_linkargs *args)
552{ 562{
563 struct nfsd3_linkargs *args = rqstp->rq_argp;
564
553 if (!(p = decode_fh(p, &args->ffh)) 565 if (!(p = decode_fh(p, &args->ffh))
554 || !(p = decode_fh(p, &args->tfh)) 566 || !(p = decode_fh(p, &args->tfh))
555 || !(p = decode_filename(p, &args->tname, &args->tlen))) 567 || !(p = decode_filename(p, &args->tname, &args->tlen)))
@@ -559,9 +571,9 @@ nfs3svc_decode_linkargs(struct svc_rqst *rqstp, __be32 *p,
559} 571}
560 572
561int 573int
562nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p, 574nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p)
563 struct nfsd3_readdirargs *args)
564{ 575{
576 struct nfsd3_readdirargs *args = rqstp->rq_argp;
565 p = decode_fh(p, &args->fh); 577 p = decode_fh(p, &args->fh);
566 if (!p) 578 if (!p)
567 return 0; 579 return 0;
@@ -576,9 +588,9 @@ nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p,
576} 588}
577 589
578int 590int
579nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, __be32 *p, 591nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, __be32 *p)
580 struct nfsd3_readdirargs *args)
581{ 592{
593 struct nfsd3_readdirargs *args = rqstp->rq_argp;
582 int len; 594 int len;
583 u32 max_blocksize = svc_max_payload(rqstp); 595 u32 max_blocksize = svc_max_payload(rqstp);
584 596
@@ -602,9 +614,9 @@ nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, __be32 *p,
602} 614}
603 615
604int 616int
605nfs3svc_decode_commitargs(struct svc_rqst *rqstp, __be32 *p, 617nfs3svc_decode_commitargs(struct svc_rqst *rqstp, __be32 *p)
606 struct nfsd3_commitargs *args)
607{ 618{
619 struct nfsd3_commitargs *args = rqstp->rq_argp;
608 p = decode_fh(p, &args->fh); 620 p = decode_fh(p, &args->fh);
609 if (!p) 621 if (!p)
610 return 0; 622 return 0;
@@ -622,16 +634,17 @@ nfs3svc_decode_commitargs(struct svc_rqst *rqstp, __be32 *p,
622 * will work properly. 634 * will work properly.
623 */ 635 */
624int 636int
625nfs3svc_encode_voidres(struct svc_rqst *rqstp, __be32 *p, void *dummy) 637nfs3svc_encode_voidres(struct svc_rqst *rqstp, __be32 *p)
626{ 638{
627 return xdr_ressize_check(rqstp, p); 639 return xdr_ressize_check(rqstp, p);
628} 640}
629 641
630/* GETATTR */ 642/* GETATTR */
631int 643int
632nfs3svc_encode_attrstat(struct svc_rqst *rqstp, __be32 *p, 644nfs3svc_encode_attrstat(struct svc_rqst *rqstp, __be32 *p)
633 struct nfsd3_attrstat *resp)
634{ 645{
646 struct nfsd3_attrstat *resp = rqstp->rq_resp;
647
635 if (resp->status == 0) { 648 if (resp->status == 0) {
636 lease_get_mtime(d_inode(resp->fh.fh_dentry), 649 lease_get_mtime(d_inode(resp->fh.fh_dentry),
637 &resp->stat.mtime); 650 &resp->stat.mtime);
@@ -642,18 +655,20 @@ nfs3svc_encode_attrstat(struct svc_rqst *rqstp, __be32 *p,
642 655
643/* SETATTR, REMOVE, RMDIR */ 656/* SETATTR, REMOVE, RMDIR */
644int 657int
645nfs3svc_encode_wccstat(struct svc_rqst *rqstp, __be32 *p, 658nfs3svc_encode_wccstat(struct svc_rqst *rqstp, __be32 *p)
646 struct nfsd3_attrstat *resp)
647{ 659{
660 struct nfsd3_attrstat *resp = rqstp->rq_resp;
661
648 p = encode_wcc_data(rqstp, p, &resp->fh); 662 p = encode_wcc_data(rqstp, p, &resp->fh);
649 return xdr_ressize_check(rqstp, p); 663 return xdr_ressize_check(rqstp, p);
650} 664}
651 665
652/* LOOKUP */ 666/* LOOKUP */
653int 667int
654nfs3svc_encode_diropres(struct svc_rqst *rqstp, __be32 *p, 668nfs3svc_encode_diropres(struct svc_rqst *rqstp, __be32 *p)
655 struct nfsd3_diropres *resp)
656{ 669{
670 struct nfsd3_diropres *resp = rqstp->rq_resp;
671
657 if (resp->status == 0) { 672 if (resp->status == 0) {
658 p = encode_fh(p, &resp->fh); 673 p = encode_fh(p, &resp->fh);
659 p = encode_post_op_attr(rqstp, p, &resp->fh); 674 p = encode_post_op_attr(rqstp, p, &resp->fh);
@@ -664,9 +679,10 @@ nfs3svc_encode_diropres(struct svc_rqst *rqstp, __be32 *p,
664 679
665/* ACCESS */ 680/* ACCESS */
666int 681int
667nfs3svc_encode_accessres(struct svc_rqst *rqstp, __be32 *p, 682nfs3svc_encode_accessres(struct svc_rqst *rqstp, __be32 *p)
668 struct nfsd3_accessres *resp)
669{ 683{
684 struct nfsd3_accessres *resp = rqstp->rq_resp;
685
670 p = encode_post_op_attr(rqstp, p, &resp->fh); 686 p = encode_post_op_attr(rqstp, p, &resp->fh);
671 if (resp->status == 0) 687 if (resp->status == 0)
672 *p++ = htonl(resp->access); 688 *p++ = htonl(resp->access);
@@ -675,9 +691,10 @@ nfs3svc_encode_accessres(struct svc_rqst *rqstp, __be32 *p,
675 691
676/* READLINK */ 692/* READLINK */
677int 693int
678nfs3svc_encode_readlinkres(struct svc_rqst *rqstp, __be32 *p, 694nfs3svc_encode_readlinkres(struct svc_rqst *rqstp, __be32 *p)
679 struct nfsd3_readlinkres *resp)
680{ 695{
696 struct nfsd3_readlinkres *resp = rqstp->rq_resp;
697
681 p = encode_post_op_attr(rqstp, p, &resp->fh); 698 p = encode_post_op_attr(rqstp, p, &resp->fh);
682 if (resp->status == 0) { 699 if (resp->status == 0) {
683 *p++ = htonl(resp->len); 700 *p++ = htonl(resp->len);
@@ -696,9 +713,10 @@ nfs3svc_encode_readlinkres(struct svc_rqst *rqstp, __be32 *p,
696 713
697/* READ */ 714/* READ */
698int 715int
699nfs3svc_encode_readres(struct svc_rqst *rqstp, __be32 *p, 716nfs3svc_encode_readres(struct svc_rqst *rqstp, __be32 *p)
700 struct nfsd3_readres *resp)
701{ 717{
718 struct nfsd3_readres *resp = rqstp->rq_resp;
719
702 p = encode_post_op_attr(rqstp, p, &resp->fh); 720 p = encode_post_op_attr(rqstp, p, &resp->fh);
703 if (resp->status == 0) { 721 if (resp->status == 0) {
704 *p++ = htonl(resp->count); 722 *p++ = htonl(resp->count);
@@ -720,9 +738,9 @@ nfs3svc_encode_readres(struct svc_rqst *rqstp, __be32 *p,
720 738
721/* WRITE */ 739/* WRITE */
722int 740int
723nfs3svc_encode_writeres(struct svc_rqst *rqstp, __be32 *p, 741nfs3svc_encode_writeres(struct svc_rqst *rqstp, __be32 *p)
724 struct nfsd3_writeres *resp)
725{ 742{
743 struct nfsd3_writeres *resp = rqstp->rq_resp;
726 struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id); 744 struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id);
727 745
728 p = encode_wcc_data(rqstp, p, &resp->fh); 746 p = encode_wcc_data(rqstp, p, &resp->fh);
@@ -737,9 +755,10 @@ nfs3svc_encode_writeres(struct svc_rqst *rqstp, __be32 *p,
737 755
738/* CREATE, MKDIR, SYMLINK, MKNOD */ 756/* CREATE, MKDIR, SYMLINK, MKNOD */
739int 757int
740nfs3svc_encode_createres(struct svc_rqst *rqstp, __be32 *p, 758nfs3svc_encode_createres(struct svc_rqst *rqstp, __be32 *p)
741 struct nfsd3_diropres *resp)
742{ 759{
760 struct nfsd3_diropres *resp = rqstp->rq_resp;
761
743 if (resp->status == 0) { 762 if (resp->status == 0) {
744 *p++ = xdr_one; 763 *p++ = xdr_one;
745 p = encode_fh(p, &resp->fh); 764 p = encode_fh(p, &resp->fh);
@@ -751,9 +770,10 @@ nfs3svc_encode_createres(struct svc_rqst *rqstp, __be32 *p,
751 770
752/* RENAME */ 771/* RENAME */
753int 772int
754nfs3svc_encode_renameres(struct svc_rqst *rqstp, __be32 *p, 773nfs3svc_encode_renameres(struct svc_rqst *rqstp, __be32 *p)
755 struct nfsd3_renameres *resp)
756{ 774{
775 struct nfsd3_renameres *resp = rqstp->rq_resp;
776
757 p = encode_wcc_data(rqstp, p, &resp->ffh); 777 p = encode_wcc_data(rqstp, p, &resp->ffh);
758 p = encode_wcc_data(rqstp, p, &resp->tfh); 778 p = encode_wcc_data(rqstp, p, &resp->tfh);
759 return xdr_ressize_check(rqstp, p); 779 return xdr_ressize_check(rqstp, p);
@@ -761,9 +781,10 @@ nfs3svc_encode_renameres(struct svc_rqst *rqstp, __be32 *p,
761 781
762/* LINK */ 782/* LINK */
763int 783int
764nfs3svc_encode_linkres(struct svc_rqst *rqstp, __be32 *p, 784nfs3svc_encode_linkres(struct svc_rqst *rqstp, __be32 *p)
765 struct nfsd3_linkres *resp)
766{ 785{
786 struct nfsd3_linkres *resp = rqstp->rq_resp;
787
767 p = encode_post_op_attr(rqstp, p, &resp->fh); 788 p = encode_post_op_attr(rqstp, p, &resp->fh);
768 p = encode_wcc_data(rqstp, p, &resp->tfh); 789 p = encode_wcc_data(rqstp, p, &resp->tfh);
769 return xdr_ressize_check(rqstp, p); 790 return xdr_ressize_check(rqstp, p);
@@ -771,9 +792,10 @@ nfs3svc_encode_linkres(struct svc_rqst *rqstp, __be32 *p,
771 792
772/* READDIR */ 793/* READDIR */
773int 794int
774nfs3svc_encode_readdirres(struct svc_rqst *rqstp, __be32 *p, 795nfs3svc_encode_readdirres(struct svc_rqst *rqstp, __be32 *p)
775 struct nfsd3_readdirres *resp)
776{ 796{
797 struct nfsd3_readdirres *resp = rqstp->rq_resp;
798
777 p = encode_post_op_attr(rqstp, p, &resp->fh); 799 p = encode_post_op_attr(rqstp, p, &resp->fh);
778 800
779 if (resp->status == 0) { 801 if (resp->status == 0) {
@@ -1021,9 +1043,9 @@ nfs3svc_encode_entry_plus(void *cd, const char *name,
1021 1043
1022/* FSSTAT */ 1044/* FSSTAT */
1023int 1045int
1024nfs3svc_encode_fsstatres(struct svc_rqst *rqstp, __be32 *p, 1046nfs3svc_encode_fsstatres(struct svc_rqst *rqstp, __be32 *p)
1025 struct nfsd3_fsstatres *resp)
1026{ 1047{
1048 struct nfsd3_fsstatres *resp = rqstp->rq_resp;
1027 struct kstatfs *s = &resp->stats; 1049 struct kstatfs *s = &resp->stats;
1028 u64 bs = s->f_bsize; 1050 u64 bs = s->f_bsize;
1029 1051
@@ -1043,9 +1065,10 @@ nfs3svc_encode_fsstatres(struct svc_rqst *rqstp, __be32 *p,
1043 1065
1044/* FSINFO */ 1066/* FSINFO */
1045int 1067int
1046nfs3svc_encode_fsinfores(struct svc_rqst *rqstp, __be32 *p, 1068nfs3svc_encode_fsinfores(struct svc_rqst *rqstp, __be32 *p)
1047 struct nfsd3_fsinfores *resp)
1048{ 1069{
1070 struct nfsd3_fsinfores *resp = rqstp->rq_resp;
1071
1049 *p++ = xdr_zero; /* no post_op_attr */ 1072 *p++ = xdr_zero; /* no post_op_attr */
1050 1073
1051 if (resp->status == 0) { 1074 if (resp->status == 0) {
@@ -1067,9 +1090,10 @@ nfs3svc_encode_fsinfores(struct svc_rqst *rqstp, __be32 *p,
1067 1090
1068/* PATHCONF */ 1091/* PATHCONF */
1069int 1092int
1070nfs3svc_encode_pathconfres(struct svc_rqst *rqstp, __be32 *p, 1093nfs3svc_encode_pathconfres(struct svc_rqst *rqstp, __be32 *p)
1071 struct nfsd3_pathconfres *resp)
1072{ 1094{
1095 struct nfsd3_pathconfres *resp = rqstp->rq_resp;
1096
1073 *p++ = xdr_zero; /* no post_op_attr */ 1097 *p++ = xdr_zero; /* no post_op_attr */
1074 1098
1075 if (resp->status == 0) { 1099 if (resp->status == 0) {
@@ -1086,9 +1110,9 @@ nfs3svc_encode_pathconfres(struct svc_rqst *rqstp, __be32 *p,
1086 1110
1087/* COMMIT */ 1111/* COMMIT */
1088int 1112int
1089nfs3svc_encode_commitres(struct svc_rqst *rqstp, __be32 *p, 1113nfs3svc_encode_commitres(struct svc_rqst *rqstp, __be32 *p)
1090 struct nfsd3_commitres *resp)
1091{ 1114{
1115 struct nfsd3_commitres *resp = rqstp->rq_resp;
1092 struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id); 1116 struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id);
1093 1117
1094 p = encode_wcc_data(rqstp, p, &resp->fh); 1118 p = encode_wcc_data(rqstp, p, &resp->fh);
@@ -1103,19 +1127,19 @@ nfs3svc_encode_commitres(struct svc_rqst *rqstp, __be32 *p,
1103/* 1127/*
1104 * XDR release functions 1128 * XDR release functions
1105 */ 1129 */
1106int 1130void
1107nfs3svc_release_fhandle(struct svc_rqst *rqstp, __be32 *p, 1131nfs3svc_release_fhandle(struct svc_rqst *rqstp)
1108 struct nfsd3_attrstat *resp)
1109{ 1132{
1133 struct nfsd3_attrstat *resp = rqstp->rq_resp;
1134
1110 fh_put(&resp->fh); 1135 fh_put(&resp->fh);
1111 return 1;
1112} 1136}
1113 1137
1114int 1138void
1115nfs3svc_release_fhandle2(struct svc_rqst *rqstp, __be32 *p, 1139nfs3svc_release_fhandle2(struct svc_rqst *rqstp)
1116 struct nfsd3_fhandle_pair *resp)
1117{ 1140{
1141 struct nfsd3_fhandle_pair *resp = rqstp->rq_resp;
1142
1118 fh_put(&resp->fh1); 1143 fh_put(&resp->fh1);
1119 fh_put(&resp->fh2); 1144 fh_put(&resp->fh2);
1120 return 1;
1121} 1145}
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index 0274db6e65d0..b45083c0f9ae 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -468,7 +468,7 @@ static int decode_cb_sequence4res(struct xdr_stream *xdr,
468 * NB: Without this zero space reservation, callbacks over krb5p fail 468 * NB: Without this zero space reservation, callbacks over krb5p fail
469 */ 469 */
470static void nfs4_xdr_enc_cb_null(struct rpc_rqst *req, struct xdr_stream *xdr, 470static void nfs4_xdr_enc_cb_null(struct rpc_rqst *req, struct xdr_stream *xdr,
471 void *__unused) 471 const void *__unused)
472{ 472{
473 xdr_reserve_space(xdr, 0); 473 xdr_reserve_space(xdr, 0);
474} 474}
@@ -477,8 +477,9 @@ static void nfs4_xdr_enc_cb_null(struct rpc_rqst *req, struct xdr_stream *xdr,
477 * 20.2. Operation 4: CB_RECALL - Recall a Delegation 477 * 20.2. Operation 4: CB_RECALL - Recall a Delegation
478 */ 478 */
479static void nfs4_xdr_enc_cb_recall(struct rpc_rqst *req, struct xdr_stream *xdr, 479static void nfs4_xdr_enc_cb_recall(struct rpc_rqst *req, struct xdr_stream *xdr,
480 const struct nfsd4_callback *cb) 480 const void *data)
481{ 481{
482 const struct nfsd4_callback *cb = data;
482 const struct nfs4_delegation *dp = cb_to_delegation(cb); 483 const struct nfs4_delegation *dp = cb_to_delegation(cb);
483 struct nfs4_cb_compound_hdr hdr = { 484 struct nfs4_cb_compound_hdr hdr = {
484 .ident = cb->cb_clp->cl_cb_ident, 485 .ident = cb->cb_clp->cl_cb_ident,
@@ -512,8 +513,9 @@ static int nfs4_xdr_dec_cb_null(struct rpc_rqst *req, struct xdr_stream *xdr,
512 */ 513 */
513static int nfs4_xdr_dec_cb_recall(struct rpc_rqst *rqstp, 514static int nfs4_xdr_dec_cb_recall(struct rpc_rqst *rqstp,
514 struct xdr_stream *xdr, 515 struct xdr_stream *xdr,
515 struct nfsd4_callback *cb) 516 void *data)
516{ 517{
518 struct nfsd4_callback *cb = data;
517 struct nfs4_cb_compound_hdr hdr; 519 struct nfs4_cb_compound_hdr hdr;
518 int status; 520 int status;
519 521
@@ -585,8 +587,9 @@ static void encode_cb_layout4args(struct xdr_stream *xdr,
585 587
586static void nfs4_xdr_enc_cb_layout(struct rpc_rqst *req, 588static void nfs4_xdr_enc_cb_layout(struct rpc_rqst *req,
587 struct xdr_stream *xdr, 589 struct xdr_stream *xdr,
588 const struct nfsd4_callback *cb) 590 const void *data)
589{ 591{
592 const struct nfsd4_callback *cb = data;
590 const struct nfs4_layout_stateid *ls = 593 const struct nfs4_layout_stateid *ls =
591 container_of(cb, struct nfs4_layout_stateid, ls_recall); 594 container_of(cb, struct nfs4_layout_stateid, ls_recall);
592 struct nfs4_cb_compound_hdr hdr = { 595 struct nfs4_cb_compound_hdr hdr = {
@@ -602,8 +605,9 @@ static void nfs4_xdr_enc_cb_layout(struct rpc_rqst *req,
602 605
603static int nfs4_xdr_dec_cb_layout(struct rpc_rqst *rqstp, 606static int nfs4_xdr_dec_cb_layout(struct rpc_rqst *rqstp,
604 struct xdr_stream *xdr, 607 struct xdr_stream *xdr,
605 struct nfsd4_callback *cb) 608 void *data)
606{ 609{
610 struct nfsd4_callback *cb = data;
607 struct nfs4_cb_compound_hdr hdr; 611 struct nfs4_cb_compound_hdr hdr;
608 int status; 612 int status;
609 613
@@ -631,8 +635,9 @@ static void encode_stateowner(struct xdr_stream *xdr, struct nfs4_stateowner *so
631 635
632static void nfs4_xdr_enc_cb_notify_lock(struct rpc_rqst *req, 636static void nfs4_xdr_enc_cb_notify_lock(struct rpc_rqst *req,
633 struct xdr_stream *xdr, 637 struct xdr_stream *xdr,
634 const struct nfsd4_callback *cb) 638 const void *data)
635{ 639{
640 const struct nfsd4_callback *cb = data;
636 const struct nfsd4_blocked_lock *nbl = 641 const struct nfsd4_blocked_lock *nbl =
637 container_of(cb, struct nfsd4_blocked_lock, nbl_cb); 642 container_of(cb, struct nfsd4_blocked_lock, nbl_cb);
638 struct nfs4_lockowner *lo = (struct nfs4_lockowner *)nbl->nbl_lock.fl_owner; 643 struct nfs4_lockowner *lo = (struct nfs4_lockowner *)nbl->nbl_lock.fl_owner;
@@ -659,8 +664,9 @@ static void nfs4_xdr_enc_cb_notify_lock(struct rpc_rqst *req,
659 664
660static int nfs4_xdr_dec_cb_notify_lock(struct rpc_rqst *rqstp, 665static int nfs4_xdr_dec_cb_notify_lock(struct rpc_rqst *rqstp,
661 struct xdr_stream *xdr, 666 struct xdr_stream *xdr,
662 struct nfsd4_callback *cb) 667 void *data)
663{ 668{
669 struct nfsd4_callback *cb = data;
664 struct nfs4_cb_compound_hdr hdr; 670 struct nfs4_cb_compound_hdr hdr;
665 int status; 671 int status;
666 672
@@ -682,15 +688,15 @@ static int nfs4_xdr_dec_cb_notify_lock(struct rpc_rqst *rqstp,
682#define PROC(proc, call, argtype, restype) \ 688#define PROC(proc, call, argtype, restype) \
683[NFSPROC4_CLNT_##proc] = { \ 689[NFSPROC4_CLNT_##proc] = { \
684 .p_proc = NFSPROC4_CB_##call, \ 690 .p_proc = NFSPROC4_CB_##call, \
685 .p_encode = (kxdreproc_t)nfs4_xdr_enc_##argtype, \ 691 .p_encode = nfs4_xdr_enc_##argtype, \
686 .p_decode = (kxdrdproc_t)nfs4_xdr_dec_##restype, \ 692 .p_decode = nfs4_xdr_dec_##restype, \
687 .p_arglen = NFS4_enc_##argtype##_sz, \ 693 .p_arglen = NFS4_enc_##argtype##_sz, \
688 .p_replen = NFS4_dec_##restype##_sz, \ 694 .p_replen = NFS4_dec_##restype##_sz, \
689 .p_statidx = NFSPROC4_CB_##call, \ 695 .p_statidx = NFSPROC4_CB_##call, \
690 .p_name = #proc, \ 696 .p_name = #proc, \
691} 697}
692 698
693static struct rpc_procinfo nfs4_cb_procedures[] = { 699static const struct rpc_procinfo nfs4_cb_procedures[] = {
694 PROC(CB_NULL, NULL, cb_null, cb_null), 700 PROC(CB_NULL, NULL, cb_null, cb_null),
695 PROC(CB_RECALL, COMPOUND, cb_recall, cb_recall), 701 PROC(CB_RECALL, COMPOUND, cb_recall, cb_recall),
696#ifdef CONFIG_NFSD_PNFS 702#ifdef CONFIG_NFSD_PNFS
@@ -699,7 +705,8 @@ static struct rpc_procinfo nfs4_cb_procedures[] = {
699 PROC(CB_NOTIFY_LOCK, COMPOUND, cb_notify_lock, cb_notify_lock), 705 PROC(CB_NOTIFY_LOCK, COMPOUND, cb_notify_lock, cb_notify_lock),
700}; 706};
701 707
702static struct rpc_version nfs_cb_version4 = { 708static unsigned int nfs4_cb_counts[ARRAY_SIZE(nfs4_cb_procedures)];
709static const struct rpc_version nfs_cb_version4 = {
703/* 710/*
704 * Note on the callback rpc program version number: despite language in rfc 711 * Note on the callback rpc program version number: despite language in rfc
705 * 5661 section 18.36.3 requiring servers to use 4 in this field, the 712 * 5661 section 18.36.3 requiring servers to use 4 in this field, the
@@ -709,7 +716,8 @@ static struct rpc_version nfs_cb_version4 = {
709 */ 716 */
710 .number = 1, 717 .number = 1,
711 .nrprocs = ARRAY_SIZE(nfs4_cb_procedures), 718 .nrprocs = ARRAY_SIZE(nfs4_cb_procedures),
712 .procs = nfs4_cb_procedures 719 .procs = nfs4_cb_procedures,
720 .counts = nfs4_cb_counts,
713}; 721};
714 722
715static const struct rpc_version *nfs_cb_version[] = { 723static const struct rpc_version *nfs_cb_version[] = {
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index dadb3bf305b2..d27e75ad25e3 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -344,8 +344,9 @@ copy_clientid(clientid_t *clid, struct nfsd4_session *session)
344 344
345static __be32 345static __be32
346nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 346nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
347 struct nfsd4_open *open) 347 union nfsd4_op_u *u)
348{ 348{
349 struct nfsd4_open *open = &u->open;
349 __be32 status; 350 __be32 status;
350 struct svc_fh *resfh = NULL; 351 struct svc_fh *resfh = NULL;
351 struct net *net = SVC_NET(rqstp); 352 struct net *net = SVC_NET(rqstp);
@@ -467,14 +468,14 @@ out:
467 */ 468 */
468static __be32 nfsd4_open_omfg(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfsd4_op *op) 469static __be32 nfsd4_open_omfg(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfsd4_op *op)
469{ 470{
470 struct nfsd4_open *open = (struct nfsd4_open *)&op->u; 471 struct nfsd4_open *open = &op->u.open;
471 472
472 if (!seqid_mutating_err(ntohl(op->status))) 473 if (!seqid_mutating_err(ntohl(op->status)))
473 return op->status; 474 return op->status;
474 if (nfsd4_has_session(cstate)) 475 if (nfsd4_has_session(cstate))
475 return op->status; 476 return op->status;
476 open->op_xdr_error = op->status; 477 open->op_xdr_error = op->status;
477 return nfsd4_open(rqstp, cstate, open); 478 return nfsd4_open(rqstp, cstate, &op->u);
478} 479}
479 480
480/* 481/*
@@ -482,19 +483,21 @@ static __be32 nfsd4_open_omfg(struct svc_rqst *rqstp, struct nfsd4_compound_stat
482 */ 483 */
483static __be32 484static __be32
484nfsd4_getfh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 485nfsd4_getfh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
485 struct svc_fh **getfh) 486 union nfsd4_op_u *u)
486{ 487{
487 if (!cstate->current_fh.fh_dentry) 488 if (!cstate->current_fh.fh_dentry)
488 return nfserr_nofilehandle; 489 return nfserr_nofilehandle;
489 490
490 *getfh = &cstate->current_fh; 491 u->getfh = &cstate->current_fh;
491 return nfs_ok; 492 return nfs_ok;
492} 493}
493 494
494static __be32 495static __be32
495nfsd4_putfh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 496nfsd4_putfh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
496 struct nfsd4_putfh *putfh) 497 union nfsd4_op_u *u)
497{ 498{
499 struct nfsd4_putfh *putfh = &u->putfh;
500
498 fh_put(&cstate->current_fh); 501 fh_put(&cstate->current_fh);
499 cstate->current_fh.fh_handle.fh_size = putfh->pf_fhlen; 502 cstate->current_fh.fh_handle.fh_size = putfh->pf_fhlen;
500 memcpy(&cstate->current_fh.fh_handle.fh_base, putfh->pf_fhval, 503 memcpy(&cstate->current_fh.fh_handle.fh_base, putfh->pf_fhval,
@@ -504,7 +507,7 @@ nfsd4_putfh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
504 507
505static __be32 508static __be32
506nfsd4_putrootfh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 509nfsd4_putrootfh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
507 void *arg) 510 union nfsd4_op_u *u)
508{ 511{
509 __be32 status; 512 __be32 status;
510 513
@@ -515,7 +518,7 @@ nfsd4_putrootfh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
515 518
516static __be32 519static __be32
517nfsd4_restorefh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 520nfsd4_restorefh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
518 void *arg) 521 union nfsd4_op_u *u)
519{ 522{
520 if (!cstate->save_fh.fh_dentry) 523 if (!cstate->save_fh.fh_dentry)
521 return nfserr_restorefh; 524 return nfserr_restorefh;
@@ -530,7 +533,7 @@ nfsd4_restorefh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
530 533
531static __be32 534static __be32
532nfsd4_savefh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 535nfsd4_savefh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
533 void *arg) 536 union nfsd4_op_u *u)
534{ 537{
535 if (!cstate->current_fh.fh_dentry) 538 if (!cstate->current_fh.fh_dentry)
536 return nfserr_nofilehandle; 539 return nfserr_nofilehandle;
@@ -548,8 +551,10 @@ nfsd4_savefh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
548 */ 551 */
549static __be32 552static __be32
550nfsd4_access(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 553nfsd4_access(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
551 struct nfsd4_access *access) 554 union nfsd4_op_u *u)
552{ 555{
556 struct nfsd4_access *access = &u->access;
557
553 if (access->ac_req_access & ~NFS3_ACCESS_FULL) 558 if (access->ac_req_access & ~NFS3_ACCESS_FULL)
554 return nfserr_inval; 559 return nfserr_inval;
555 560
@@ -574,8 +579,10 @@ static void gen_boot_verifier(nfs4_verifier *verifier, struct net *net)
574 579
575static __be32 580static __be32
576nfsd4_commit(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 581nfsd4_commit(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
577 struct nfsd4_commit *commit) 582 union nfsd4_op_u *u)
578{ 583{
584 struct nfsd4_commit *commit = &u->commit;
585
579 gen_boot_verifier(&commit->co_verf, SVC_NET(rqstp)); 586 gen_boot_verifier(&commit->co_verf, SVC_NET(rqstp));
580 return nfsd_commit(rqstp, &cstate->current_fh, commit->co_offset, 587 return nfsd_commit(rqstp, &cstate->current_fh, commit->co_offset,
581 commit->co_count); 588 commit->co_count);
@@ -583,8 +590,9 @@ nfsd4_commit(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
583 590
584static __be32 591static __be32
585nfsd4_create(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 592nfsd4_create(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
586 struct nfsd4_create *create) 593 union nfsd4_op_u *u)
587{ 594{
595 struct nfsd4_create *create = &u->create;
588 struct svc_fh resfh; 596 struct svc_fh resfh;
589 __be32 status; 597 __be32 status;
590 dev_t rdev; 598 dev_t rdev;
@@ -670,8 +678,9 @@ out:
670 678
671static __be32 679static __be32
672nfsd4_getattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 680nfsd4_getattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
673 struct nfsd4_getattr *getattr) 681 union nfsd4_op_u *u)
674{ 682{
683 struct nfsd4_getattr *getattr = &u->getattr;
675 __be32 status; 684 __be32 status;
676 685
677 status = fh_verify(rqstp, &cstate->current_fh, 0, NFSD_MAY_NOP); 686 status = fh_verify(rqstp, &cstate->current_fh, 0, NFSD_MAY_NOP);
@@ -691,8 +700,9 @@ nfsd4_getattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
691 700
692static __be32 701static __be32
693nfsd4_link(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 702nfsd4_link(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
694 struct nfsd4_link *link) 703 union nfsd4_op_u *u)
695{ 704{
705 struct nfsd4_link *link = &u->link;
696 __be32 status = nfserr_nofilehandle; 706 __be32 status = nfserr_nofilehandle;
697 707
698 if (!cstate->save_fh.fh_dentry) 708 if (!cstate->save_fh.fh_dentry)
@@ -723,24 +733,25 @@ static __be32 nfsd4_do_lookupp(struct svc_rqst *rqstp, struct svc_fh *fh)
723 733
724static __be32 734static __be32
725nfsd4_lookupp(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 735nfsd4_lookupp(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
726 void *arg) 736 union nfsd4_op_u *u)
727{ 737{
728 return nfsd4_do_lookupp(rqstp, &cstate->current_fh); 738 return nfsd4_do_lookupp(rqstp, &cstate->current_fh);
729} 739}
730 740
731static __be32 741static __be32
732nfsd4_lookup(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 742nfsd4_lookup(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
733 struct nfsd4_lookup *lookup) 743 union nfsd4_op_u *u)
734{ 744{
735 return nfsd_lookup(rqstp, &cstate->current_fh, 745 return nfsd_lookup(rqstp, &cstate->current_fh,
736 lookup->lo_name, lookup->lo_len, 746 u->lookup.lo_name, u->lookup.lo_len,
737 &cstate->current_fh); 747 &cstate->current_fh);
738} 748}
739 749
740static __be32 750static __be32
741nfsd4_read(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 751nfsd4_read(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
742 struct nfsd4_read *read) 752 union nfsd4_op_u *u)
743{ 753{
754 struct nfsd4_read *read = &u->read;
744 __be32 status; 755 __be32 status;
745 756
746 read->rd_filp = NULL; 757 read->rd_filp = NULL;
@@ -775,8 +786,9 @@ out:
775 786
776static __be32 787static __be32
777nfsd4_readdir(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 788nfsd4_readdir(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
778 struct nfsd4_readdir *readdir) 789 union nfsd4_op_u *u)
779{ 790{
791 struct nfsd4_readdir *readdir = &u->readdir;
780 u64 cookie = readdir->rd_cookie; 792 u64 cookie = readdir->rd_cookie;
781 static const nfs4_verifier zeroverf; 793 static const nfs4_verifier zeroverf;
782 794
@@ -800,17 +812,18 @@ nfsd4_readdir(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
800 812
801static __be32 813static __be32
802nfsd4_readlink(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 814nfsd4_readlink(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
803 struct nfsd4_readlink *readlink) 815 union nfsd4_op_u *u)
804{ 816{
805 readlink->rl_rqstp = rqstp; 817 u->readlink.rl_rqstp = rqstp;
806 readlink->rl_fhp = &cstate->current_fh; 818 u->readlink.rl_fhp = &cstate->current_fh;
807 return nfs_ok; 819 return nfs_ok;
808} 820}
809 821
810static __be32 822static __be32
811nfsd4_remove(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 823nfsd4_remove(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
812 struct nfsd4_remove *remove) 824 union nfsd4_op_u *u)
813{ 825{
826 struct nfsd4_remove *remove = &u->remove;
814 __be32 status; 827 __be32 status;
815 828
816 if (opens_in_grace(SVC_NET(rqstp))) 829 if (opens_in_grace(SVC_NET(rqstp)))
@@ -826,8 +839,9 @@ nfsd4_remove(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
826 839
827static __be32 840static __be32
828nfsd4_rename(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 841nfsd4_rename(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
829 struct nfsd4_rename *rename) 842 union nfsd4_op_u *u)
830{ 843{
844 struct nfsd4_rename *rename = &u->rename;
831 __be32 status = nfserr_nofilehandle; 845 __be32 status = nfserr_nofilehandle;
832 846
833 if (!cstate->save_fh.fh_dentry) 847 if (!cstate->save_fh.fh_dentry)
@@ -847,8 +861,9 @@ nfsd4_rename(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
847 861
848static __be32 862static __be32
849nfsd4_secinfo(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 863nfsd4_secinfo(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
850 struct nfsd4_secinfo *secinfo) 864 union nfsd4_op_u *u)
851{ 865{
866 struct nfsd4_secinfo *secinfo = &u->secinfo;
852 struct svc_export *exp; 867 struct svc_export *exp;
853 struct dentry *dentry; 868 struct dentry *dentry;
854 __be32 err; 869 __be32 err;
@@ -876,11 +891,11 @@ nfsd4_secinfo(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
876 891
877static __be32 892static __be32
878nfsd4_secinfo_no_name(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 893nfsd4_secinfo_no_name(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
879 struct nfsd4_secinfo_no_name *sin) 894 union nfsd4_op_u *u)
880{ 895{
881 __be32 err; 896 __be32 err;
882 897
883 switch (sin->sin_style) { 898 switch (u->secinfo_no_name.sin_style) {
884 case NFS4_SECINFO_STYLE4_CURRENT_FH: 899 case NFS4_SECINFO_STYLE4_CURRENT_FH:
885 break; 900 break;
886 case NFS4_SECINFO_STYLE4_PARENT: 901 case NFS4_SECINFO_STYLE4_PARENT:
@@ -892,15 +907,16 @@ nfsd4_secinfo_no_name(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstat
892 return nfserr_inval; 907 return nfserr_inval;
893 } 908 }
894 909
895 sin->sin_exp = exp_get(cstate->current_fh.fh_export); 910 u->secinfo_no_name.sin_exp = exp_get(cstate->current_fh.fh_export);
896 fh_put(&cstate->current_fh); 911 fh_put(&cstate->current_fh);
897 return nfs_ok; 912 return nfs_ok;
898} 913}
899 914
900static __be32 915static __be32
901nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 916nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
902 struct nfsd4_setattr *setattr) 917 union nfsd4_op_u *u)
903{ 918{
919 struct nfsd4_setattr *setattr = &u->setattr;
904 __be32 status = nfs_ok; 920 __be32 status = nfs_ok;
905 int err; 921 int err;
906 922
@@ -960,8 +976,9 @@ static int fill_in_write_vector(struct kvec *vec, struct nfsd4_write *write)
960 976
961static __be32 977static __be32
962nfsd4_write(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 978nfsd4_write(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
963 struct nfsd4_write *write) 979 union nfsd4_op_u *u)
964{ 980{
981 struct nfsd4_write *write = &u->write;
965 stateid_t *stateid = &write->wr_stateid; 982 stateid_t *stateid = &write->wr_stateid;
966 struct file *filp = NULL; 983 struct file *filp = NULL;
967 __be32 status = nfs_ok; 984 __be32 status = nfs_ok;
@@ -1034,8 +1051,9 @@ out_put_src:
1034 1051
1035static __be32 1052static __be32
1036nfsd4_clone(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 1053nfsd4_clone(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
1037 struct nfsd4_clone *clone) 1054 union nfsd4_op_u *u)
1038{ 1055{
1056 struct nfsd4_clone *clone = &u->clone;
1039 struct file *src, *dst; 1057 struct file *src, *dst;
1040 __be32 status; 1058 __be32 status;
1041 1059
@@ -1055,8 +1073,9 @@ out:
1055 1073
1056static __be32 1074static __be32
1057nfsd4_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 1075nfsd4_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
1058 struct nfsd4_copy *copy) 1076 union nfsd4_op_u *u)
1059{ 1077{
1078 struct nfsd4_copy *copy = &u->copy;
1060 struct file *src, *dst; 1079 struct file *src, *dst;
1061 __be32 status; 1080 __be32 status;
1062 ssize_t bytes; 1081 ssize_t bytes;
@@ -1111,23 +1130,24 @@ nfsd4_fallocate(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
1111 1130
1112static __be32 1131static __be32
1113nfsd4_allocate(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 1132nfsd4_allocate(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
1114 struct nfsd4_fallocate *fallocate) 1133 union nfsd4_op_u *u)
1115{ 1134{
1116 return nfsd4_fallocate(rqstp, cstate, fallocate, 0); 1135 return nfsd4_fallocate(rqstp, cstate, &u->allocate, 0);
1117} 1136}
1118 1137
1119static __be32 1138static __be32
1120nfsd4_deallocate(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 1139nfsd4_deallocate(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
1121 struct nfsd4_fallocate *fallocate) 1140 union nfsd4_op_u *u)
1122{ 1141{
1123 return nfsd4_fallocate(rqstp, cstate, fallocate, 1142 return nfsd4_fallocate(rqstp, cstate, &u->deallocate,
1124 FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE); 1143 FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE);
1125} 1144}
1126 1145
1127static __be32 1146static __be32
1128nfsd4_seek(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 1147nfsd4_seek(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
1129 struct nfsd4_seek *seek) 1148 union nfsd4_op_u *u)
1130{ 1149{
1150 struct nfsd4_seek *seek = &u->seek;
1131 int whence; 1151 int whence;
1132 __be32 status; 1152 __be32 status;
1133 struct file *file; 1153 struct file *file;
@@ -1232,21 +1252,21 @@ out_kfree:
1232 1252
1233static __be32 1253static __be32
1234nfsd4_nverify(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 1254nfsd4_nverify(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
1235 struct nfsd4_verify *verify) 1255 union nfsd4_op_u *u)
1236{ 1256{
1237 __be32 status; 1257 __be32 status;
1238 1258
1239 status = _nfsd4_verify(rqstp, cstate, verify); 1259 status = _nfsd4_verify(rqstp, cstate, &u->verify);
1240 return status == nfserr_not_same ? nfs_ok : status; 1260 return status == nfserr_not_same ? nfs_ok : status;
1241} 1261}
1242 1262
1243static __be32 1263static __be32
1244nfsd4_verify(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 1264nfsd4_verify(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
1245 struct nfsd4_verify *verify) 1265 union nfsd4_op_u *u)
1246{ 1266{
1247 __be32 status; 1267 __be32 status;
1248 1268
1249 status = _nfsd4_verify(rqstp, cstate, verify); 1269 status = _nfsd4_verify(rqstp, cstate, &u->nverify);
1250 return status == nfserr_same ? nfs_ok : status; 1270 return status == nfserr_same ? nfs_ok : status;
1251} 1271}
1252 1272
@@ -1271,9 +1291,9 @@ nfsd4_layout_verify(struct svc_export *exp, unsigned int layout_type)
1271 1291
1272static __be32 1292static __be32
1273nfsd4_getdeviceinfo(struct svc_rqst *rqstp, 1293nfsd4_getdeviceinfo(struct svc_rqst *rqstp,
1274 struct nfsd4_compound_state *cstate, 1294 struct nfsd4_compound_state *cstate, union nfsd4_op_u *u)
1275 struct nfsd4_getdeviceinfo *gdp)
1276{ 1295{
1296 struct nfsd4_getdeviceinfo *gdp = &u->getdeviceinfo;
1277 const struct nfsd4_layout_ops *ops; 1297 const struct nfsd4_layout_ops *ops;
1278 struct nfsd4_deviceid_map *map; 1298 struct nfsd4_deviceid_map *map;
1279 struct svc_export *exp; 1299 struct svc_export *exp;
@@ -1317,9 +1337,9 @@ out:
1317 1337
1318static __be32 1338static __be32
1319nfsd4_layoutget(struct svc_rqst *rqstp, 1339nfsd4_layoutget(struct svc_rqst *rqstp,
1320 struct nfsd4_compound_state *cstate, 1340 struct nfsd4_compound_state *cstate, union nfsd4_op_u *u)
1321 struct nfsd4_layoutget *lgp)
1322{ 1341{
1342 struct nfsd4_layoutget *lgp = &u->layoutget;
1323 struct svc_fh *current_fh = &cstate->current_fh; 1343 struct svc_fh *current_fh = &cstate->current_fh;
1324 const struct nfsd4_layout_ops *ops; 1344 const struct nfsd4_layout_ops *ops;
1325 struct nfs4_layout_stateid *ls; 1345 struct nfs4_layout_stateid *ls;
@@ -1397,9 +1417,9 @@ out:
1397 1417
1398static __be32 1418static __be32
1399nfsd4_layoutcommit(struct svc_rqst *rqstp, 1419nfsd4_layoutcommit(struct svc_rqst *rqstp,
1400 struct nfsd4_compound_state *cstate, 1420 struct nfsd4_compound_state *cstate, union nfsd4_op_u *u)
1401 struct nfsd4_layoutcommit *lcp)
1402{ 1421{
1422 struct nfsd4_layoutcommit *lcp = &u->layoutcommit;
1403 const struct nfsd4_layout_seg *seg = &lcp->lc_seg; 1423 const struct nfsd4_layout_seg *seg = &lcp->lc_seg;
1404 struct svc_fh *current_fh = &cstate->current_fh; 1424 struct svc_fh *current_fh = &cstate->current_fh;
1405 const struct nfsd4_layout_ops *ops; 1425 const struct nfsd4_layout_ops *ops;
@@ -1461,9 +1481,9 @@ out:
1461 1481
1462static __be32 1482static __be32
1463nfsd4_layoutreturn(struct svc_rqst *rqstp, 1483nfsd4_layoutreturn(struct svc_rqst *rqstp,
1464 struct nfsd4_compound_state *cstate, 1484 struct nfsd4_compound_state *cstate, union nfsd4_op_u *u)
1465 struct nfsd4_layoutreturn *lrp)
1466{ 1485{
1486 struct nfsd4_layoutreturn *lrp = &u->layoutreturn;
1467 struct svc_fh *current_fh = &cstate->current_fh; 1487 struct svc_fh *current_fh = &cstate->current_fh;
1468 __be32 nfserr; 1488 __be32 nfserr;
1469 1489
@@ -1510,7 +1530,7 @@ out:
1510 * NULL call. 1530 * NULL call.
1511 */ 1531 */
1512static __be32 1532static __be32
1513nfsd4_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) 1533nfsd4_proc_null(struct svc_rqst *rqstp)
1514{ 1534{
1515 return nfs_ok; 1535 return nfs_ok;
1516} 1536}
@@ -1521,12 +1541,6 @@ static inline void nfsd4_increment_op_stats(u32 opnum)
1521 nfsdstats.nfs4_opcount[opnum]++; 1541 nfsdstats.nfs4_opcount[opnum]++;
1522} 1542}
1523 1543
1524typedef __be32(*nfsd4op_func)(struct svc_rqst *, struct nfsd4_compound_state *,
1525 void *);
1526typedef u32(*nfsd4op_rsize)(struct svc_rqst *, struct nfsd4_op *op);
1527typedef void(*stateid_setter)(struct nfsd4_compound_state *, void *);
1528typedef void(*stateid_getter)(struct nfsd4_compound_state *, void *);
1529
1530enum nfsd4_op_flags { 1544enum nfsd4_op_flags {
1531 ALLOWED_WITHOUT_FH = 1 << 0, /* No current filehandle required */ 1545 ALLOWED_WITHOUT_FH = 1 << 0, /* No current filehandle required */
1532 ALLOWED_ON_ABSENT_FS = 1 << 1, /* ops processed on absent fs */ 1546 ALLOWED_ON_ABSENT_FS = 1 << 1, /* ops processed on absent fs */
@@ -1558,16 +1572,19 @@ enum nfsd4_op_flags {
1558}; 1572};
1559 1573
1560struct nfsd4_operation { 1574struct nfsd4_operation {
1561 nfsd4op_func op_func; 1575 __be32 (*op_func)(struct svc_rqst *, struct nfsd4_compound_state *,
1576 union nfsd4_op_u *);
1562 u32 op_flags; 1577 u32 op_flags;
1563 char *op_name; 1578 char *op_name;
1564 /* Try to get response size before operation */ 1579 /* Try to get response size before operation */
1565 nfsd4op_rsize op_rsize_bop; 1580 u32 (*op_rsize_bop)(struct svc_rqst *, struct nfsd4_op *);
1566 stateid_getter op_get_currentstateid; 1581 void (*op_get_currentstateid)(struct nfsd4_compound_state *,
1567 stateid_setter op_set_currentstateid; 1582 union nfsd4_op_u *);
1583 void (*op_set_currentstateid)(struct nfsd4_compound_state *,
1584 union nfsd4_op_u *);
1568}; 1585};
1569 1586
1570static struct nfsd4_operation nfsd4_ops[]; 1587static const struct nfsd4_operation nfsd4_ops[];
1571 1588
1572static const char *nfsd4_op_name(unsigned opnum); 1589static const char *nfsd4_op_name(unsigned opnum);
1573 1590
@@ -1604,7 +1621,7 @@ static __be32 nfs41_check_op_ordering(struct nfsd4_compoundargs *args)
1604 return nfs_ok; 1621 return nfs_ok;
1605} 1622}
1606 1623
1607static inline struct nfsd4_operation *OPDESC(struct nfsd4_op *op) 1624static inline const struct nfsd4_operation *OPDESC(struct nfsd4_op *op)
1608{ 1625{
1609 return &nfsd4_ops[op->opnum]; 1626 return &nfsd4_ops[op->opnum];
1610} 1627}
@@ -1622,10 +1639,9 @@ static bool need_wrongsec_check(struct svc_rqst *rqstp)
1622 struct nfsd4_compoundargs *argp = rqstp->rq_argp; 1639 struct nfsd4_compoundargs *argp = rqstp->rq_argp;
1623 struct nfsd4_op *this = &argp->ops[resp->opcnt - 1]; 1640 struct nfsd4_op *this = &argp->ops[resp->opcnt - 1];
1624 struct nfsd4_op *next = &argp->ops[resp->opcnt]; 1641 struct nfsd4_op *next = &argp->ops[resp->opcnt];
1625 struct nfsd4_operation *thisd; 1642 const struct nfsd4_operation *thisd = OPDESC(this);
1626 struct nfsd4_operation *nextd; 1643 const struct nfsd4_operation *nextd;
1627 1644
1628 thisd = OPDESC(this);
1629 /* 1645 /*
1630 * Most ops check wronsec on our own; only the putfh-like ops 1646 * Most ops check wronsec on our own; only the putfh-like ops
1631 * have special rules. 1647 * have special rules.
@@ -1673,12 +1689,12 @@ static void svcxdr_init_encode(struct svc_rqst *rqstp,
1673 * COMPOUND call. 1689 * COMPOUND call.
1674 */ 1690 */
1675static __be32 1691static __be32
1676nfsd4_proc_compound(struct svc_rqst *rqstp, 1692nfsd4_proc_compound(struct svc_rqst *rqstp)
1677 struct nfsd4_compoundargs *args,
1678 struct nfsd4_compoundres *resp)
1679{ 1693{
1694 struct nfsd4_compoundargs *args = rqstp->rq_argp;
1695 struct nfsd4_compoundres *resp = rqstp->rq_resp;
1680 struct nfsd4_op *op; 1696 struct nfsd4_op *op;
1681 struct nfsd4_operation *opdesc; 1697 const struct nfsd4_operation *opdesc;
1682 struct nfsd4_compound_state *cstate = &resp->cstate; 1698 struct nfsd4_compound_state *cstate = &resp->cstate;
1683 struct svc_fh *current_fh = &cstate->current_fh; 1699 struct svc_fh *current_fh = &cstate->current_fh;
1684 struct svc_fh *save_fh = &cstate->save_fh; 1700 struct svc_fh *save_fh = &cstate->save_fh;
@@ -2091,360 +2107,360 @@ static inline u32 nfsd4_seek_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
2091 return (op_encode_hdr_size + 3) * sizeof(__be32); 2107 return (op_encode_hdr_size + 3) * sizeof(__be32);
2092} 2108}
2093 2109
2094static struct nfsd4_operation nfsd4_ops[] = { 2110static const struct nfsd4_operation nfsd4_ops[] = {
2095 [OP_ACCESS] = { 2111 [OP_ACCESS] = {
2096 .op_func = (nfsd4op_func)nfsd4_access, 2112 .op_func = nfsd4_access,
2097 .op_name = "OP_ACCESS", 2113 .op_name = "OP_ACCESS",
2098 .op_rsize_bop = (nfsd4op_rsize)nfsd4_access_rsize, 2114 .op_rsize_bop = nfsd4_access_rsize,
2099 }, 2115 },
2100 [OP_CLOSE] = { 2116 [OP_CLOSE] = {
2101 .op_func = (nfsd4op_func)nfsd4_close, 2117 .op_func = nfsd4_close,
2102 .op_flags = OP_MODIFIES_SOMETHING, 2118 .op_flags = OP_MODIFIES_SOMETHING,
2103 .op_name = "OP_CLOSE", 2119 .op_name = "OP_CLOSE",
2104 .op_rsize_bop = (nfsd4op_rsize)nfsd4_status_stateid_rsize, 2120 .op_rsize_bop = nfsd4_status_stateid_rsize,
2105 .op_get_currentstateid = (stateid_getter)nfsd4_get_closestateid, 2121 .op_get_currentstateid = nfsd4_get_closestateid,
2106 .op_set_currentstateid = (stateid_setter)nfsd4_set_closestateid, 2122 .op_set_currentstateid = nfsd4_set_closestateid,
2107 }, 2123 },
2108 [OP_COMMIT] = { 2124 [OP_COMMIT] = {
2109 .op_func = (nfsd4op_func)nfsd4_commit, 2125 .op_func = nfsd4_commit,
2110 .op_flags = OP_MODIFIES_SOMETHING, 2126 .op_flags = OP_MODIFIES_SOMETHING,
2111 .op_name = "OP_COMMIT", 2127 .op_name = "OP_COMMIT",
2112 .op_rsize_bop = (nfsd4op_rsize)nfsd4_commit_rsize, 2128 .op_rsize_bop = nfsd4_commit_rsize,
2113 }, 2129 },
2114 [OP_CREATE] = { 2130 [OP_CREATE] = {
2115 .op_func = (nfsd4op_func)nfsd4_create, 2131 .op_func = nfsd4_create,
2116 .op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME | OP_CLEAR_STATEID, 2132 .op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME | OP_CLEAR_STATEID,
2117 .op_name = "OP_CREATE", 2133 .op_name = "OP_CREATE",
2118 .op_rsize_bop = (nfsd4op_rsize)nfsd4_create_rsize, 2134 .op_rsize_bop = nfsd4_create_rsize,
2119 }, 2135 },
2120 [OP_DELEGRETURN] = { 2136 [OP_DELEGRETURN] = {
2121 .op_func = (nfsd4op_func)nfsd4_delegreturn, 2137 .op_func = nfsd4_delegreturn,
2122 .op_flags = OP_MODIFIES_SOMETHING, 2138 .op_flags = OP_MODIFIES_SOMETHING,
2123 .op_name = "OP_DELEGRETURN", 2139 .op_name = "OP_DELEGRETURN",
2124 .op_rsize_bop = nfsd4_only_status_rsize, 2140 .op_rsize_bop = nfsd4_only_status_rsize,
2125 .op_get_currentstateid = (stateid_getter)nfsd4_get_delegreturnstateid, 2141 .op_get_currentstateid = nfsd4_get_delegreturnstateid,
2126 }, 2142 },
2127 [OP_GETATTR] = { 2143 [OP_GETATTR] = {
2128 .op_func = (nfsd4op_func)nfsd4_getattr, 2144 .op_func = nfsd4_getattr,
2129 .op_flags = ALLOWED_ON_ABSENT_FS, 2145 .op_flags = ALLOWED_ON_ABSENT_FS,
2130 .op_rsize_bop = nfsd4_getattr_rsize, 2146 .op_rsize_bop = nfsd4_getattr_rsize,
2131 .op_name = "OP_GETATTR", 2147 .op_name = "OP_GETATTR",
2132 }, 2148 },
2133 [OP_GETFH] = { 2149 [OP_GETFH] = {
2134 .op_func = (nfsd4op_func)nfsd4_getfh, 2150 .op_func = nfsd4_getfh,
2135 .op_name = "OP_GETFH", 2151 .op_name = "OP_GETFH",
2136 .op_rsize_bop = (nfsd4op_rsize)nfsd4_getfh_rsize, 2152 .op_rsize_bop = nfsd4_getfh_rsize,
2137 }, 2153 },
2138 [OP_LINK] = { 2154 [OP_LINK] = {
2139 .op_func = (nfsd4op_func)nfsd4_link, 2155 .op_func = nfsd4_link,
2140 .op_flags = ALLOWED_ON_ABSENT_FS | OP_MODIFIES_SOMETHING 2156 .op_flags = ALLOWED_ON_ABSENT_FS | OP_MODIFIES_SOMETHING
2141 | OP_CACHEME, 2157 | OP_CACHEME,
2142 .op_name = "OP_LINK", 2158 .op_name = "OP_LINK",
2143 .op_rsize_bop = (nfsd4op_rsize)nfsd4_link_rsize, 2159 .op_rsize_bop = nfsd4_link_rsize,
2144 }, 2160 },
2145 [OP_LOCK] = { 2161 [OP_LOCK] = {
2146 .op_func = (nfsd4op_func)nfsd4_lock, 2162 .op_func = nfsd4_lock,
2147 .op_flags = OP_MODIFIES_SOMETHING, 2163 .op_flags = OP_MODIFIES_SOMETHING,
2148 .op_name = "OP_LOCK", 2164 .op_name = "OP_LOCK",
2149 .op_rsize_bop = (nfsd4op_rsize)nfsd4_lock_rsize, 2165 .op_rsize_bop = nfsd4_lock_rsize,
2150 .op_set_currentstateid = (stateid_setter)nfsd4_set_lockstateid, 2166 .op_set_currentstateid = nfsd4_set_lockstateid,
2151 }, 2167 },
2152 [OP_LOCKT] = { 2168 [OP_LOCKT] = {
2153 .op_func = (nfsd4op_func)nfsd4_lockt, 2169 .op_func = nfsd4_lockt,
2154 .op_name = "OP_LOCKT", 2170 .op_name = "OP_LOCKT",
2155 .op_rsize_bop = (nfsd4op_rsize)nfsd4_lock_rsize, 2171 .op_rsize_bop = nfsd4_lock_rsize,
2156 }, 2172 },
2157 [OP_LOCKU] = { 2173 [OP_LOCKU] = {
2158 .op_func = (nfsd4op_func)nfsd4_locku, 2174 .op_func = nfsd4_locku,
2159 .op_flags = OP_MODIFIES_SOMETHING, 2175 .op_flags = OP_MODIFIES_SOMETHING,
2160 .op_name = "OP_LOCKU", 2176 .op_name = "OP_LOCKU",
2161 .op_rsize_bop = (nfsd4op_rsize)nfsd4_status_stateid_rsize, 2177 .op_rsize_bop = nfsd4_status_stateid_rsize,
2162 .op_get_currentstateid = (stateid_getter)nfsd4_get_lockustateid, 2178 .op_get_currentstateid = nfsd4_get_lockustateid,
2163 }, 2179 },
2164 [OP_LOOKUP] = { 2180 [OP_LOOKUP] = {
2165 .op_func = (nfsd4op_func)nfsd4_lookup, 2181 .op_func = nfsd4_lookup,
2166 .op_flags = OP_HANDLES_WRONGSEC | OP_CLEAR_STATEID, 2182 .op_flags = OP_HANDLES_WRONGSEC | OP_CLEAR_STATEID,
2167 .op_name = "OP_LOOKUP", 2183 .op_name = "OP_LOOKUP",
2168 .op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize, 2184 .op_rsize_bop = nfsd4_only_status_rsize,
2169 }, 2185 },
2170 [OP_LOOKUPP] = { 2186 [OP_LOOKUPP] = {
2171 .op_func = (nfsd4op_func)nfsd4_lookupp, 2187 .op_func = nfsd4_lookupp,
2172 .op_flags = OP_HANDLES_WRONGSEC | OP_CLEAR_STATEID, 2188 .op_flags = OP_HANDLES_WRONGSEC | OP_CLEAR_STATEID,
2173 .op_name = "OP_LOOKUPP", 2189 .op_name = "OP_LOOKUPP",
2174 .op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize, 2190 .op_rsize_bop = nfsd4_only_status_rsize,
2175 }, 2191 },
2176 [OP_NVERIFY] = { 2192 [OP_NVERIFY] = {
2177 .op_func = (nfsd4op_func)nfsd4_nverify, 2193 .op_func = nfsd4_nverify,
2178 .op_name = "OP_NVERIFY", 2194 .op_name = "OP_NVERIFY",
2179 .op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize, 2195 .op_rsize_bop = nfsd4_only_status_rsize,
2180 }, 2196 },
2181 [OP_OPEN] = { 2197 [OP_OPEN] = {
2182 .op_func = (nfsd4op_func)nfsd4_open, 2198 .op_func = nfsd4_open,
2183 .op_flags = OP_HANDLES_WRONGSEC | OP_MODIFIES_SOMETHING, 2199 .op_flags = OP_HANDLES_WRONGSEC | OP_MODIFIES_SOMETHING,
2184 .op_name = "OP_OPEN", 2200 .op_name = "OP_OPEN",
2185 .op_rsize_bop = (nfsd4op_rsize)nfsd4_open_rsize, 2201 .op_rsize_bop = nfsd4_open_rsize,
2186 .op_set_currentstateid = (stateid_setter)nfsd4_set_openstateid, 2202 .op_set_currentstateid = nfsd4_set_openstateid,
2187 }, 2203 },
2188 [OP_OPEN_CONFIRM] = { 2204 [OP_OPEN_CONFIRM] = {
2189 .op_func = (nfsd4op_func)nfsd4_open_confirm, 2205 .op_func = nfsd4_open_confirm,
2190 .op_flags = OP_MODIFIES_SOMETHING, 2206 .op_flags = OP_MODIFIES_SOMETHING,
2191 .op_name = "OP_OPEN_CONFIRM", 2207 .op_name = "OP_OPEN_CONFIRM",
2192 .op_rsize_bop = (nfsd4op_rsize)nfsd4_status_stateid_rsize, 2208 .op_rsize_bop = nfsd4_status_stateid_rsize,
2193 }, 2209 },
2194 [OP_OPEN_DOWNGRADE] = { 2210 [OP_OPEN_DOWNGRADE] = {
2195 .op_func = (nfsd4op_func)nfsd4_open_downgrade, 2211 .op_func = nfsd4_open_downgrade,
2196 .op_flags = OP_MODIFIES_SOMETHING, 2212 .op_flags = OP_MODIFIES_SOMETHING,
2197 .op_name = "OP_OPEN_DOWNGRADE", 2213 .op_name = "OP_OPEN_DOWNGRADE",
2198 .op_rsize_bop = (nfsd4op_rsize)nfsd4_status_stateid_rsize, 2214 .op_rsize_bop = nfsd4_status_stateid_rsize,
2199 .op_get_currentstateid = (stateid_getter)nfsd4_get_opendowngradestateid, 2215 .op_get_currentstateid = nfsd4_get_opendowngradestateid,
2200 .op_set_currentstateid = (stateid_setter)nfsd4_set_opendowngradestateid, 2216 .op_set_currentstateid = nfsd4_set_opendowngradestateid,
2201 }, 2217 },
2202 [OP_PUTFH] = { 2218 [OP_PUTFH] = {
2203 .op_func = (nfsd4op_func)nfsd4_putfh, 2219 .op_func = nfsd4_putfh,
2204 .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS 2220 .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS
2205 | OP_IS_PUTFH_LIKE | OP_CLEAR_STATEID, 2221 | OP_IS_PUTFH_LIKE | OP_CLEAR_STATEID,
2206 .op_name = "OP_PUTFH", 2222 .op_name = "OP_PUTFH",
2207 .op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize, 2223 .op_rsize_bop = nfsd4_only_status_rsize,
2208 }, 2224 },
2209 [OP_PUTPUBFH] = { 2225 [OP_PUTPUBFH] = {
2210 .op_func = (nfsd4op_func)nfsd4_putrootfh, 2226 .op_func = nfsd4_putrootfh,
2211 .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS 2227 .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS
2212 | OP_IS_PUTFH_LIKE | OP_CLEAR_STATEID, 2228 | OP_IS_PUTFH_LIKE | OP_CLEAR_STATEID,
2213 .op_name = "OP_PUTPUBFH", 2229 .op_name = "OP_PUTPUBFH",
2214 .op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize, 2230 .op_rsize_bop = nfsd4_only_status_rsize,
2215 }, 2231 },
2216 [OP_PUTROOTFH] = { 2232 [OP_PUTROOTFH] = {
2217 .op_func = (nfsd4op_func)nfsd4_putrootfh, 2233 .op_func = nfsd4_putrootfh,
2218 .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS 2234 .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS
2219 | OP_IS_PUTFH_LIKE | OP_CLEAR_STATEID, 2235 | OP_IS_PUTFH_LIKE | OP_CLEAR_STATEID,
2220 .op_name = "OP_PUTROOTFH", 2236 .op_name = "OP_PUTROOTFH",
2221 .op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize, 2237 .op_rsize_bop = nfsd4_only_status_rsize,
2222 }, 2238 },
2223 [OP_READ] = { 2239 [OP_READ] = {
2224 .op_func = (nfsd4op_func)nfsd4_read, 2240 .op_func = nfsd4_read,
2225 .op_name = "OP_READ", 2241 .op_name = "OP_READ",
2226 .op_rsize_bop = (nfsd4op_rsize)nfsd4_read_rsize, 2242 .op_rsize_bop = nfsd4_read_rsize,
2227 .op_get_currentstateid = (stateid_getter)nfsd4_get_readstateid, 2243 .op_get_currentstateid = nfsd4_get_readstateid,
2228 }, 2244 },
2229 [OP_READDIR] = { 2245 [OP_READDIR] = {
2230 .op_func = (nfsd4op_func)nfsd4_readdir, 2246 .op_func = nfsd4_readdir,
2231 .op_name = "OP_READDIR", 2247 .op_name = "OP_READDIR",
2232 .op_rsize_bop = (nfsd4op_rsize)nfsd4_readdir_rsize, 2248 .op_rsize_bop = nfsd4_readdir_rsize,
2233 }, 2249 },
2234 [OP_READLINK] = { 2250 [OP_READLINK] = {
2235 .op_func = (nfsd4op_func)nfsd4_readlink, 2251 .op_func = nfsd4_readlink,
2236 .op_name = "OP_READLINK", 2252 .op_name = "OP_READLINK",
2237 .op_rsize_bop = (nfsd4op_rsize)nfsd4_readlink_rsize, 2253 .op_rsize_bop = nfsd4_readlink_rsize,
2238 }, 2254 },
2239 [OP_REMOVE] = { 2255 [OP_REMOVE] = {
2240 .op_func = (nfsd4op_func)nfsd4_remove, 2256 .op_func = nfsd4_remove,
2241 .op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME, 2257 .op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME,
2242 .op_name = "OP_REMOVE", 2258 .op_name = "OP_REMOVE",
2243 .op_rsize_bop = (nfsd4op_rsize)nfsd4_remove_rsize, 2259 .op_rsize_bop = nfsd4_remove_rsize,
2244 }, 2260 },
2245 [OP_RENAME] = { 2261 [OP_RENAME] = {
2246 .op_func = (nfsd4op_func)nfsd4_rename, 2262 .op_func = nfsd4_rename,
2247 .op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME, 2263 .op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME,
2248 .op_name = "OP_RENAME", 2264 .op_name = "OP_RENAME",
2249 .op_rsize_bop = (nfsd4op_rsize)nfsd4_rename_rsize, 2265 .op_rsize_bop = nfsd4_rename_rsize,
2250 }, 2266 },
2251 [OP_RENEW] = { 2267 [OP_RENEW] = {
2252 .op_func = (nfsd4op_func)nfsd4_renew, 2268 .op_func = nfsd4_renew,
2253 .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS 2269 .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS
2254 | OP_MODIFIES_SOMETHING, 2270 | OP_MODIFIES_SOMETHING,
2255 .op_name = "OP_RENEW", 2271 .op_name = "OP_RENEW",
2256 .op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize, 2272 .op_rsize_bop = nfsd4_only_status_rsize,
2257 2273
2258 }, 2274 },
2259 [OP_RESTOREFH] = { 2275 [OP_RESTOREFH] = {
2260 .op_func = (nfsd4op_func)nfsd4_restorefh, 2276 .op_func = nfsd4_restorefh,
2261 .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS 2277 .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS
2262 | OP_IS_PUTFH_LIKE | OP_MODIFIES_SOMETHING, 2278 | OP_IS_PUTFH_LIKE | OP_MODIFIES_SOMETHING,
2263 .op_name = "OP_RESTOREFH", 2279 .op_name = "OP_RESTOREFH",
2264 .op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize, 2280 .op_rsize_bop = nfsd4_only_status_rsize,
2265 }, 2281 },
2266 [OP_SAVEFH] = { 2282 [OP_SAVEFH] = {
2267 .op_func = (nfsd4op_func)nfsd4_savefh, 2283 .op_func = nfsd4_savefh,
2268 .op_flags = OP_HANDLES_WRONGSEC | OP_MODIFIES_SOMETHING, 2284 .op_flags = OP_HANDLES_WRONGSEC | OP_MODIFIES_SOMETHING,
2269 .op_name = "OP_SAVEFH", 2285 .op_name = "OP_SAVEFH",
2270 .op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize, 2286 .op_rsize_bop = nfsd4_only_status_rsize,
2271 }, 2287 },
2272 [OP_SECINFO] = { 2288 [OP_SECINFO] = {
2273 .op_func = (nfsd4op_func)nfsd4_secinfo, 2289 .op_func = nfsd4_secinfo,
2274 .op_flags = OP_HANDLES_WRONGSEC, 2290 .op_flags = OP_HANDLES_WRONGSEC,
2275 .op_name = "OP_SECINFO", 2291 .op_name = "OP_SECINFO",
2276 .op_rsize_bop = (nfsd4op_rsize)nfsd4_secinfo_rsize, 2292 .op_rsize_bop = nfsd4_secinfo_rsize,
2277 }, 2293 },
2278 [OP_SETATTR] = { 2294 [OP_SETATTR] = {
2279 .op_func = (nfsd4op_func)nfsd4_setattr, 2295 .op_func = nfsd4_setattr,
2280 .op_name = "OP_SETATTR", 2296 .op_name = "OP_SETATTR",
2281 .op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME, 2297 .op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME,
2282 .op_rsize_bop = (nfsd4op_rsize)nfsd4_setattr_rsize, 2298 .op_rsize_bop = nfsd4_setattr_rsize,
2283 .op_get_currentstateid = (stateid_getter)nfsd4_get_setattrstateid, 2299 .op_get_currentstateid = nfsd4_get_setattrstateid,
2284 }, 2300 },
2285 [OP_SETCLIENTID] = { 2301 [OP_SETCLIENTID] = {
2286 .op_func = (nfsd4op_func)nfsd4_setclientid, 2302 .op_func = nfsd4_setclientid,
2287 .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS 2303 .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS
2288 | OP_MODIFIES_SOMETHING | OP_CACHEME, 2304 | OP_MODIFIES_SOMETHING | OP_CACHEME,
2289 .op_name = "OP_SETCLIENTID", 2305 .op_name = "OP_SETCLIENTID",
2290 .op_rsize_bop = (nfsd4op_rsize)nfsd4_setclientid_rsize, 2306 .op_rsize_bop = nfsd4_setclientid_rsize,
2291 }, 2307 },
2292 [OP_SETCLIENTID_CONFIRM] = { 2308 [OP_SETCLIENTID_CONFIRM] = {
2293 .op_func = (nfsd4op_func)nfsd4_setclientid_confirm, 2309 .op_func = nfsd4_setclientid_confirm,
2294 .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS 2310 .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS
2295 | OP_MODIFIES_SOMETHING | OP_CACHEME, 2311 | OP_MODIFIES_SOMETHING | OP_CACHEME,
2296 .op_name = "OP_SETCLIENTID_CONFIRM", 2312 .op_name = "OP_SETCLIENTID_CONFIRM",
2297 .op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize, 2313 .op_rsize_bop = nfsd4_only_status_rsize,
2298 }, 2314 },
2299 [OP_VERIFY] = { 2315 [OP_VERIFY] = {
2300 .op_func = (nfsd4op_func)nfsd4_verify, 2316 .op_func = nfsd4_verify,
2301 .op_name = "OP_VERIFY", 2317 .op_name = "OP_VERIFY",
2302 .op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize, 2318 .op_rsize_bop = nfsd4_only_status_rsize,
2303 }, 2319 },
2304 [OP_WRITE] = { 2320 [OP_WRITE] = {
2305 .op_func = (nfsd4op_func)nfsd4_write, 2321 .op_func = nfsd4_write,
2306 .op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME, 2322 .op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME,
2307 .op_name = "OP_WRITE", 2323 .op_name = "OP_WRITE",
2308 .op_rsize_bop = (nfsd4op_rsize)nfsd4_write_rsize, 2324 .op_rsize_bop = nfsd4_write_rsize,
2309 .op_get_currentstateid = (stateid_getter)nfsd4_get_writestateid, 2325 .op_get_currentstateid = nfsd4_get_writestateid,
2310 }, 2326 },
2311 [OP_RELEASE_LOCKOWNER] = { 2327 [OP_RELEASE_LOCKOWNER] = {
2312 .op_func = (nfsd4op_func)nfsd4_release_lockowner, 2328 .op_func = nfsd4_release_lockowner,
2313 .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS 2329 .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS
2314 | OP_MODIFIES_SOMETHING, 2330 | OP_MODIFIES_SOMETHING,
2315 .op_name = "OP_RELEASE_LOCKOWNER", 2331 .op_name = "OP_RELEASE_LOCKOWNER",
2316 .op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize, 2332 .op_rsize_bop = nfsd4_only_status_rsize,
2317 }, 2333 },
2318 2334
2319 /* NFSv4.1 operations */ 2335 /* NFSv4.1 operations */
2320 [OP_EXCHANGE_ID] = { 2336 [OP_EXCHANGE_ID] = {
2321 .op_func = (nfsd4op_func)nfsd4_exchange_id, 2337 .op_func = nfsd4_exchange_id,
2322 .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_AS_FIRST_OP 2338 .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_AS_FIRST_OP
2323 | OP_MODIFIES_SOMETHING, 2339 | OP_MODIFIES_SOMETHING,
2324 .op_name = "OP_EXCHANGE_ID", 2340 .op_name = "OP_EXCHANGE_ID",
2325 .op_rsize_bop = (nfsd4op_rsize)nfsd4_exchange_id_rsize, 2341 .op_rsize_bop = nfsd4_exchange_id_rsize,
2326 }, 2342 },
2327 [OP_BACKCHANNEL_CTL] = { 2343 [OP_BACKCHANNEL_CTL] = {
2328 .op_func = (nfsd4op_func)nfsd4_backchannel_ctl, 2344 .op_func = nfsd4_backchannel_ctl,
2329 .op_flags = ALLOWED_WITHOUT_FH | OP_MODIFIES_SOMETHING, 2345 .op_flags = ALLOWED_WITHOUT_FH | OP_MODIFIES_SOMETHING,
2330 .op_name = "OP_BACKCHANNEL_CTL", 2346 .op_name = "OP_BACKCHANNEL_CTL",
2331 .op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize, 2347 .op_rsize_bop = nfsd4_only_status_rsize,
2332 }, 2348 },
2333 [OP_BIND_CONN_TO_SESSION] = { 2349 [OP_BIND_CONN_TO_SESSION] = {
2334 .op_func = (nfsd4op_func)nfsd4_bind_conn_to_session, 2350 .op_func = nfsd4_bind_conn_to_session,
2335 .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_AS_FIRST_OP 2351 .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_AS_FIRST_OP
2336 | OP_MODIFIES_SOMETHING, 2352 | OP_MODIFIES_SOMETHING,
2337 .op_name = "OP_BIND_CONN_TO_SESSION", 2353 .op_name = "OP_BIND_CONN_TO_SESSION",
2338 .op_rsize_bop = (nfsd4op_rsize)nfsd4_bind_conn_to_session_rsize, 2354 .op_rsize_bop = nfsd4_bind_conn_to_session_rsize,
2339 }, 2355 },
2340 [OP_CREATE_SESSION] = { 2356 [OP_CREATE_SESSION] = {
2341 .op_func = (nfsd4op_func)nfsd4_create_session, 2357 .op_func = nfsd4_create_session,
2342 .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_AS_FIRST_OP 2358 .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_AS_FIRST_OP
2343 | OP_MODIFIES_SOMETHING, 2359 | OP_MODIFIES_SOMETHING,
2344 .op_name = "OP_CREATE_SESSION", 2360 .op_name = "OP_CREATE_SESSION",
2345 .op_rsize_bop = (nfsd4op_rsize)nfsd4_create_session_rsize, 2361 .op_rsize_bop = nfsd4_create_session_rsize,
2346 }, 2362 },
2347 [OP_DESTROY_SESSION] = { 2363 [OP_DESTROY_SESSION] = {
2348 .op_func = (nfsd4op_func)nfsd4_destroy_session, 2364 .op_func = nfsd4_destroy_session,
2349 .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_AS_FIRST_OP 2365 .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_AS_FIRST_OP
2350 | OP_MODIFIES_SOMETHING, 2366 | OP_MODIFIES_SOMETHING,
2351 .op_name = "OP_DESTROY_SESSION", 2367 .op_name = "OP_DESTROY_SESSION",
2352 .op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize, 2368 .op_rsize_bop = nfsd4_only_status_rsize,
2353 }, 2369 },
2354 [OP_SEQUENCE] = { 2370 [OP_SEQUENCE] = {
2355 .op_func = (nfsd4op_func)nfsd4_sequence, 2371 .op_func = nfsd4_sequence,
2356 .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_AS_FIRST_OP, 2372 .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_AS_FIRST_OP,
2357 .op_name = "OP_SEQUENCE", 2373 .op_name = "OP_SEQUENCE",
2358 .op_rsize_bop = (nfsd4op_rsize)nfsd4_sequence_rsize, 2374 .op_rsize_bop = nfsd4_sequence_rsize,
2359 }, 2375 },
2360 [OP_DESTROY_CLIENTID] = { 2376 [OP_DESTROY_CLIENTID] = {
2361 .op_func = (nfsd4op_func)nfsd4_destroy_clientid, 2377 .op_func = nfsd4_destroy_clientid,
2362 .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_AS_FIRST_OP 2378 .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_AS_FIRST_OP
2363 | OP_MODIFIES_SOMETHING, 2379 | OP_MODIFIES_SOMETHING,
2364 .op_name = "OP_DESTROY_CLIENTID", 2380 .op_name = "OP_DESTROY_CLIENTID",
2365 .op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize, 2381 .op_rsize_bop = nfsd4_only_status_rsize,
2366 }, 2382 },
2367 [OP_RECLAIM_COMPLETE] = { 2383 [OP_RECLAIM_COMPLETE] = {
2368 .op_func = (nfsd4op_func)nfsd4_reclaim_complete, 2384 .op_func = nfsd4_reclaim_complete,
2369 .op_flags = ALLOWED_WITHOUT_FH | OP_MODIFIES_SOMETHING, 2385 .op_flags = ALLOWED_WITHOUT_FH | OP_MODIFIES_SOMETHING,
2370 .op_name = "OP_RECLAIM_COMPLETE", 2386 .op_name = "OP_RECLAIM_COMPLETE",
2371 .op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize, 2387 .op_rsize_bop = nfsd4_only_status_rsize,
2372 }, 2388 },
2373 [OP_SECINFO_NO_NAME] = { 2389 [OP_SECINFO_NO_NAME] = {
2374 .op_func = (nfsd4op_func)nfsd4_secinfo_no_name, 2390 .op_func = nfsd4_secinfo_no_name,
2375 .op_flags = OP_HANDLES_WRONGSEC, 2391 .op_flags = OP_HANDLES_WRONGSEC,
2376 .op_name = "OP_SECINFO_NO_NAME", 2392 .op_name = "OP_SECINFO_NO_NAME",
2377 .op_rsize_bop = (nfsd4op_rsize)nfsd4_secinfo_rsize, 2393 .op_rsize_bop = nfsd4_secinfo_rsize,
2378 }, 2394 },
2379 [OP_TEST_STATEID] = { 2395 [OP_TEST_STATEID] = {
2380 .op_func = (nfsd4op_func)nfsd4_test_stateid, 2396 .op_func = nfsd4_test_stateid,
2381 .op_flags = ALLOWED_WITHOUT_FH, 2397 .op_flags = ALLOWED_WITHOUT_FH,
2382 .op_name = "OP_TEST_STATEID", 2398 .op_name = "OP_TEST_STATEID",
2383 .op_rsize_bop = (nfsd4op_rsize)nfsd4_test_stateid_rsize, 2399 .op_rsize_bop = nfsd4_test_stateid_rsize,
2384 }, 2400 },
2385 [OP_FREE_STATEID] = { 2401 [OP_FREE_STATEID] = {
2386 .op_func = (nfsd4op_func)nfsd4_free_stateid, 2402 .op_func = nfsd4_free_stateid,
2387 .op_flags = ALLOWED_WITHOUT_FH | OP_MODIFIES_SOMETHING, 2403 .op_flags = ALLOWED_WITHOUT_FH | OP_MODIFIES_SOMETHING,
2388 .op_name = "OP_FREE_STATEID", 2404 .op_name = "OP_FREE_STATEID",
2389 .op_get_currentstateid = (stateid_getter)nfsd4_get_freestateid, 2405 .op_get_currentstateid = nfsd4_get_freestateid,
2390 .op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize, 2406 .op_rsize_bop = nfsd4_only_status_rsize,
2391 }, 2407 },
2392#ifdef CONFIG_NFSD_PNFS 2408#ifdef CONFIG_NFSD_PNFS
2393 [OP_GETDEVICEINFO] = { 2409 [OP_GETDEVICEINFO] = {
2394 .op_func = (nfsd4op_func)nfsd4_getdeviceinfo, 2410 .op_func = nfsd4_getdeviceinfo,
2395 .op_flags = ALLOWED_WITHOUT_FH, 2411 .op_flags = ALLOWED_WITHOUT_FH,
2396 .op_name = "OP_GETDEVICEINFO", 2412 .op_name = "OP_GETDEVICEINFO",
2397 .op_rsize_bop = (nfsd4op_rsize)nfsd4_getdeviceinfo_rsize, 2413 .op_rsize_bop = nfsd4_getdeviceinfo_rsize,
2398 }, 2414 },
2399 [OP_LAYOUTGET] = { 2415 [OP_LAYOUTGET] = {
2400 .op_func = (nfsd4op_func)nfsd4_layoutget, 2416 .op_func = nfsd4_layoutget,
2401 .op_flags = OP_MODIFIES_SOMETHING, 2417 .op_flags = OP_MODIFIES_SOMETHING,
2402 .op_name = "OP_LAYOUTGET", 2418 .op_name = "OP_LAYOUTGET",
2403 .op_rsize_bop = (nfsd4op_rsize)nfsd4_layoutget_rsize, 2419 .op_rsize_bop = nfsd4_layoutget_rsize,
2404 }, 2420 },
2405 [OP_LAYOUTCOMMIT] = { 2421 [OP_LAYOUTCOMMIT] = {
2406 .op_func = (nfsd4op_func)nfsd4_layoutcommit, 2422 .op_func = nfsd4_layoutcommit,
2407 .op_flags = OP_MODIFIES_SOMETHING, 2423 .op_flags = OP_MODIFIES_SOMETHING,
2408 .op_name = "OP_LAYOUTCOMMIT", 2424 .op_name = "OP_LAYOUTCOMMIT",
2409 .op_rsize_bop = (nfsd4op_rsize)nfsd4_layoutcommit_rsize, 2425 .op_rsize_bop = nfsd4_layoutcommit_rsize,
2410 }, 2426 },
2411 [OP_LAYOUTRETURN] = { 2427 [OP_LAYOUTRETURN] = {
2412 .op_func = (nfsd4op_func)nfsd4_layoutreturn, 2428 .op_func = nfsd4_layoutreturn,
2413 .op_flags = OP_MODIFIES_SOMETHING, 2429 .op_flags = OP_MODIFIES_SOMETHING,
2414 .op_name = "OP_LAYOUTRETURN", 2430 .op_name = "OP_LAYOUTRETURN",
2415 .op_rsize_bop = (nfsd4op_rsize)nfsd4_layoutreturn_rsize, 2431 .op_rsize_bop = nfsd4_layoutreturn_rsize,
2416 }, 2432 },
2417#endif /* CONFIG_NFSD_PNFS */ 2433#endif /* CONFIG_NFSD_PNFS */
2418 2434
2419 /* NFSv4.2 operations */ 2435 /* NFSv4.2 operations */
2420 [OP_ALLOCATE] = { 2436 [OP_ALLOCATE] = {
2421 .op_func = (nfsd4op_func)nfsd4_allocate, 2437 .op_func = nfsd4_allocate,
2422 .op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME, 2438 .op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME,
2423 .op_name = "OP_ALLOCATE", 2439 .op_name = "OP_ALLOCATE",
2424 .op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize, 2440 .op_rsize_bop = nfsd4_only_status_rsize,
2425 }, 2441 },
2426 [OP_DEALLOCATE] = { 2442 [OP_DEALLOCATE] = {
2427 .op_func = (nfsd4op_func)nfsd4_deallocate, 2443 .op_func = nfsd4_deallocate,
2428 .op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME, 2444 .op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME,
2429 .op_name = "OP_DEALLOCATE", 2445 .op_name = "OP_DEALLOCATE",
2430 .op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize, 2446 .op_rsize_bop = nfsd4_only_status_rsize,
2431 }, 2447 },
2432 [OP_CLONE] = { 2448 [OP_CLONE] = {
2433 .op_func = (nfsd4op_func)nfsd4_clone, 2449 .op_func = nfsd4_clone,
2434 .op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME, 2450 .op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME,
2435 .op_name = "OP_CLONE", 2451 .op_name = "OP_CLONE",
2436 .op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize, 2452 .op_rsize_bop = nfsd4_only_status_rsize,
2437 }, 2453 },
2438 [OP_COPY] = { 2454 [OP_COPY] = {
2439 .op_func = (nfsd4op_func)nfsd4_copy, 2455 .op_func = nfsd4_copy,
2440 .op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME, 2456 .op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME,
2441 .op_name = "OP_COPY", 2457 .op_name = "OP_COPY",
2442 .op_rsize_bop = (nfsd4op_rsize)nfsd4_copy_rsize, 2458 .op_rsize_bop = nfsd4_copy_rsize,
2443 }, 2459 },
2444 [OP_SEEK] = { 2460 [OP_SEEK] = {
2445 .op_func = (nfsd4op_func)nfsd4_seek, 2461 .op_func = nfsd4_seek,
2446 .op_name = "OP_SEEK", 2462 .op_name = "OP_SEEK",
2447 .op_rsize_bop = (nfsd4op_rsize)nfsd4_seek_rsize, 2463 .op_rsize_bop = nfsd4_seek_rsize,
2448 }, 2464 },
2449}; 2465};
2450 2466
@@ -2515,19 +2531,19 @@ static const char *nfsd4_op_name(unsigned opnum)
2515#define nfsd4_voidres nfsd4_voidargs 2531#define nfsd4_voidres nfsd4_voidargs
2516struct nfsd4_voidargs { int dummy; }; 2532struct nfsd4_voidargs { int dummy; };
2517 2533
2518static struct svc_procedure nfsd_procedures4[2] = { 2534static const struct svc_procedure nfsd_procedures4[2] = {
2519 [NFSPROC4_NULL] = { 2535 [NFSPROC4_NULL] = {
2520 .pc_func = (svc_procfunc) nfsd4_proc_null, 2536 .pc_func = nfsd4_proc_null,
2521 .pc_encode = (kxdrproc_t) nfs4svc_encode_voidres, 2537 .pc_encode = nfs4svc_encode_voidres,
2522 .pc_argsize = sizeof(struct nfsd4_voidargs), 2538 .pc_argsize = sizeof(struct nfsd4_voidargs),
2523 .pc_ressize = sizeof(struct nfsd4_voidres), 2539 .pc_ressize = sizeof(struct nfsd4_voidres),
2524 .pc_cachetype = RC_NOCACHE, 2540 .pc_cachetype = RC_NOCACHE,
2525 .pc_xdrressize = 1, 2541 .pc_xdrressize = 1,
2526 }, 2542 },
2527 [NFSPROC4_COMPOUND] = { 2543 [NFSPROC4_COMPOUND] = {
2528 .pc_func = (svc_procfunc) nfsd4_proc_compound, 2544 .pc_func = nfsd4_proc_compound,
2529 .pc_decode = (kxdrproc_t) nfs4svc_decode_compoundargs, 2545 .pc_decode = nfs4svc_decode_compoundargs,
2530 .pc_encode = (kxdrproc_t) nfs4svc_encode_compoundres, 2546 .pc_encode = nfs4svc_encode_compoundres,
2531 .pc_argsize = sizeof(struct nfsd4_compoundargs), 2547 .pc_argsize = sizeof(struct nfsd4_compoundargs),
2532 .pc_ressize = sizeof(struct nfsd4_compoundres), 2548 .pc_ressize = sizeof(struct nfsd4_compoundres),
2533 .pc_release = nfsd4_release_compoundargs, 2549 .pc_release = nfsd4_release_compoundargs,
@@ -2536,10 +2552,12 @@ static struct svc_procedure nfsd_procedures4[2] = {
2536 }, 2552 },
2537}; 2553};
2538 2554
2539struct svc_version nfsd_version4 = { 2555static unsigned int nfsd_count3[ARRAY_SIZE(nfsd_procedures4)];
2556const struct svc_version nfsd_version4 = {
2540 .vs_vers = 4, 2557 .vs_vers = 4,
2541 .vs_nproc = 2, 2558 .vs_nproc = 2,
2542 .vs_proc = nfsd_procedures4, 2559 .vs_proc = nfsd_procedures4,
2560 .vs_count = nfsd_count3,
2543 .vs_dispatch = nfsd_dispatch, 2561 .vs_dispatch = nfsd_dispatch,
2544 .vs_xdrsize = NFS4_SVC_XDRSIZE, 2562 .vs_xdrsize = NFS4_SVC_XDRSIZE,
2545 .vs_rpcb_optnl = true, 2563 .vs_rpcb_optnl = true,
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 22002fb75a18..0c04f81aa63b 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -2402,10 +2402,10 @@ static bool client_has_state(struct nfs4_client *clp)
2402} 2402}
2403 2403
2404__be32 2404__be32
2405nfsd4_exchange_id(struct svc_rqst *rqstp, 2405nfsd4_exchange_id(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
2406 struct nfsd4_compound_state *cstate, 2406 union nfsd4_op_u *u)
2407 struct nfsd4_exchange_id *exid)
2408{ 2407{
2408 struct nfsd4_exchange_id *exid = &u->exchange_id;
2409 struct nfs4_client *conf, *new; 2409 struct nfs4_client *conf, *new;
2410 struct nfs4_client *unconf = NULL; 2410 struct nfs4_client *unconf = NULL;
2411 __be32 status; 2411 __be32 status;
@@ -2698,9 +2698,9 @@ static __be32 nfsd4_check_cb_sec(struct nfsd4_cb_sec *cbs)
2698 2698
2699__be32 2699__be32
2700nfsd4_create_session(struct svc_rqst *rqstp, 2700nfsd4_create_session(struct svc_rqst *rqstp,
2701 struct nfsd4_compound_state *cstate, 2701 struct nfsd4_compound_state *cstate, union nfsd4_op_u *u)
2702 struct nfsd4_create_session *cr_ses)
2703{ 2702{
2703 struct nfsd4_create_session *cr_ses = &u->create_session;
2704 struct sockaddr *sa = svc_addr(rqstp); 2704 struct sockaddr *sa = svc_addr(rqstp);
2705 struct nfs4_client *conf, *unconf; 2705 struct nfs4_client *conf, *unconf;
2706 struct nfs4_client *old = NULL; 2706 struct nfs4_client *old = NULL;
@@ -2824,8 +2824,11 @@ static __be32 nfsd4_map_bcts_dir(u32 *dir)
2824 return nfserr_inval; 2824 return nfserr_inval;
2825} 2825}
2826 2826
2827__be32 nfsd4_backchannel_ctl(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfsd4_backchannel_ctl *bc) 2827__be32 nfsd4_backchannel_ctl(struct svc_rqst *rqstp,
2828 struct nfsd4_compound_state *cstate,
2829 union nfsd4_op_u *u)
2828{ 2830{
2831 struct nfsd4_backchannel_ctl *bc = &u->backchannel_ctl;
2829 struct nfsd4_session *session = cstate->session; 2832 struct nfsd4_session *session = cstate->session;
2830 struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id); 2833 struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id);
2831 __be32 status; 2834 __be32 status;
@@ -2845,8 +2848,9 @@ __be32 nfsd4_backchannel_ctl(struct svc_rqst *rqstp, struct nfsd4_compound_state
2845 2848
2846__be32 nfsd4_bind_conn_to_session(struct svc_rqst *rqstp, 2849__be32 nfsd4_bind_conn_to_session(struct svc_rqst *rqstp,
2847 struct nfsd4_compound_state *cstate, 2850 struct nfsd4_compound_state *cstate,
2848 struct nfsd4_bind_conn_to_session *bcts) 2851 union nfsd4_op_u *u)
2849{ 2852{
2853 struct nfsd4_bind_conn_to_session *bcts = &u->bind_conn_to_session;
2850 __be32 status; 2854 __be32 status;
2851 struct nfsd4_conn *conn; 2855 struct nfsd4_conn *conn;
2852 struct nfsd4_session *session; 2856 struct nfsd4_session *session;
@@ -2886,10 +2890,10 @@ static bool nfsd4_compound_in_session(struct nfsd4_session *session, struct nfs4
2886} 2890}
2887 2891
2888__be32 2892__be32
2889nfsd4_destroy_session(struct svc_rqst *r, 2893nfsd4_destroy_session(struct svc_rqst *r, struct nfsd4_compound_state *cstate,
2890 struct nfsd4_compound_state *cstate, 2894 union nfsd4_op_u *u)
2891 struct nfsd4_destroy_session *sessionid)
2892{ 2895{
2896 struct nfsd4_destroy_session *sessionid = &u->destroy_session;
2893 struct nfsd4_session *ses; 2897 struct nfsd4_session *ses;
2894 __be32 status; 2898 __be32 status;
2895 int ref_held_by_me = 0; 2899 int ref_held_by_me = 0;
@@ -2983,10 +2987,10 @@ static bool nfsd4_request_too_big(struct svc_rqst *rqstp,
2983} 2987}
2984 2988
2985__be32 2989__be32
2986nfsd4_sequence(struct svc_rqst *rqstp, 2990nfsd4_sequence(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
2987 struct nfsd4_compound_state *cstate, 2991 union nfsd4_op_u *u)
2988 struct nfsd4_sequence *seq)
2989{ 2992{
2993 struct nfsd4_sequence *seq = &u->sequence;
2990 struct nfsd4_compoundres *resp = rqstp->rq_resp; 2994 struct nfsd4_compoundres *resp = rqstp->rq_resp;
2991 struct xdr_stream *xdr = &resp->xdr; 2995 struct xdr_stream *xdr = &resp->xdr;
2992 struct nfsd4_session *session; 2996 struct nfsd4_session *session;
@@ -3120,8 +3124,11 @@ nfsd4_sequence_done(struct nfsd4_compoundres *resp)
3120} 3124}
3121 3125
3122__be32 3126__be32
3123nfsd4_destroy_clientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfsd4_destroy_clientid *dc) 3127nfsd4_destroy_clientid(struct svc_rqst *rqstp,
3128 struct nfsd4_compound_state *cstate,
3129 union nfsd4_op_u *u)
3124{ 3130{
3131 struct nfsd4_destroy_clientid *dc = &u->destroy_clientid;
3125 struct nfs4_client *conf, *unconf; 3132 struct nfs4_client *conf, *unconf;
3126 struct nfs4_client *clp = NULL; 3133 struct nfs4_client *clp = NULL;
3127 __be32 status = 0; 3134 __be32 status = 0;
@@ -3161,8 +3168,10 @@ out:
3161} 3168}
3162 3169
3163__be32 3170__be32
3164nfsd4_reclaim_complete(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfsd4_reclaim_complete *rc) 3171nfsd4_reclaim_complete(struct svc_rqst *rqstp,
3172 struct nfsd4_compound_state *cstate, union nfsd4_op_u *u)
3165{ 3173{
3174 struct nfsd4_reclaim_complete *rc = &u->reclaim_complete;
3166 __be32 status = 0; 3175 __be32 status = 0;
3167 3176
3168 if (rc->rca_one_fs) { 3177 if (rc->rca_one_fs) {
@@ -3199,8 +3208,9 @@ out:
3199 3208
3200__be32 3209__be32
3201nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 3210nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
3202 struct nfsd4_setclientid *setclid) 3211 union nfsd4_op_u *u)
3203{ 3212{
3213 struct nfsd4_setclientid *setclid = &u->setclientid;
3204 struct xdr_netobj clname = setclid->se_name; 3214 struct xdr_netobj clname = setclid->se_name;
3205 nfs4_verifier clverifier = setclid->se_verf; 3215 nfs4_verifier clverifier = setclid->se_verf;
3206 struct nfs4_client *conf, *new; 3216 struct nfs4_client *conf, *new;
@@ -3257,9 +3267,11 @@ out:
3257 3267
3258__be32 3268__be32
3259nfsd4_setclientid_confirm(struct svc_rqst *rqstp, 3269nfsd4_setclientid_confirm(struct svc_rqst *rqstp,
3260 struct nfsd4_compound_state *cstate, 3270 struct nfsd4_compound_state *cstate,
3261 struct nfsd4_setclientid_confirm *setclientid_confirm) 3271 union nfsd4_op_u *u)
3262{ 3272{
3273 struct nfsd4_setclientid_confirm *setclientid_confirm =
3274 &u->setclientid_confirm;
3263 struct nfs4_client *conf, *unconf; 3275 struct nfs4_client *conf, *unconf;
3264 struct nfs4_client *old = NULL; 3276 struct nfs4_client *old = NULL;
3265 nfs4_verifier confirm = setclientid_confirm->sc_confirm; 3277 nfs4_verifier confirm = setclientid_confirm->sc_confirm;
@@ -4506,8 +4518,9 @@ void nfsd4_cleanup_open_state(struct nfsd4_compound_state *cstate,
4506 4518
4507__be32 4519__be32
4508nfsd4_renew(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 4520nfsd4_renew(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
4509 clientid_t *clid) 4521 union nfsd4_op_u *u)
4510{ 4522{
4523 clientid_t *clid = &u->renew;
4511 struct nfs4_client *clp; 4524 struct nfs4_client *clp;
4512 __be32 status; 4525 __be32 status;
4513 struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id); 4526 struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id);
@@ -4993,8 +5006,9 @@ out:
4993 */ 5006 */
4994__be32 5007__be32
4995nfsd4_test_stateid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 5008nfsd4_test_stateid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
4996 struct nfsd4_test_stateid *test_stateid) 5009 union nfsd4_op_u *u)
4997{ 5010{
5011 struct nfsd4_test_stateid *test_stateid = &u->test_stateid;
4998 struct nfsd4_test_stateid_id *stateid; 5012 struct nfsd4_test_stateid_id *stateid;
4999 struct nfs4_client *cl = cstate->session->se_client; 5013 struct nfs4_client *cl = cstate->session->se_client;
5000 5014
@@ -5033,8 +5047,9 @@ out:
5033 5047
5034__be32 5048__be32
5035nfsd4_free_stateid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 5049nfsd4_free_stateid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
5036 struct nfsd4_free_stateid *free_stateid) 5050 union nfsd4_op_u *u)
5037{ 5051{
5052 struct nfsd4_free_stateid *free_stateid = &u->free_stateid;
5038 stateid_t *stateid = &free_stateid->fr_stateid; 5053 stateid_t *stateid = &free_stateid->fr_stateid;
5039 struct nfs4_stid *s; 5054 struct nfs4_stid *s;
5040 struct nfs4_delegation *dp; 5055 struct nfs4_delegation *dp;
@@ -5162,8 +5177,9 @@ static __be32 nfs4_preprocess_confirmed_seqid_op(struct nfsd4_compound_state *cs
5162 5177
5163__be32 5178__be32
5164nfsd4_open_confirm(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 5179nfsd4_open_confirm(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
5165 struct nfsd4_open_confirm *oc) 5180 union nfsd4_op_u *u)
5166{ 5181{
5182 struct nfsd4_open_confirm *oc = &u->open_confirm;
5167 __be32 status; 5183 __be32 status;
5168 struct nfs4_openowner *oo; 5184 struct nfs4_openowner *oo;
5169 struct nfs4_ol_stateid *stp; 5185 struct nfs4_ol_stateid *stp;
@@ -5230,9 +5246,9 @@ static inline void nfs4_stateid_downgrade(struct nfs4_ol_stateid *stp, u32 to_ac
5230 5246
5231__be32 5247__be32
5232nfsd4_open_downgrade(struct svc_rqst *rqstp, 5248nfsd4_open_downgrade(struct svc_rqst *rqstp,
5233 struct nfsd4_compound_state *cstate, 5249 struct nfsd4_compound_state *cstate, union nfsd4_op_u *u)
5234 struct nfsd4_open_downgrade *od)
5235{ 5250{
5251 struct nfsd4_open_downgrade *od = &u->open_downgrade;
5236 __be32 status; 5252 __be32 status;
5237 struct nfs4_ol_stateid *stp; 5253 struct nfs4_ol_stateid *stp;
5238 struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id); 5254 struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id);
@@ -5300,8 +5316,9 @@ static void nfsd4_close_open_stateid(struct nfs4_ol_stateid *s)
5300 */ 5316 */
5301__be32 5317__be32
5302nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 5318nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
5303 struct nfsd4_close *close) 5319 union nfsd4_op_u *u)
5304{ 5320{
5321 struct nfsd4_close *close = &u->close;
5305 __be32 status; 5322 __be32 status;
5306 struct nfs4_ol_stateid *stp; 5323 struct nfs4_ol_stateid *stp;
5307 struct net *net = SVC_NET(rqstp); 5324 struct net *net = SVC_NET(rqstp);
@@ -5330,8 +5347,9 @@ out:
5330 5347
5331__be32 5348__be32
5332nfsd4_delegreturn(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 5349nfsd4_delegreturn(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
5333 struct nfsd4_delegreturn *dr) 5350 union nfsd4_op_u *u)
5334{ 5351{
5352 struct nfsd4_delegreturn *dr = &u->delegreturn;
5335 struct nfs4_delegation *dp; 5353 struct nfs4_delegation *dp;
5336 stateid_t *stateid = &dr->dr_stateid; 5354 stateid_t *stateid = &dr->dr_stateid;
5337 struct nfs4_stid *s; 5355 struct nfs4_stid *s;
@@ -5706,8 +5724,9 @@ out:
5706 */ 5724 */
5707__be32 5725__be32
5708nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 5726nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
5709 struct nfsd4_lock *lock) 5727 union nfsd4_op_u *u)
5710{ 5728{
5729 struct nfsd4_lock *lock = &u->lock;
5711 struct nfs4_openowner *open_sop = NULL; 5730 struct nfs4_openowner *open_sop = NULL;
5712 struct nfs4_lockowner *lock_sop = NULL; 5731 struct nfs4_lockowner *lock_sop = NULL;
5713 struct nfs4_ol_stateid *lock_stp = NULL; 5732 struct nfs4_ol_stateid *lock_stp = NULL;
@@ -5939,8 +5958,9 @@ static __be32 nfsd_test_lock(struct svc_rqst *rqstp, struct svc_fh *fhp, struct
5939 */ 5958 */
5940__be32 5959__be32
5941nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 5960nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
5942 struct nfsd4_lockt *lockt) 5961 union nfsd4_op_u *u)
5943{ 5962{
5963 struct nfsd4_lockt *lockt = &u->lockt;
5944 struct file_lock *file_lock = NULL; 5964 struct file_lock *file_lock = NULL;
5945 struct nfs4_lockowner *lo = NULL; 5965 struct nfs4_lockowner *lo = NULL;
5946 __be32 status; 5966 __be32 status;
@@ -6012,8 +6032,9 @@ out:
6012 6032
6013__be32 6033__be32
6014nfsd4_locku(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 6034nfsd4_locku(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
6015 struct nfsd4_locku *locku) 6035 union nfsd4_op_u *u)
6016{ 6036{
6037 struct nfsd4_locku *locku = &u->locku;
6017 struct nfs4_ol_stateid *stp; 6038 struct nfs4_ol_stateid *stp;
6018 struct file *filp = NULL; 6039 struct file *filp = NULL;
6019 struct file_lock *file_lock = NULL; 6040 struct file_lock *file_lock = NULL;
@@ -6119,8 +6140,9 @@ check_for_locks(struct nfs4_file *fp, struct nfs4_lockowner *lowner)
6119__be32 6140__be32
6120nfsd4_release_lockowner(struct svc_rqst *rqstp, 6141nfsd4_release_lockowner(struct svc_rqst *rqstp,
6121 struct nfsd4_compound_state *cstate, 6142 struct nfsd4_compound_state *cstate,
6122 struct nfsd4_release_lockowner *rlockowner) 6143 union nfsd4_op_u *u)
6123{ 6144{
6145 struct nfsd4_release_lockowner *rlockowner = &u->release_lockowner;
6124 clientid_t *clid = &rlockowner->rl_clientid; 6146 clientid_t *clid = &rlockowner->rl_clientid;
6125 struct nfs4_stateowner *sop; 6147 struct nfs4_stateowner *sop;
6126 struct nfs4_lockowner *lo = NULL; 6148 struct nfs4_lockowner *lo = NULL;
@@ -7103,27 +7125,31 @@ clear_current_stateid(struct nfsd4_compound_state *cstate)
7103 * functions to set current state id 7125 * functions to set current state id
7104 */ 7126 */
7105void 7127void
7106nfsd4_set_opendowngradestateid(struct nfsd4_compound_state *cstate, struct nfsd4_open_downgrade *odp) 7128nfsd4_set_opendowngradestateid(struct nfsd4_compound_state *cstate,
7129 union nfsd4_op_u *u)
7107{ 7130{
7108 put_stateid(cstate, &odp->od_stateid); 7131 put_stateid(cstate, &u->open_downgrade.od_stateid);
7109} 7132}
7110 7133
7111void 7134void
7112nfsd4_set_openstateid(struct nfsd4_compound_state *cstate, struct nfsd4_open *open) 7135nfsd4_set_openstateid(struct nfsd4_compound_state *cstate,
7136 union nfsd4_op_u *u)
7113{ 7137{
7114 put_stateid(cstate, &open->op_stateid); 7138 put_stateid(cstate, &u->open.op_stateid);
7115} 7139}
7116 7140
7117void 7141void
7118nfsd4_set_closestateid(struct nfsd4_compound_state *cstate, struct nfsd4_close *close) 7142nfsd4_set_closestateid(struct nfsd4_compound_state *cstate,
7143 union nfsd4_op_u *u)
7119{ 7144{
7120 put_stateid(cstate, &close->cl_stateid); 7145 put_stateid(cstate, &u->close.cl_stateid);
7121} 7146}
7122 7147
7123void 7148void
7124nfsd4_set_lockstateid(struct nfsd4_compound_state *cstate, struct nfsd4_lock *lock) 7149nfsd4_set_lockstateid(struct nfsd4_compound_state *cstate,
7150 union nfsd4_op_u *u)
7125{ 7151{
7126 put_stateid(cstate, &lock->lk_resp_stateid); 7152 put_stateid(cstate, &u->lock.lk_resp_stateid);
7127} 7153}
7128 7154
7129/* 7155/*
@@ -7131,49 +7157,57 @@ nfsd4_set_lockstateid(struct nfsd4_compound_state *cstate, struct nfsd4_lock *lo
7131 */ 7157 */
7132 7158
7133void 7159void
7134nfsd4_get_opendowngradestateid(struct nfsd4_compound_state *cstate, struct nfsd4_open_downgrade *odp) 7160nfsd4_get_opendowngradestateid(struct nfsd4_compound_state *cstate,
7161 union nfsd4_op_u *u)
7135{ 7162{
7136 get_stateid(cstate, &odp->od_stateid); 7163 get_stateid(cstate, &u->open_downgrade.od_stateid);
7137} 7164}
7138 7165
7139void 7166void
7140nfsd4_get_delegreturnstateid(struct nfsd4_compound_state *cstate, struct nfsd4_delegreturn *drp) 7167nfsd4_get_delegreturnstateid(struct nfsd4_compound_state *cstate,
7168 union nfsd4_op_u *u)
7141{ 7169{
7142 get_stateid(cstate, &drp->dr_stateid); 7170 get_stateid(cstate, &u->delegreturn.dr_stateid);
7143} 7171}
7144 7172
7145void 7173void
7146nfsd4_get_freestateid(struct nfsd4_compound_state *cstate, struct nfsd4_free_stateid *fsp) 7174nfsd4_get_freestateid(struct nfsd4_compound_state *cstate,
7175 union nfsd4_op_u *u)
7147{ 7176{
7148 get_stateid(cstate, &fsp->fr_stateid); 7177 get_stateid(cstate, &u->free_stateid.fr_stateid);
7149} 7178}
7150 7179
7151void 7180void
7152nfsd4_get_setattrstateid(struct nfsd4_compound_state *cstate, struct nfsd4_setattr *setattr) 7181nfsd4_get_setattrstateid(struct nfsd4_compound_state *cstate,
7182 union nfsd4_op_u *u)
7153{ 7183{
7154 get_stateid(cstate, &setattr->sa_stateid); 7184 get_stateid(cstate, &u->setattr.sa_stateid);
7155} 7185}
7156 7186
7157void 7187void
7158nfsd4_get_closestateid(struct nfsd4_compound_state *cstate, struct nfsd4_close *close) 7188nfsd4_get_closestateid(struct nfsd4_compound_state *cstate,
7189 union nfsd4_op_u *u)
7159{ 7190{
7160 get_stateid(cstate, &close->cl_stateid); 7191 get_stateid(cstate, &u->close.cl_stateid);
7161} 7192}
7162 7193
7163void 7194void
7164nfsd4_get_lockustateid(struct nfsd4_compound_state *cstate, struct nfsd4_locku *locku) 7195nfsd4_get_lockustateid(struct nfsd4_compound_state *cstate,
7196 union nfsd4_op_u *u)
7165{ 7197{
7166 get_stateid(cstate, &locku->lu_stateid); 7198 get_stateid(cstate, &u->locku.lu_stateid);
7167} 7199}
7168 7200
7169void 7201void
7170nfsd4_get_readstateid(struct nfsd4_compound_state *cstate, struct nfsd4_read *read) 7202nfsd4_get_readstateid(struct nfsd4_compound_state *cstate,
7203 union nfsd4_op_u *u)
7171{ 7204{
7172 get_stateid(cstate, &read->rd_stateid); 7205 get_stateid(cstate, &u->read.rd_stateid);
7173} 7206}
7174 7207
7175void 7208void
7176nfsd4_get_writestateid(struct nfsd4_compound_state *cstate, struct nfsd4_write *write) 7209nfsd4_get_writestateid(struct nfsd4_compound_state *cstate,
7210 union nfsd4_op_u *u)
7177{ 7211{
7178 get_stateid(cstate, &write->wr_stateid); 7212 get_stateid(cstate, &u->write.wr_stateid);
7179} 7213}
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 26780d53a6f9..20fbcab97753 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -1973,7 +1973,7 @@ static __be32 *encode_change(__be32 *p, struct kstat *stat, struct inode *inode,
1973 *p++ = cpu_to_be32(convert_to_wallclock(exp->cd->flush_time)); 1973 *p++ = cpu_to_be32(convert_to_wallclock(exp->cd->flush_time));
1974 *p++ = 0; 1974 *p++ = 0;
1975 } else if (IS_I_VERSION(inode)) { 1975 } else if (IS_I_VERSION(inode)) {
1976 p = xdr_encode_hyper(p, inode->i_version); 1976 p = xdr_encode_hyper(p, nfsd4_change_attribute(inode));
1977 } else { 1977 } else {
1978 *p++ = cpu_to_be32(stat->ctime.tv_sec); 1978 *p++ = cpu_to_be32(stat->ctime.tv_sec);
1979 *p++ = cpu_to_be32(stat->ctime.tv_nsec); 1979 *p++ = cpu_to_be32(stat->ctime.tv_nsec);
@@ -4538,14 +4538,13 @@ nfsd4_encode_replay(struct xdr_stream *xdr, struct nfsd4_op *op)
4538} 4538}
4539 4539
4540int 4540int
4541nfs4svc_encode_voidres(struct svc_rqst *rqstp, __be32 *p, void *dummy) 4541nfs4svc_encode_voidres(struct svc_rqst *rqstp, __be32 *p)
4542{ 4542{
4543 return xdr_ressize_check(rqstp, p); 4543 return xdr_ressize_check(rqstp, p);
4544} 4544}
4545 4545
4546int nfsd4_release_compoundargs(void *rq, __be32 *p, void *resp) 4546void nfsd4_release_compoundargs(struct svc_rqst *rqstp)
4547{ 4547{
4548 struct svc_rqst *rqstp = rq;
4549 struct nfsd4_compoundargs *args = rqstp->rq_argp; 4548 struct nfsd4_compoundargs *args = rqstp->rq_argp;
4550 4549
4551 if (args->ops != args->iops) { 4550 if (args->ops != args->iops) {
@@ -4559,12 +4558,13 @@ int nfsd4_release_compoundargs(void *rq, __be32 *p, void *resp)
4559 args->to_free = tb->next; 4558 args->to_free = tb->next;
4560 kfree(tb); 4559 kfree(tb);
4561 } 4560 }
4562 return 1;
4563} 4561}
4564 4562
4565int 4563int
4566nfs4svc_decode_compoundargs(struct svc_rqst *rqstp, __be32 *p, struct nfsd4_compoundargs *args) 4564nfs4svc_decode_compoundargs(struct svc_rqst *rqstp, __be32 *p)
4567{ 4565{
4566 struct nfsd4_compoundargs *args = rqstp->rq_argp;
4567
4568 if (rqstp->rq_arg.head[0].iov_len % 4) { 4568 if (rqstp->rq_arg.head[0].iov_len % 4) {
4569 /* client is nuts */ 4569 /* client is nuts */
4570 dprintk("%s: compound not properly padded! (peeraddr=%pISc xid=0x%x)", 4570 dprintk("%s: compound not properly padded! (peeraddr=%pISc xid=0x%x)",
@@ -4584,11 +4584,12 @@ nfs4svc_decode_compoundargs(struct svc_rqst *rqstp, __be32 *p, struct nfsd4_comp
4584} 4584}
4585 4585
4586int 4586int
4587nfs4svc_encode_compoundres(struct svc_rqst *rqstp, __be32 *p, struct nfsd4_compoundres *resp) 4587nfs4svc_encode_compoundres(struct svc_rqst *rqstp, __be32 *p)
4588{ 4588{
4589 /* 4589 /*
4590 * All that remains is to write the tag and operation count... 4590 * All that remains is to write the tag and operation count...
4591 */ 4591 */
4592 struct nfsd4_compoundres *resp = rqstp->rq_resp;
4592 struct xdr_buf *buf = resp->xdr.buf; 4593 struct xdr_buf *buf = resp->xdr.buf;
4593 4594
4594 WARN_ON_ONCE(buf->len != buf->head[0].iov_len + buf->page_len + 4595 WARN_ON_ONCE(buf->len != buf->head[0].iov_len + buf->page_len +
diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h
index d96606801d47..b9c538ab7a59 100644
--- a/fs/nfsd/nfsd.h
+++ b/fs/nfsd/nfsd.h
@@ -60,7 +60,7 @@ struct readdir_cd {
60 60
61 61
62extern struct svc_program nfsd_program; 62extern struct svc_program nfsd_program;
63extern struct svc_version nfsd_version2, nfsd_version3, 63extern const struct svc_version nfsd_version2, nfsd_version3,
64 nfsd_version4; 64 nfsd_version4;
65extern struct mutex nfsd_mutex; 65extern struct mutex nfsd_mutex;
66extern spinlock_t nfsd_drc_lock; 66extern spinlock_t nfsd_drc_lock;
@@ -86,12 +86,12 @@ void nfsd_destroy(struct net *net);
86 86
87#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) 87#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
88#ifdef CONFIG_NFSD_V2_ACL 88#ifdef CONFIG_NFSD_V2_ACL
89extern struct svc_version nfsd_acl_version2; 89extern const struct svc_version nfsd_acl_version2;
90#else 90#else
91#define nfsd_acl_version2 NULL 91#define nfsd_acl_version2 NULL
92#endif 92#endif
93#ifdef CONFIG_NFSD_V3_ACL 93#ifdef CONFIG_NFSD_V3_ACL
94extern struct svc_version nfsd_acl_version3; 94extern const struct svc_version nfsd_acl_version3;
95#else 95#else
96#define nfsd_acl_version3 NULL 96#define nfsd_acl_version3 NULL
97#endif 97#endif
diff --git a/fs/nfsd/nfsfh.h b/fs/nfsd/nfsfh.h
index f84fe6bf9aee..e47cf6c2ac28 100644
--- a/fs/nfsd/nfsfh.h
+++ b/fs/nfsd/nfsfh.h
@@ -241,6 +241,28 @@ fh_clear_wcc(struct svc_fh *fhp)
241} 241}
242 242
243/* 243/*
244 * We could use i_version alone as the change attribute. However,
245 * i_version can go backwards after a reboot. On its own that doesn't
246 * necessarily cause a problem, but if i_version goes backwards and then
247 * is incremented again it could reuse a value that was previously used
248 * before boot, and a client who queried the two values might
249 * incorrectly assume nothing changed.
250 *
251 * By using both ctime and the i_version counter we guarantee that as
252 * long as time doesn't go backwards we never reuse an old value.
253 */
254static inline u64 nfsd4_change_attribute(struct inode *inode)
255{
256 u64 chattr;
257
258 chattr = inode->i_ctime.tv_sec;
259 chattr <<= 30;
260 chattr += inode->i_ctime.tv_nsec;
261 chattr += inode->i_version;
262 return chattr;
263}
264
265/*
244 * Fill in the pre_op attr for the wcc data 266 * Fill in the pre_op attr for the wcc data
245 */ 267 */
246static inline void 268static inline void
@@ -253,7 +275,7 @@ fill_pre_wcc(struct svc_fh *fhp)
253 fhp->fh_pre_mtime = inode->i_mtime; 275 fhp->fh_pre_mtime = inode->i_mtime;
254 fhp->fh_pre_ctime = inode->i_ctime; 276 fhp->fh_pre_ctime = inode->i_ctime;
255 fhp->fh_pre_size = inode->i_size; 277 fhp->fh_pre_size = inode->i_size;
256 fhp->fh_pre_change = inode->i_version; 278 fhp->fh_pre_change = nfsd4_change_attribute(inode);
257 fhp->fh_pre_saved = true; 279 fhp->fh_pre_saved = true;
258 } 280 }
259} 281}
diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c
index 03a7e9da4da0..5076ae2b8258 100644
--- a/fs/nfsd/nfsproc.c
+++ b/fs/nfsd/nfsproc.c
@@ -17,7 +17,7 @@ typedef struct svc_buf svc_buf;
17 17
18 18
19static __be32 19static __be32
20nfsd_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) 20nfsd_proc_null(struct svc_rqst *rqstp)
21{ 21{
22 return nfs_ok; 22 return nfs_ok;
23} 23}
@@ -39,9 +39,10 @@ nfsd_return_dirop(__be32 err, struct nfsd_diropres *resp)
39 * N.B. After this call resp->fh needs an fh_put 39 * N.B. After this call resp->fh needs an fh_put
40 */ 40 */
41static __be32 41static __be32
42nfsd_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp, 42nfsd_proc_getattr(struct svc_rqst *rqstp)
43 struct nfsd_attrstat *resp)
44{ 43{
44 struct nfsd_fhandle *argp = rqstp->rq_argp;
45 struct nfsd_attrstat *resp = rqstp->rq_resp;
45 __be32 nfserr; 46 __be32 nfserr;
46 dprintk("nfsd: GETATTR %s\n", SVCFH_fmt(&argp->fh)); 47 dprintk("nfsd: GETATTR %s\n", SVCFH_fmt(&argp->fh));
47 48
@@ -56,9 +57,10 @@ nfsd_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp,
56 * N.B. After this call resp->fh needs an fh_put 57 * N.B. After this call resp->fh needs an fh_put
57 */ 58 */
58static __be32 59static __be32
59nfsd_proc_setattr(struct svc_rqst *rqstp, struct nfsd_sattrargs *argp, 60nfsd_proc_setattr(struct svc_rqst *rqstp)
60 struct nfsd_attrstat *resp)
61{ 61{
62 struct nfsd_sattrargs *argp = rqstp->rq_argp;
63 struct nfsd_attrstat *resp = rqstp->rq_resp;
62 struct iattr *iap = &argp->attrs; 64 struct iattr *iap = &argp->attrs;
63 struct svc_fh *fhp; 65 struct svc_fh *fhp;
64 __be32 nfserr; 66 __be32 nfserr;
@@ -122,9 +124,10 @@ done:
122 * N.B. After this call resp->fh needs an fh_put 124 * N.B. After this call resp->fh needs an fh_put
123 */ 125 */
124static __be32 126static __be32
125nfsd_proc_lookup(struct svc_rqst *rqstp, struct nfsd_diropargs *argp, 127nfsd_proc_lookup(struct svc_rqst *rqstp)
126 struct nfsd_diropres *resp)
127{ 128{
129 struct nfsd_diropargs *argp = rqstp->rq_argp;
130 struct nfsd_diropres *resp = rqstp->rq_resp;
128 __be32 nfserr; 131 __be32 nfserr;
129 132
130 dprintk("nfsd: LOOKUP %s %.*s\n", 133 dprintk("nfsd: LOOKUP %s %.*s\n",
@@ -142,9 +145,10 @@ nfsd_proc_lookup(struct svc_rqst *rqstp, struct nfsd_diropargs *argp,
142 * Read a symlink. 145 * Read a symlink.
143 */ 146 */
144static __be32 147static __be32
145nfsd_proc_readlink(struct svc_rqst *rqstp, struct nfsd_readlinkargs *argp, 148nfsd_proc_readlink(struct svc_rqst *rqstp)
146 struct nfsd_readlinkres *resp)
147{ 149{
150 struct nfsd_readlinkargs *argp = rqstp->rq_argp;
151 struct nfsd_readlinkres *resp = rqstp->rq_resp;
148 __be32 nfserr; 152 __be32 nfserr;
149 153
150 dprintk("nfsd: READLINK %s\n", SVCFH_fmt(&argp->fh)); 154 dprintk("nfsd: READLINK %s\n", SVCFH_fmt(&argp->fh));
@@ -162,9 +166,10 @@ nfsd_proc_readlink(struct svc_rqst *rqstp, struct nfsd_readlinkargs *argp,
162 * N.B. After this call resp->fh needs an fh_put 166 * N.B. After this call resp->fh needs an fh_put
163 */ 167 */
164static __be32 168static __be32
165nfsd_proc_read(struct svc_rqst *rqstp, struct nfsd_readargs *argp, 169nfsd_proc_read(struct svc_rqst *rqstp)
166 struct nfsd_readres *resp)
167{ 170{
171 struct nfsd_readargs *argp = rqstp->rq_argp;
172 struct nfsd_readres *resp = rqstp->rq_resp;
168 __be32 nfserr; 173 __be32 nfserr;
169 174
170 dprintk("nfsd: READ %s %d bytes at %d\n", 175 dprintk("nfsd: READ %s %d bytes at %d\n",
@@ -200,9 +205,10 @@ nfsd_proc_read(struct svc_rqst *rqstp, struct nfsd_readargs *argp,
200 * N.B. After this call resp->fh needs an fh_put 205 * N.B. After this call resp->fh needs an fh_put
201 */ 206 */
202static __be32 207static __be32
203nfsd_proc_write(struct svc_rqst *rqstp, struct nfsd_writeargs *argp, 208nfsd_proc_write(struct svc_rqst *rqstp)
204 struct nfsd_attrstat *resp)
205{ 209{
210 struct nfsd_writeargs *argp = rqstp->rq_argp;
211 struct nfsd_attrstat *resp = rqstp->rq_resp;
206 __be32 nfserr; 212 __be32 nfserr;
207 unsigned long cnt = argp->len; 213 unsigned long cnt = argp->len;
208 214
@@ -222,9 +228,10 @@ nfsd_proc_write(struct svc_rqst *rqstp, struct nfsd_writeargs *argp,
222 * N.B. After this call _both_ argp->fh and resp->fh need an fh_put 228 * N.B. After this call _both_ argp->fh and resp->fh need an fh_put
223 */ 229 */
224static __be32 230static __be32
225nfsd_proc_create(struct svc_rqst *rqstp, struct nfsd_createargs *argp, 231nfsd_proc_create(struct svc_rqst *rqstp)
226 struct nfsd_diropres *resp)
227{ 232{
233 struct nfsd_createargs *argp = rqstp->rq_argp;
234 struct nfsd_diropres *resp = rqstp->rq_resp;
228 svc_fh *dirfhp = &argp->fh; 235 svc_fh *dirfhp = &argp->fh;
229 svc_fh *newfhp = &resp->fh; 236 svc_fh *newfhp = &resp->fh;
230 struct iattr *attr = &argp->attrs; 237 struct iattr *attr = &argp->attrs;
@@ -377,9 +384,9 @@ done:
377} 384}
378 385
379static __be32 386static __be32
380nfsd_proc_remove(struct svc_rqst *rqstp, struct nfsd_diropargs *argp, 387nfsd_proc_remove(struct svc_rqst *rqstp)
381 void *resp)
382{ 388{
389 struct nfsd_diropargs *argp = rqstp->rq_argp;
383 __be32 nfserr; 390 __be32 nfserr;
384 391
385 dprintk("nfsd: REMOVE %s %.*s\n", SVCFH_fmt(&argp->fh), 392 dprintk("nfsd: REMOVE %s %.*s\n", SVCFH_fmt(&argp->fh),
@@ -392,9 +399,9 @@ nfsd_proc_remove(struct svc_rqst *rqstp, struct nfsd_diropargs *argp,
392} 399}
393 400
394static __be32 401static __be32
395nfsd_proc_rename(struct svc_rqst *rqstp, struct nfsd_renameargs *argp, 402nfsd_proc_rename(struct svc_rqst *rqstp)
396 void *resp)
397{ 403{
404 struct nfsd_renameargs *argp = rqstp->rq_argp;
398 __be32 nfserr; 405 __be32 nfserr;
399 406
400 dprintk("nfsd: RENAME %s %.*s -> \n", 407 dprintk("nfsd: RENAME %s %.*s -> \n",
@@ -410,9 +417,9 @@ nfsd_proc_rename(struct svc_rqst *rqstp, struct nfsd_renameargs *argp,
410} 417}
411 418
412static __be32 419static __be32
413nfsd_proc_link(struct svc_rqst *rqstp, struct nfsd_linkargs *argp, 420nfsd_proc_link(struct svc_rqst *rqstp)
414 void *resp)
415{ 421{
422 struct nfsd_linkargs *argp = rqstp->rq_argp;
416 __be32 nfserr; 423 __be32 nfserr;
417 424
418 dprintk("nfsd: LINK %s ->\n", 425 dprintk("nfsd: LINK %s ->\n",
@@ -430,9 +437,9 @@ nfsd_proc_link(struct svc_rqst *rqstp, struct nfsd_linkargs *argp,
430} 437}
431 438
432static __be32 439static __be32
433nfsd_proc_symlink(struct svc_rqst *rqstp, struct nfsd_symlinkargs *argp, 440nfsd_proc_symlink(struct svc_rqst *rqstp)
434 void *resp)
435{ 441{
442 struct nfsd_symlinkargs *argp = rqstp->rq_argp;
436 struct svc_fh newfh; 443 struct svc_fh newfh;
437 __be32 nfserr; 444 __be32 nfserr;
438 445
@@ -460,9 +467,10 @@ nfsd_proc_symlink(struct svc_rqst *rqstp, struct nfsd_symlinkargs *argp,
460 * N.B. After this call resp->fh needs an fh_put 467 * N.B. After this call resp->fh needs an fh_put
461 */ 468 */
462static __be32 469static __be32
463nfsd_proc_mkdir(struct svc_rqst *rqstp, struct nfsd_createargs *argp, 470nfsd_proc_mkdir(struct svc_rqst *rqstp)
464 struct nfsd_diropres *resp)
465{ 471{
472 struct nfsd_createargs *argp = rqstp->rq_argp;
473 struct nfsd_diropres *resp = rqstp->rq_resp;
466 __be32 nfserr; 474 __be32 nfserr;
467 475
468 dprintk("nfsd: MKDIR %s %.*s\n", SVCFH_fmt(&argp->fh), argp->len, argp->name); 476 dprintk("nfsd: MKDIR %s %.*s\n", SVCFH_fmt(&argp->fh), argp->len, argp->name);
@@ -484,9 +492,9 @@ nfsd_proc_mkdir(struct svc_rqst *rqstp, struct nfsd_createargs *argp,
484 * Remove a directory 492 * Remove a directory
485 */ 493 */
486static __be32 494static __be32
487nfsd_proc_rmdir(struct svc_rqst *rqstp, struct nfsd_diropargs *argp, 495nfsd_proc_rmdir(struct svc_rqst *rqstp)
488 void *resp)
489{ 496{
497 struct nfsd_diropargs *argp = rqstp->rq_argp;
490 __be32 nfserr; 498 __be32 nfserr;
491 499
492 dprintk("nfsd: RMDIR %s %.*s\n", SVCFH_fmt(&argp->fh), argp->len, argp->name); 500 dprintk("nfsd: RMDIR %s %.*s\n", SVCFH_fmt(&argp->fh), argp->len, argp->name);
@@ -500,9 +508,10 @@ nfsd_proc_rmdir(struct svc_rqst *rqstp, struct nfsd_diropargs *argp,
500 * Read a portion of a directory. 508 * Read a portion of a directory.
501 */ 509 */
502static __be32 510static __be32
503nfsd_proc_readdir(struct svc_rqst *rqstp, struct nfsd_readdirargs *argp, 511nfsd_proc_readdir(struct svc_rqst *rqstp)
504 struct nfsd_readdirres *resp)
505{ 512{
513 struct nfsd_readdirargs *argp = rqstp->rq_argp;
514 struct nfsd_readdirres *resp = rqstp->rq_resp;
506 int count; 515 int count;
507 __be32 nfserr; 516 __be32 nfserr;
508 loff_t offset; 517 loff_t offset;
@@ -540,9 +549,10 @@ nfsd_proc_readdir(struct svc_rqst *rqstp, struct nfsd_readdirargs *argp,
540 * Get file system info 549 * Get file system info
541 */ 550 */
542static __be32 551static __be32
543nfsd_proc_statfs(struct svc_rqst * rqstp, struct nfsd_fhandle *argp, 552nfsd_proc_statfs(struct svc_rqst *rqstp)
544 struct nfsd_statfsres *resp)
545{ 553{
554 struct nfsd_fhandle *argp = rqstp->rq_argp;
555 struct nfsd_statfsres *resp = rqstp->rq_resp;
546 __be32 nfserr; 556 __be32 nfserr;
547 557
548 dprintk("nfsd: STATFS %s\n", SVCFH_fmt(&argp->fh)); 558 dprintk("nfsd: STATFS %s\n", SVCFH_fmt(&argp->fh));
@@ -563,168 +573,168 @@ struct nfsd_void { int dummy; };
563#define FH 8 /* filehandle */ 573#define FH 8 /* filehandle */
564#define AT 18 /* attributes */ 574#define AT 18 /* attributes */
565 575
566static struct svc_procedure nfsd_procedures2[18] = { 576static const struct svc_procedure nfsd_procedures2[18] = {
567 [NFSPROC_NULL] = { 577 [NFSPROC_NULL] = {
568 .pc_func = (svc_procfunc) nfsd_proc_null, 578 .pc_func = nfsd_proc_null,
569 .pc_decode = (kxdrproc_t) nfssvc_decode_void, 579 .pc_decode = nfssvc_decode_void,
570 .pc_encode = (kxdrproc_t) nfssvc_encode_void, 580 .pc_encode = nfssvc_encode_void,
571 .pc_argsize = sizeof(struct nfsd_void), 581 .pc_argsize = sizeof(struct nfsd_void),
572 .pc_ressize = sizeof(struct nfsd_void), 582 .pc_ressize = sizeof(struct nfsd_void),
573 .pc_cachetype = RC_NOCACHE, 583 .pc_cachetype = RC_NOCACHE,
574 .pc_xdrressize = ST, 584 .pc_xdrressize = ST,
575 }, 585 },
576 [NFSPROC_GETATTR] = { 586 [NFSPROC_GETATTR] = {
577 .pc_func = (svc_procfunc) nfsd_proc_getattr, 587 .pc_func = nfsd_proc_getattr,
578 .pc_decode = (kxdrproc_t) nfssvc_decode_fhandle, 588 .pc_decode = nfssvc_decode_fhandle,
579 .pc_encode = (kxdrproc_t) nfssvc_encode_attrstat, 589 .pc_encode = nfssvc_encode_attrstat,
580 .pc_release = (kxdrproc_t) nfssvc_release_fhandle, 590 .pc_release = nfssvc_release_fhandle,
581 .pc_argsize = sizeof(struct nfsd_fhandle), 591 .pc_argsize = sizeof(struct nfsd_fhandle),
582 .pc_ressize = sizeof(struct nfsd_attrstat), 592 .pc_ressize = sizeof(struct nfsd_attrstat),
583 .pc_cachetype = RC_NOCACHE, 593 .pc_cachetype = RC_NOCACHE,
584 .pc_xdrressize = ST+AT, 594 .pc_xdrressize = ST+AT,
585 }, 595 },
586 [NFSPROC_SETATTR] = { 596 [NFSPROC_SETATTR] = {
587 .pc_func = (svc_procfunc) nfsd_proc_setattr, 597 .pc_func = nfsd_proc_setattr,
588 .pc_decode = (kxdrproc_t) nfssvc_decode_sattrargs, 598 .pc_decode = nfssvc_decode_sattrargs,
589 .pc_encode = (kxdrproc_t) nfssvc_encode_attrstat, 599 .pc_encode = nfssvc_encode_attrstat,
590 .pc_release = (kxdrproc_t) nfssvc_release_fhandle, 600 .pc_release = nfssvc_release_fhandle,
591 .pc_argsize = sizeof(struct nfsd_sattrargs), 601 .pc_argsize = sizeof(struct nfsd_sattrargs),
592 .pc_ressize = sizeof(struct nfsd_attrstat), 602 .pc_ressize = sizeof(struct nfsd_attrstat),
593 .pc_cachetype = RC_REPLBUFF, 603 .pc_cachetype = RC_REPLBUFF,
594 .pc_xdrressize = ST+AT, 604 .pc_xdrressize = ST+AT,
595 }, 605 },
596 [NFSPROC_ROOT] = { 606 [NFSPROC_ROOT] = {
597 .pc_decode = (kxdrproc_t) nfssvc_decode_void, 607 .pc_decode = nfssvc_decode_void,
598 .pc_encode = (kxdrproc_t) nfssvc_encode_void, 608 .pc_encode = nfssvc_encode_void,
599 .pc_argsize = sizeof(struct nfsd_void), 609 .pc_argsize = sizeof(struct nfsd_void),
600 .pc_ressize = sizeof(struct nfsd_void), 610 .pc_ressize = sizeof(struct nfsd_void),
601 .pc_cachetype = RC_NOCACHE, 611 .pc_cachetype = RC_NOCACHE,
602 .pc_xdrressize = ST, 612 .pc_xdrressize = ST,
603 }, 613 },
604 [NFSPROC_LOOKUP] = { 614 [NFSPROC_LOOKUP] = {
605 .pc_func = (svc_procfunc) nfsd_proc_lookup, 615 .pc_func = nfsd_proc_lookup,
606 .pc_decode = (kxdrproc_t) nfssvc_decode_diropargs, 616 .pc_decode = nfssvc_decode_diropargs,
607 .pc_encode = (kxdrproc_t) nfssvc_encode_diropres, 617 .pc_encode = nfssvc_encode_diropres,
608 .pc_release = (kxdrproc_t) nfssvc_release_fhandle, 618 .pc_release = nfssvc_release_fhandle,
609 .pc_argsize = sizeof(struct nfsd_diropargs), 619 .pc_argsize = sizeof(struct nfsd_diropargs),
610 .pc_ressize = sizeof(struct nfsd_diropres), 620 .pc_ressize = sizeof(struct nfsd_diropres),
611 .pc_cachetype = RC_NOCACHE, 621 .pc_cachetype = RC_NOCACHE,
612 .pc_xdrressize = ST+FH+AT, 622 .pc_xdrressize = ST+FH+AT,
613 }, 623 },
614 [NFSPROC_READLINK] = { 624 [NFSPROC_READLINK] = {
615 .pc_func = (svc_procfunc) nfsd_proc_readlink, 625 .pc_func = nfsd_proc_readlink,
616 .pc_decode = (kxdrproc_t) nfssvc_decode_readlinkargs, 626 .pc_decode = nfssvc_decode_readlinkargs,
617 .pc_encode = (kxdrproc_t) nfssvc_encode_readlinkres, 627 .pc_encode = nfssvc_encode_readlinkres,
618 .pc_argsize = sizeof(struct nfsd_readlinkargs), 628 .pc_argsize = sizeof(struct nfsd_readlinkargs),
619 .pc_ressize = sizeof(struct nfsd_readlinkres), 629 .pc_ressize = sizeof(struct nfsd_readlinkres),
620 .pc_cachetype = RC_NOCACHE, 630 .pc_cachetype = RC_NOCACHE,
621 .pc_xdrressize = ST+1+NFS_MAXPATHLEN/4, 631 .pc_xdrressize = ST+1+NFS_MAXPATHLEN/4,
622 }, 632 },
623 [NFSPROC_READ] = { 633 [NFSPROC_READ] = {
624 .pc_func = (svc_procfunc) nfsd_proc_read, 634 .pc_func = nfsd_proc_read,
625 .pc_decode = (kxdrproc_t) nfssvc_decode_readargs, 635 .pc_decode = nfssvc_decode_readargs,
626 .pc_encode = (kxdrproc_t) nfssvc_encode_readres, 636 .pc_encode = nfssvc_encode_readres,
627 .pc_release = (kxdrproc_t) nfssvc_release_fhandle, 637 .pc_release = nfssvc_release_fhandle,
628 .pc_argsize = sizeof(struct nfsd_readargs), 638 .pc_argsize = sizeof(struct nfsd_readargs),
629 .pc_ressize = sizeof(struct nfsd_readres), 639 .pc_ressize = sizeof(struct nfsd_readres),
630 .pc_cachetype = RC_NOCACHE, 640 .pc_cachetype = RC_NOCACHE,
631 .pc_xdrressize = ST+AT+1+NFSSVC_MAXBLKSIZE_V2/4, 641 .pc_xdrressize = ST+AT+1+NFSSVC_MAXBLKSIZE_V2/4,
632 }, 642 },
633 [NFSPROC_WRITECACHE] = { 643 [NFSPROC_WRITECACHE] = {
634 .pc_decode = (kxdrproc_t) nfssvc_decode_void, 644 .pc_decode = nfssvc_decode_void,
635 .pc_encode = (kxdrproc_t) nfssvc_encode_void, 645 .pc_encode = nfssvc_encode_void,
636 .pc_argsize = sizeof(struct nfsd_void), 646 .pc_argsize = sizeof(struct nfsd_void),
637 .pc_ressize = sizeof(struct nfsd_void), 647 .pc_ressize = sizeof(struct nfsd_void),
638 .pc_cachetype = RC_NOCACHE, 648 .pc_cachetype = RC_NOCACHE,
639 .pc_xdrressize = ST, 649 .pc_xdrressize = ST,
640 }, 650 },
641 [NFSPROC_WRITE] = { 651 [NFSPROC_WRITE] = {
642 .pc_func = (svc_procfunc) nfsd_proc_write, 652 .pc_func = nfsd_proc_write,
643 .pc_decode = (kxdrproc_t) nfssvc_decode_writeargs, 653 .pc_decode = nfssvc_decode_writeargs,
644 .pc_encode = (kxdrproc_t) nfssvc_encode_attrstat, 654 .pc_encode = nfssvc_encode_attrstat,
645 .pc_release = (kxdrproc_t) nfssvc_release_fhandle, 655 .pc_release = nfssvc_release_fhandle,
646 .pc_argsize = sizeof(struct nfsd_writeargs), 656 .pc_argsize = sizeof(struct nfsd_writeargs),
647 .pc_ressize = sizeof(struct nfsd_attrstat), 657 .pc_ressize = sizeof(struct nfsd_attrstat),
648 .pc_cachetype = RC_REPLBUFF, 658 .pc_cachetype = RC_REPLBUFF,
649 .pc_xdrressize = ST+AT, 659 .pc_xdrressize = ST+AT,
650 }, 660 },
651 [NFSPROC_CREATE] = { 661 [NFSPROC_CREATE] = {
652 .pc_func = (svc_procfunc) nfsd_proc_create, 662 .pc_func = nfsd_proc_create,
653 .pc_decode = (kxdrproc_t) nfssvc_decode_createargs, 663 .pc_decode = nfssvc_decode_createargs,
654 .pc_encode = (kxdrproc_t) nfssvc_encode_diropres, 664 .pc_encode = nfssvc_encode_diropres,
655 .pc_release = (kxdrproc_t) nfssvc_release_fhandle, 665 .pc_release = nfssvc_release_fhandle,
656 .pc_argsize = sizeof(struct nfsd_createargs), 666 .pc_argsize = sizeof(struct nfsd_createargs),
657 .pc_ressize = sizeof(struct nfsd_diropres), 667 .pc_ressize = sizeof(struct nfsd_diropres),
658 .pc_cachetype = RC_REPLBUFF, 668 .pc_cachetype = RC_REPLBUFF,
659 .pc_xdrressize = ST+FH+AT, 669 .pc_xdrressize = ST+FH+AT,
660 }, 670 },
661 [NFSPROC_REMOVE] = { 671 [NFSPROC_REMOVE] = {
662 .pc_func = (svc_procfunc) nfsd_proc_remove, 672 .pc_func = nfsd_proc_remove,
663 .pc_decode = (kxdrproc_t) nfssvc_decode_diropargs, 673 .pc_decode = nfssvc_decode_diropargs,
664 .pc_encode = (kxdrproc_t) nfssvc_encode_void, 674 .pc_encode = nfssvc_encode_void,
665 .pc_argsize = sizeof(struct nfsd_diropargs), 675 .pc_argsize = sizeof(struct nfsd_diropargs),
666 .pc_ressize = sizeof(struct nfsd_void), 676 .pc_ressize = sizeof(struct nfsd_void),
667 .pc_cachetype = RC_REPLSTAT, 677 .pc_cachetype = RC_REPLSTAT,
668 .pc_xdrressize = ST, 678 .pc_xdrressize = ST,
669 }, 679 },
670 [NFSPROC_RENAME] = { 680 [NFSPROC_RENAME] = {
671 .pc_func = (svc_procfunc) nfsd_proc_rename, 681 .pc_func = nfsd_proc_rename,
672 .pc_decode = (kxdrproc_t) nfssvc_decode_renameargs, 682 .pc_decode = nfssvc_decode_renameargs,
673 .pc_encode = (kxdrproc_t) nfssvc_encode_void, 683 .pc_encode = nfssvc_encode_void,
674 .pc_argsize = sizeof(struct nfsd_renameargs), 684 .pc_argsize = sizeof(struct nfsd_renameargs),
675 .pc_ressize = sizeof(struct nfsd_void), 685 .pc_ressize = sizeof(struct nfsd_void),
676 .pc_cachetype = RC_REPLSTAT, 686 .pc_cachetype = RC_REPLSTAT,
677 .pc_xdrressize = ST, 687 .pc_xdrressize = ST,
678 }, 688 },
679 [NFSPROC_LINK] = { 689 [NFSPROC_LINK] = {
680 .pc_func = (svc_procfunc) nfsd_proc_link, 690 .pc_func = nfsd_proc_link,
681 .pc_decode = (kxdrproc_t) nfssvc_decode_linkargs, 691 .pc_decode = nfssvc_decode_linkargs,
682 .pc_encode = (kxdrproc_t) nfssvc_encode_void, 692 .pc_encode = nfssvc_encode_void,
683 .pc_argsize = sizeof(struct nfsd_linkargs), 693 .pc_argsize = sizeof(struct nfsd_linkargs),
684 .pc_ressize = sizeof(struct nfsd_void), 694 .pc_ressize = sizeof(struct nfsd_void),
685 .pc_cachetype = RC_REPLSTAT, 695 .pc_cachetype = RC_REPLSTAT,
686 .pc_xdrressize = ST, 696 .pc_xdrressize = ST,
687 }, 697 },
688 [NFSPROC_SYMLINK] = { 698 [NFSPROC_SYMLINK] = {
689 .pc_func = (svc_procfunc) nfsd_proc_symlink, 699 .pc_func = nfsd_proc_symlink,
690 .pc_decode = (kxdrproc_t) nfssvc_decode_symlinkargs, 700 .pc_decode = nfssvc_decode_symlinkargs,
691 .pc_encode = (kxdrproc_t) nfssvc_encode_void, 701 .pc_encode = nfssvc_encode_void,
692 .pc_argsize = sizeof(struct nfsd_symlinkargs), 702 .pc_argsize = sizeof(struct nfsd_symlinkargs),
693 .pc_ressize = sizeof(struct nfsd_void), 703 .pc_ressize = sizeof(struct nfsd_void),
694 .pc_cachetype = RC_REPLSTAT, 704 .pc_cachetype = RC_REPLSTAT,
695 .pc_xdrressize = ST, 705 .pc_xdrressize = ST,
696 }, 706 },
697 [NFSPROC_MKDIR] = { 707 [NFSPROC_MKDIR] = {
698 .pc_func = (svc_procfunc) nfsd_proc_mkdir, 708 .pc_func = nfsd_proc_mkdir,
699 .pc_decode = (kxdrproc_t) nfssvc_decode_createargs, 709 .pc_decode = nfssvc_decode_createargs,
700 .pc_encode = (kxdrproc_t) nfssvc_encode_diropres, 710 .pc_encode = nfssvc_encode_diropres,
701 .pc_release = (kxdrproc_t) nfssvc_release_fhandle, 711 .pc_release = nfssvc_release_fhandle,
702 .pc_argsize = sizeof(struct nfsd_createargs), 712 .pc_argsize = sizeof(struct nfsd_createargs),
703 .pc_ressize = sizeof(struct nfsd_diropres), 713 .pc_ressize = sizeof(struct nfsd_diropres),
704 .pc_cachetype = RC_REPLBUFF, 714 .pc_cachetype = RC_REPLBUFF,
705 .pc_xdrressize = ST+FH+AT, 715 .pc_xdrressize = ST+FH+AT,
706 }, 716 },
707 [NFSPROC_RMDIR] = { 717 [NFSPROC_RMDIR] = {
708 .pc_func = (svc_procfunc) nfsd_proc_rmdir, 718 .pc_func = nfsd_proc_rmdir,
709 .pc_decode = (kxdrproc_t) nfssvc_decode_diropargs, 719 .pc_decode = nfssvc_decode_diropargs,
710 .pc_encode = (kxdrproc_t) nfssvc_encode_void, 720 .pc_encode = nfssvc_encode_void,
711 .pc_argsize = sizeof(struct nfsd_diropargs), 721 .pc_argsize = sizeof(struct nfsd_diropargs),
712 .pc_ressize = sizeof(struct nfsd_void), 722 .pc_ressize = sizeof(struct nfsd_void),
713 .pc_cachetype = RC_REPLSTAT, 723 .pc_cachetype = RC_REPLSTAT,
714 .pc_xdrressize = ST, 724 .pc_xdrressize = ST,
715 }, 725 },
716 [NFSPROC_READDIR] = { 726 [NFSPROC_READDIR] = {
717 .pc_func = (svc_procfunc) nfsd_proc_readdir, 727 .pc_func = nfsd_proc_readdir,
718 .pc_decode = (kxdrproc_t) nfssvc_decode_readdirargs, 728 .pc_decode = nfssvc_decode_readdirargs,
719 .pc_encode = (kxdrproc_t) nfssvc_encode_readdirres, 729 .pc_encode = nfssvc_encode_readdirres,
720 .pc_argsize = sizeof(struct nfsd_readdirargs), 730 .pc_argsize = sizeof(struct nfsd_readdirargs),
721 .pc_ressize = sizeof(struct nfsd_readdirres), 731 .pc_ressize = sizeof(struct nfsd_readdirres),
722 .pc_cachetype = RC_NOCACHE, 732 .pc_cachetype = RC_NOCACHE,
723 }, 733 },
724 [NFSPROC_STATFS] = { 734 [NFSPROC_STATFS] = {
725 .pc_func = (svc_procfunc) nfsd_proc_statfs, 735 .pc_func = nfsd_proc_statfs,
726 .pc_decode = (kxdrproc_t) nfssvc_decode_fhandle, 736 .pc_decode = nfssvc_decode_fhandle,
727 .pc_encode = (kxdrproc_t) nfssvc_encode_statfsres, 737 .pc_encode = nfssvc_encode_statfsres,
728 .pc_argsize = sizeof(struct nfsd_fhandle), 738 .pc_argsize = sizeof(struct nfsd_fhandle),
729 .pc_ressize = sizeof(struct nfsd_statfsres), 739 .pc_ressize = sizeof(struct nfsd_statfsres),
730 .pc_cachetype = RC_NOCACHE, 740 .pc_cachetype = RC_NOCACHE,
@@ -733,12 +743,14 @@ static struct svc_procedure nfsd_procedures2[18] = {
733}; 743};
734 744
735 745
736struct svc_version nfsd_version2 = { 746static unsigned int nfsd_count2[ARRAY_SIZE(nfsd_procedures2)];
737 .vs_vers = 2, 747const struct svc_version nfsd_version2 = {
738 .vs_nproc = 18, 748 .vs_vers = 2,
739 .vs_proc = nfsd_procedures2, 749 .vs_nproc = 18,
740 .vs_dispatch = nfsd_dispatch, 750 .vs_proc = nfsd_procedures2,
741 .vs_xdrsize = NFS2_SVC_XDRSIZE, 751 .vs_count = nfsd_count2,
752 .vs_dispatch = nfsd_dispatch,
753 .vs_xdrsize = NFS2_SVC_XDRSIZE,
742}; 754};
743 755
744/* 756/*
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index 59979f0bbd4b..063ae7de2c12 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -68,14 +68,14 @@ unsigned long nfsd_drc_mem_used;
68 68
69#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) 69#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
70static struct svc_stat nfsd_acl_svcstats; 70static struct svc_stat nfsd_acl_svcstats;
71static struct svc_version * nfsd_acl_version[] = { 71static const struct svc_version *nfsd_acl_version[] = {
72 [2] = &nfsd_acl_version2, 72 [2] = &nfsd_acl_version2,
73 [3] = &nfsd_acl_version3, 73 [3] = &nfsd_acl_version3,
74}; 74};
75 75
76#define NFSD_ACL_MINVERS 2 76#define NFSD_ACL_MINVERS 2
77#define NFSD_ACL_NRVERS ARRAY_SIZE(nfsd_acl_version) 77#define NFSD_ACL_NRVERS ARRAY_SIZE(nfsd_acl_version)
78static struct svc_version *nfsd_acl_versions[NFSD_ACL_NRVERS]; 78static const struct svc_version *nfsd_acl_versions[NFSD_ACL_NRVERS];
79 79
80static struct svc_program nfsd_acl_program = { 80static struct svc_program nfsd_acl_program = {
81 .pg_prog = NFS_ACL_PROGRAM, 81 .pg_prog = NFS_ACL_PROGRAM,
@@ -92,7 +92,7 @@ static struct svc_stat nfsd_acl_svcstats = {
92}; 92};
93#endif /* defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) */ 93#endif /* defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) */
94 94
95static struct svc_version * nfsd_version[] = { 95static const struct svc_version *nfsd_version[] = {
96 [2] = &nfsd_version2, 96 [2] = &nfsd_version2,
97#if defined(CONFIG_NFSD_V3) 97#if defined(CONFIG_NFSD_V3)
98 [3] = &nfsd_version3, 98 [3] = &nfsd_version3,
@@ -104,7 +104,7 @@ static struct svc_version * nfsd_version[] = {
104 104
105#define NFSD_MINVERS 2 105#define NFSD_MINVERS 2
106#define NFSD_NRVERS ARRAY_SIZE(nfsd_version) 106#define NFSD_NRVERS ARRAY_SIZE(nfsd_version)
107static struct svc_version *nfsd_versions[NFSD_NRVERS]; 107static const struct svc_version *nfsd_versions[NFSD_NRVERS];
108 108
109struct svc_program nfsd_program = { 109struct svc_program nfsd_program = {
110#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) 110#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
@@ -756,7 +756,7 @@ static __be32 map_new_errors(u32 vers, __be32 nfserr)
756 * problem, we enforce these assumptions here: 756 * problem, we enforce these assumptions here:
757 */ 757 */
758static bool nfs_request_too_big(struct svc_rqst *rqstp, 758static bool nfs_request_too_big(struct svc_rqst *rqstp,
759 struct svc_procedure *proc) 759 const struct svc_procedure *proc)
760{ 760{
761 /* 761 /*
762 * The ACL code has more careful bounds-checking and is not 762 * The ACL code has more careful bounds-checking and is not
@@ -781,8 +781,7 @@ static bool nfs_request_too_big(struct svc_rqst *rqstp,
781int 781int
782nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp) 782nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp)
783{ 783{
784 struct svc_procedure *proc; 784 const struct svc_procedure *proc;
785 kxdrproc_t xdr;
786 __be32 nfserr; 785 __be32 nfserr;
787 __be32 *nfserrp; 786 __be32 *nfserrp;
788 787
@@ -801,9 +800,8 @@ nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp)
801 */ 800 */
802 rqstp->rq_cachetype = proc->pc_cachetype; 801 rqstp->rq_cachetype = proc->pc_cachetype;
803 /* Decode arguments */ 802 /* Decode arguments */
804 xdr = proc->pc_decode; 803 if (proc->pc_decode &&
805 if (xdr && !xdr(rqstp, (__be32*)rqstp->rq_arg.head[0].iov_base, 804 !proc->pc_decode(rqstp, (__be32*)rqstp->rq_arg.head[0].iov_base)) {
806 rqstp->rq_argp)) {
807 dprintk("nfsd: failed to decode arguments!\n"); 805 dprintk("nfsd: failed to decode arguments!\n");
808 *statp = rpc_garbage_args; 806 *statp = rpc_garbage_args;
809 return 1; 807 return 1;
@@ -827,7 +825,7 @@ nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp)
827 rqstp->rq_res.head[0].iov_len += sizeof(__be32); 825 rqstp->rq_res.head[0].iov_len += sizeof(__be32);
828 826
829 /* Now call the procedure handler, and encode NFS status. */ 827 /* Now call the procedure handler, and encode NFS status. */
830 nfserr = proc->pc_func(rqstp, rqstp->rq_argp, rqstp->rq_resp); 828 nfserr = proc->pc_func(rqstp);
831 nfserr = map_new_errors(rqstp->rq_vers, nfserr); 829 nfserr = map_new_errors(rqstp->rq_vers, nfserr);
832 if (nfserr == nfserr_dropit || test_bit(RQ_DROPME, &rqstp->rq_flags)) { 830 if (nfserr == nfserr_dropit || test_bit(RQ_DROPME, &rqstp->rq_flags)) {
833 dprintk("nfsd: Dropping request; may be revisited later\n"); 831 dprintk("nfsd: Dropping request; may be revisited later\n");
@@ -842,9 +840,7 @@ nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp)
842 * For NFSv2, additional info is never returned in case of an error. 840 * For NFSv2, additional info is never returned in case of an error.
843 */ 841 */
844 if (!(nfserr && rqstp->rq_vers == 2)) { 842 if (!(nfserr && rqstp->rq_vers == 2)) {
845 xdr = proc->pc_encode; 843 if (proc->pc_encode && !proc->pc_encode(rqstp, nfserrp)) {
846 if (xdr && !xdr(rqstp, nfserrp,
847 rqstp->rq_resp)) {
848 /* Failed to encode result. Release cache entry */ 844 /* Failed to encode result. Release cache entry */
849 dprintk("nfsd: failed to encode result!\n"); 845 dprintk("nfsd: failed to encode result!\n");
850 nfsd_cache_update(rqstp, RC_NOCACHE, NULL); 846 nfsd_cache_update(rqstp, RC_NOCACHE, NULL);
diff --git a/fs/nfsd/nfsxdr.c b/fs/nfsd/nfsxdr.c
index de07ff625777..e4da2717982d 100644
--- a/fs/nfsd/nfsxdr.c
+++ b/fs/nfsd/nfsxdr.c
@@ -206,14 +206,16 @@ __be32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *f
206 * XDR decode functions 206 * XDR decode functions
207 */ 207 */
208int 208int
209nfssvc_decode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy) 209nfssvc_decode_void(struct svc_rqst *rqstp, __be32 *p)
210{ 210{
211 return xdr_argsize_check(rqstp, p); 211 return xdr_argsize_check(rqstp, p);
212} 212}
213 213
214int 214int
215nfssvc_decode_fhandle(struct svc_rqst *rqstp, __be32 *p, struct nfsd_fhandle *args) 215nfssvc_decode_fhandle(struct svc_rqst *rqstp, __be32 *p)
216{ 216{
217 struct nfsd_fhandle *args = rqstp->rq_argp;
218
217 p = decode_fh(p, &args->fh); 219 p = decode_fh(p, &args->fh);
218 if (!p) 220 if (!p)
219 return 0; 221 return 0;
@@ -221,9 +223,10 @@ nfssvc_decode_fhandle(struct svc_rqst *rqstp, __be32 *p, struct nfsd_fhandle *ar
221} 223}
222 224
223int 225int
224nfssvc_decode_sattrargs(struct svc_rqst *rqstp, __be32 *p, 226nfssvc_decode_sattrargs(struct svc_rqst *rqstp, __be32 *p)
225 struct nfsd_sattrargs *args)
226{ 227{
228 struct nfsd_sattrargs *args = rqstp->rq_argp;
229
227 p = decode_fh(p, &args->fh); 230 p = decode_fh(p, &args->fh);
228 if (!p) 231 if (!p)
229 return 0; 232 return 0;
@@ -233,9 +236,10 @@ nfssvc_decode_sattrargs(struct svc_rqst *rqstp, __be32 *p,
233} 236}
234 237
235int 238int
236nfssvc_decode_diropargs(struct svc_rqst *rqstp, __be32 *p, 239nfssvc_decode_diropargs(struct svc_rqst *rqstp, __be32 *p)
237 struct nfsd_diropargs *args)
238{ 240{
241 struct nfsd_diropargs *args = rqstp->rq_argp;
242
239 if (!(p = decode_fh(p, &args->fh)) 243 if (!(p = decode_fh(p, &args->fh))
240 || !(p = decode_filename(p, &args->name, &args->len))) 244 || !(p = decode_filename(p, &args->name, &args->len)))
241 return 0; 245 return 0;
@@ -244,9 +248,9 @@ nfssvc_decode_diropargs(struct svc_rqst *rqstp, __be32 *p,
244} 248}
245 249
246int 250int
247nfssvc_decode_readargs(struct svc_rqst *rqstp, __be32 *p, 251nfssvc_decode_readargs(struct svc_rqst *rqstp, __be32 *p)
248 struct nfsd_readargs *args)
249{ 252{
253 struct nfsd_readargs *args = rqstp->rq_argp;
250 unsigned int len; 254 unsigned int len;
251 int v; 255 int v;
252 p = decode_fh(p, &args->fh); 256 p = decode_fh(p, &args->fh);
@@ -276,9 +280,9 @@ nfssvc_decode_readargs(struct svc_rqst *rqstp, __be32 *p,
276} 280}
277 281
278int 282int
279nfssvc_decode_writeargs(struct svc_rqst *rqstp, __be32 *p, 283nfssvc_decode_writeargs(struct svc_rqst *rqstp, __be32 *p)
280 struct nfsd_writeargs *args)
281{ 284{
285 struct nfsd_writeargs *args = rqstp->rq_argp;
282 unsigned int len, hdr, dlen; 286 unsigned int len, hdr, dlen;
283 struct kvec *head = rqstp->rq_arg.head; 287 struct kvec *head = rqstp->rq_arg.head;
284 int v; 288 int v;
@@ -332,9 +336,10 @@ nfssvc_decode_writeargs(struct svc_rqst *rqstp, __be32 *p,
332} 336}
333 337
334int 338int
335nfssvc_decode_createargs(struct svc_rqst *rqstp, __be32 *p, 339nfssvc_decode_createargs(struct svc_rqst *rqstp, __be32 *p)
336 struct nfsd_createargs *args)
337{ 340{
341 struct nfsd_createargs *args = rqstp->rq_argp;
342
338 if ( !(p = decode_fh(p, &args->fh)) 343 if ( !(p = decode_fh(p, &args->fh))
339 || !(p = decode_filename(p, &args->name, &args->len))) 344 || !(p = decode_filename(p, &args->name, &args->len)))
340 return 0; 345 return 0;
@@ -344,9 +349,10 @@ nfssvc_decode_createargs(struct svc_rqst *rqstp, __be32 *p,
344} 349}
345 350
346int 351int
347nfssvc_decode_renameargs(struct svc_rqst *rqstp, __be32 *p, 352nfssvc_decode_renameargs(struct svc_rqst *rqstp, __be32 *p)
348 struct nfsd_renameargs *args)
349{ 353{
354 struct nfsd_renameargs *args = rqstp->rq_argp;
355
350 if (!(p = decode_fh(p, &args->ffh)) 356 if (!(p = decode_fh(p, &args->ffh))
351 || !(p = decode_filename(p, &args->fname, &args->flen)) 357 || !(p = decode_filename(p, &args->fname, &args->flen))
352 || !(p = decode_fh(p, &args->tfh)) 358 || !(p = decode_fh(p, &args->tfh))
@@ -357,8 +363,10 @@ nfssvc_decode_renameargs(struct svc_rqst *rqstp, __be32 *p,
357} 363}
358 364
359int 365int
360nfssvc_decode_readlinkargs(struct svc_rqst *rqstp, __be32 *p, struct nfsd_readlinkargs *args) 366nfssvc_decode_readlinkargs(struct svc_rqst *rqstp, __be32 *p)
361{ 367{
368 struct nfsd_readlinkargs *args = rqstp->rq_argp;
369
362 p = decode_fh(p, &args->fh); 370 p = decode_fh(p, &args->fh);
363 if (!p) 371 if (!p)
364 return 0; 372 return 0;
@@ -368,9 +376,10 @@ nfssvc_decode_readlinkargs(struct svc_rqst *rqstp, __be32 *p, struct nfsd_readli
368} 376}
369 377
370int 378int
371nfssvc_decode_linkargs(struct svc_rqst *rqstp, __be32 *p, 379nfssvc_decode_linkargs(struct svc_rqst *rqstp, __be32 *p)
372 struct nfsd_linkargs *args)
373{ 380{
381 struct nfsd_linkargs *args = rqstp->rq_argp;
382
374 if (!(p = decode_fh(p, &args->ffh)) 383 if (!(p = decode_fh(p, &args->ffh))
375 || !(p = decode_fh(p, &args->tfh)) 384 || !(p = decode_fh(p, &args->tfh))
376 || !(p = decode_filename(p, &args->tname, &args->tlen))) 385 || !(p = decode_filename(p, &args->tname, &args->tlen)))
@@ -380,9 +389,10 @@ nfssvc_decode_linkargs(struct svc_rqst *rqstp, __be32 *p,
380} 389}
381 390
382int 391int
383nfssvc_decode_symlinkargs(struct svc_rqst *rqstp, __be32 *p, 392nfssvc_decode_symlinkargs(struct svc_rqst *rqstp, __be32 *p)
384 struct nfsd_symlinkargs *args)
385{ 393{
394 struct nfsd_symlinkargs *args = rqstp->rq_argp;
395
386 if ( !(p = decode_fh(p, &args->ffh)) 396 if ( !(p = decode_fh(p, &args->ffh))
387 || !(p = decode_filename(p, &args->fname, &args->flen)) 397 || !(p = decode_filename(p, &args->fname, &args->flen))
388 || !(p = decode_pathname(p, &args->tname, &args->tlen))) 398 || !(p = decode_pathname(p, &args->tname, &args->tlen)))
@@ -393,9 +403,10 @@ nfssvc_decode_symlinkargs(struct svc_rqst *rqstp, __be32 *p,
393} 403}
394 404
395int 405int
396nfssvc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p, 406nfssvc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p)
397 struct nfsd_readdirargs *args)
398{ 407{
408 struct nfsd_readdirargs *args = rqstp->rq_argp;
409
399 p = decode_fh(p, &args->fh); 410 p = decode_fh(p, &args->fh);
400 if (!p) 411 if (!p)
401 return 0; 412 return 0;
@@ -411,32 +422,35 @@ nfssvc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p,
411 * XDR encode functions 422 * XDR encode functions
412 */ 423 */
413int 424int
414nfssvc_encode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy) 425nfssvc_encode_void(struct svc_rqst *rqstp, __be32 *p)
415{ 426{
416 return xdr_ressize_check(rqstp, p); 427 return xdr_ressize_check(rqstp, p);
417} 428}
418 429
419int 430int
420nfssvc_encode_attrstat(struct svc_rqst *rqstp, __be32 *p, 431nfssvc_encode_attrstat(struct svc_rqst *rqstp, __be32 *p)
421 struct nfsd_attrstat *resp)
422{ 432{
433 struct nfsd_attrstat *resp = rqstp->rq_resp;
434
423 p = encode_fattr(rqstp, p, &resp->fh, &resp->stat); 435 p = encode_fattr(rqstp, p, &resp->fh, &resp->stat);
424 return xdr_ressize_check(rqstp, p); 436 return xdr_ressize_check(rqstp, p);
425} 437}
426 438
427int 439int
428nfssvc_encode_diropres(struct svc_rqst *rqstp, __be32 *p, 440nfssvc_encode_diropres(struct svc_rqst *rqstp, __be32 *p)
429 struct nfsd_diropres *resp)
430{ 441{
442 struct nfsd_diropres *resp = rqstp->rq_resp;
443
431 p = encode_fh(p, &resp->fh); 444 p = encode_fh(p, &resp->fh);
432 p = encode_fattr(rqstp, p, &resp->fh, &resp->stat); 445 p = encode_fattr(rqstp, p, &resp->fh, &resp->stat);
433 return xdr_ressize_check(rqstp, p); 446 return xdr_ressize_check(rqstp, p);
434} 447}
435 448
436int 449int
437nfssvc_encode_readlinkres(struct svc_rqst *rqstp, __be32 *p, 450nfssvc_encode_readlinkres(struct svc_rqst *rqstp, __be32 *p)
438 struct nfsd_readlinkres *resp)
439{ 451{
452 struct nfsd_readlinkres *resp = rqstp->rq_resp;
453
440 *p++ = htonl(resp->len); 454 *p++ = htonl(resp->len);
441 xdr_ressize_check(rqstp, p); 455 xdr_ressize_check(rqstp, p);
442 rqstp->rq_res.page_len = resp->len; 456 rqstp->rq_res.page_len = resp->len;
@@ -450,9 +464,10 @@ nfssvc_encode_readlinkres(struct svc_rqst *rqstp, __be32 *p,
450} 464}
451 465
452int 466int
453nfssvc_encode_readres(struct svc_rqst *rqstp, __be32 *p, 467nfssvc_encode_readres(struct svc_rqst *rqstp, __be32 *p)
454 struct nfsd_readres *resp)
455{ 468{
469 struct nfsd_readres *resp = rqstp->rq_resp;
470
456 p = encode_fattr(rqstp, p, &resp->fh, &resp->stat); 471 p = encode_fattr(rqstp, p, &resp->fh, &resp->stat);
457 *p++ = htonl(resp->count); 472 *p++ = htonl(resp->count);
458 xdr_ressize_check(rqstp, p); 473 xdr_ressize_check(rqstp, p);
@@ -469,9 +484,10 @@ nfssvc_encode_readres(struct svc_rqst *rqstp, __be32 *p,
469} 484}
470 485
471int 486int
472nfssvc_encode_readdirres(struct svc_rqst *rqstp, __be32 *p, 487nfssvc_encode_readdirres(struct svc_rqst *rqstp, __be32 *p)
473 struct nfsd_readdirres *resp)
474{ 488{
489 struct nfsd_readdirres *resp = rqstp->rq_resp;
490
475 xdr_ressize_check(rqstp, p); 491 xdr_ressize_check(rqstp, p);
476 p = resp->buffer; 492 p = resp->buffer;
477 *p++ = 0; /* no more entries */ 493 *p++ = 0; /* no more entries */
@@ -482,9 +498,9 @@ nfssvc_encode_readdirres(struct svc_rqst *rqstp, __be32 *p,
482} 498}
483 499
484int 500int
485nfssvc_encode_statfsres(struct svc_rqst *rqstp, __be32 *p, 501nfssvc_encode_statfsres(struct svc_rqst *rqstp, __be32 *p)
486 struct nfsd_statfsres *resp)
487{ 502{
503 struct nfsd_statfsres *resp = rqstp->rq_resp;
488 struct kstatfs *stat = &resp->stats; 504 struct kstatfs *stat = &resp->stats;
489 505
490 *p++ = htonl(NFSSVC_MAXBLKSIZE_V2); /* max transfer size */ 506 *p++ = htonl(NFSSVC_MAXBLKSIZE_V2); /* max transfer size */
@@ -543,10 +559,10 @@ nfssvc_encode_entry(void *ccdv, const char *name,
543/* 559/*
544 * XDR release functions 560 * XDR release functions
545 */ 561 */
546int 562void
547nfssvc_release_fhandle(struct svc_rqst *rqstp, __be32 *p, 563nfssvc_release_fhandle(struct svc_rqst *rqstp)
548 struct nfsd_fhandle *resp)
549{ 564{
565 struct nfsd_fhandle *resp = rqstp->rq_resp;
566
550 fh_put(&resp->fh); 567 fh_put(&resp->fh);
551 return 1;
552} 568}
diff --git a/fs/nfsd/xdr.h b/fs/nfsd/xdr.h
index 4f0481d63804..457ce45e5084 100644
--- a/fs/nfsd/xdr.h
+++ b/fs/nfsd/xdr.h
@@ -131,40 +131,30 @@ union nfsd_xdrstore {
131#define NFS2_SVC_XDRSIZE sizeof(union nfsd_xdrstore) 131#define NFS2_SVC_XDRSIZE sizeof(union nfsd_xdrstore)
132 132
133 133
134int nfssvc_decode_void(struct svc_rqst *, __be32 *, void *); 134int nfssvc_decode_void(struct svc_rqst *, __be32 *);
135int nfssvc_decode_fhandle(struct svc_rqst *, __be32 *, struct nfsd_fhandle *); 135int nfssvc_decode_fhandle(struct svc_rqst *, __be32 *);
136int nfssvc_decode_sattrargs(struct svc_rqst *, __be32 *, 136int nfssvc_decode_sattrargs(struct svc_rqst *, __be32 *);
137 struct nfsd_sattrargs *); 137int nfssvc_decode_diropargs(struct svc_rqst *, __be32 *);
138int nfssvc_decode_diropargs(struct svc_rqst *, __be32 *, 138int nfssvc_decode_readargs(struct svc_rqst *, __be32 *);
139 struct nfsd_diropargs *); 139int nfssvc_decode_writeargs(struct svc_rqst *, __be32 *);
140int nfssvc_decode_readargs(struct svc_rqst *, __be32 *, 140int nfssvc_decode_createargs(struct svc_rqst *, __be32 *);
141 struct nfsd_readargs *); 141int nfssvc_decode_renameargs(struct svc_rqst *, __be32 *);
142int nfssvc_decode_writeargs(struct svc_rqst *, __be32 *, 142int nfssvc_decode_readlinkargs(struct svc_rqst *, __be32 *);
143 struct nfsd_writeargs *); 143int nfssvc_decode_linkargs(struct svc_rqst *, __be32 *);
144int nfssvc_decode_createargs(struct svc_rqst *, __be32 *, 144int nfssvc_decode_symlinkargs(struct svc_rqst *, __be32 *);
145 struct nfsd_createargs *); 145int nfssvc_decode_readdirargs(struct svc_rqst *, __be32 *);
146int nfssvc_decode_renameargs(struct svc_rqst *, __be32 *, 146int nfssvc_encode_void(struct svc_rqst *, __be32 *);
147 struct nfsd_renameargs *); 147int nfssvc_encode_attrstat(struct svc_rqst *, __be32 *);
148int nfssvc_decode_readlinkargs(struct svc_rqst *, __be32 *, 148int nfssvc_encode_diropres(struct svc_rqst *, __be32 *);
149 struct nfsd_readlinkargs *); 149int nfssvc_encode_readlinkres(struct svc_rqst *, __be32 *);
150int nfssvc_decode_linkargs(struct svc_rqst *, __be32 *, 150int nfssvc_encode_readres(struct svc_rqst *, __be32 *);
151 struct nfsd_linkargs *); 151int nfssvc_encode_statfsres(struct svc_rqst *, __be32 *);
152int nfssvc_decode_symlinkargs(struct svc_rqst *, __be32 *, 152int nfssvc_encode_readdirres(struct svc_rqst *, __be32 *);
153 struct nfsd_symlinkargs *);
154int nfssvc_decode_readdirargs(struct svc_rqst *, __be32 *,
155 struct nfsd_readdirargs *);
156int nfssvc_encode_void(struct svc_rqst *, __be32 *, void *);
157int nfssvc_encode_attrstat(struct svc_rqst *, __be32 *, struct nfsd_attrstat *);
158int nfssvc_encode_diropres(struct svc_rqst *, __be32 *, struct nfsd_diropres *);
159int nfssvc_encode_readlinkres(struct svc_rqst *, __be32 *, struct nfsd_readlinkres *);
160int nfssvc_encode_readres(struct svc_rqst *, __be32 *, struct nfsd_readres *);
161int nfssvc_encode_statfsres(struct svc_rqst *, __be32 *, struct nfsd_statfsres *);
162int nfssvc_encode_readdirres(struct svc_rqst *, __be32 *, struct nfsd_readdirres *);
163 153
164int nfssvc_encode_entry(void *, const char *name, 154int nfssvc_encode_entry(void *, const char *name,
165 int namlen, loff_t offset, u64 ino, unsigned int); 155 int namlen, loff_t offset, u64 ino, unsigned int);
166 156
167int nfssvc_release_fhandle(struct svc_rqst *, __be32 *, struct nfsd_fhandle *); 157void nfssvc_release_fhandle(struct svc_rqst *);
168 158
169/* Helper functions for NFSv2 ACL code */ 159/* Helper functions for NFSv2 ACL code */
170__be32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp, struct kstat *stat); 160__be32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp, struct kstat *stat);
diff --git a/fs/nfsd/xdr3.h b/fs/nfsd/xdr3.h
index 335e04aaf7db..80d7da620e91 100644
--- a/fs/nfsd/xdr3.h
+++ b/fs/nfsd/xdr3.h
@@ -269,71 +269,41 @@ union nfsd3_xdrstore {
269 269
270#define NFS3_SVC_XDRSIZE sizeof(union nfsd3_xdrstore) 270#define NFS3_SVC_XDRSIZE sizeof(union nfsd3_xdrstore)
271 271
272int nfs3svc_decode_fhandle(struct svc_rqst *, __be32 *, struct nfsd_fhandle *); 272int nfs3svc_decode_fhandle(struct svc_rqst *, __be32 *);
273int nfs3svc_decode_sattrargs(struct svc_rqst *, __be32 *, 273int nfs3svc_decode_sattrargs(struct svc_rqst *, __be32 *);
274 struct nfsd3_sattrargs *); 274int nfs3svc_decode_diropargs(struct svc_rqst *, __be32 *);
275int nfs3svc_decode_diropargs(struct svc_rqst *, __be32 *, 275int nfs3svc_decode_accessargs(struct svc_rqst *, __be32 *);
276 struct nfsd3_diropargs *); 276int nfs3svc_decode_readargs(struct svc_rqst *, __be32 *);
277int nfs3svc_decode_accessargs(struct svc_rqst *, __be32 *, 277int nfs3svc_decode_writeargs(struct svc_rqst *, __be32 *);
278 struct nfsd3_accessargs *); 278int nfs3svc_decode_createargs(struct svc_rqst *, __be32 *);
279int nfs3svc_decode_readargs(struct svc_rqst *, __be32 *, 279int nfs3svc_decode_mkdirargs(struct svc_rqst *, __be32 *);
280 struct nfsd3_readargs *); 280int nfs3svc_decode_mknodargs(struct svc_rqst *, __be32 *);
281int nfs3svc_decode_writeargs(struct svc_rqst *, __be32 *, 281int nfs3svc_decode_renameargs(struct svc_rqst *, __be32 *);
282 struct nfsd3_writeargs *); 282int nfs3svc_decode_readlinkargs(struct svc_rqst *, __be32 *);
283int nfs3svc_decode_createargs(struct svc_rqst *, __be32 *, 283int nfs3svc_decode_linkargs(struct svc_rqst *, __be32 *);
284 struct nfsd3_createargs *); 284int nfs3svc_decode_symlinkargs(struct svc_rqst *, __be32 *);
285int nfs3svc_decode_mkdirargs(struct svc_rqst *, __be32 *, 285int nfs3svc_decode_readdirargs(struct svc_rqst *, __be32 *);
286 struct nfsd3_createargs *); 286int nfs3svc_decode_readdirplusargs(struct svc_rqst *, __be32 *);
287int nfs3svc_decode_mknodargs(struct svc_rqst *, __be32 *, 287int nfs3svc_decode_commitargs(struct svc_rqst *, __be32 *);
288 struct nfsd3_mknodargs *); 288int nfs3svc_encode_voidres(struct svc_rqst *, __be32 *);
289int nfs3svc_decode_renameargs(struct svc_rqst *, __be32 *, 289int nfs3svc_encode_attrstat(struct svc_rqst *, __be32 *);
290 struct nfsd3_renameargs *); 290int nfs3svc_encode_wccstat(struct svc_rqst *, __be32 *);
291int nfs3svc_decode_readlinkargs(struct svc_rqst *, __be32 *, 291int nfs3svc_encode_diropres(struct svc_rqst *, __be32 *);
292 struct nfsd3_readlinkargs *); 292int nfs3svc_encode_accessres(struct svc_rqst *, __be32 *);
293int nfs3svc_decode_linkargs(struct svc_rqst *, __be32 *, 293int nfs3svc_encode_readlinkres(struct svc_rqst *, __be32 *);
294 struct nfsd3_linkargs *); 294int nfs3svc_encode_readres(struct svc_rqst *, __be32 *);
295int nfs3svc_decode_symlinkargs(struct svc_rqst *, __be32 *, 295int nfs3svc_encode_writeres(struct svc_rqst *, __be32 *);
296 struct nfsd3_symlinkargs *); 296int nfs3svc_encode_createres(struct svc_rqst *, __be32 *);
297int nfs3svc_decode_readdirargs(struct svc_rqst *, __be32 *, 297int nfs3svc_encode_renameres(struct svc_rqst *, __be32 *);
298 struct nfsd3_readdirargs *); 298int nfs3svc_encode_linkres(struct svc_rqst *, __be32 *);
299int nfs3svc_decode_readdirplusargs(struct svc_rqst *, __be32 *, 299int nfs3svc_encode_readdirres(struct svc_rqst *, __be32 *);
300 struct nfsd3_readdirargs *); 300int nfs3svc_encode_fsstatres(struct svc_rqst *, __be32 *);
301int nfs3svc_decode_commitargs(struct svc_rqst *, __be32 *, 301int nfs3svc_encode_fsinfores(struct svc_rqst *, __be32 *);
302 struct nfsd3_commitargs *); 302int nfs3svc_encode_pathconfres(struct svc_rqst *, __be32 *);
303int nfs3svc_encode_voidres(struct svc_rqst *, __be32 *, void *); 303int nfs3svc_encode_commitres(struct svc_rqst *, __be32 *);
304int nfs3svc_encode_attrstat(struct svc_rqst *, __be32 *, 304
305 struct nfsd3_attrstat *); 305void nfs3svc_release_fhandle(struct svc_rqst *);
306int nfs3svc_encode_wccstat(struct svc_rqst *, __be32 *, 306void nfs3svc_release_fhandle2(struct svc_rqst *);
307 struct nfsd3_attrstat *);
308int nfs3svc_encode_diropres(struct svc_rqst *, __be32 *,
309 struct nfsd3_diropres *);
310int nfs3svc_encode_accessres(struct svc_rqst *, __be32 *,
311 struct nfsd3_accessres *);
312int nfs3svc_encode_readlinkres(struct svc_rqst *, __be32 *,
313 struct nfsd3_readlinkres *);
314int nfs3svc_encode_readres(struct svc_rqst *, __be32 *, struct nfsd3_readres *);
315int nfs3svc_encode_writeres(struct svc_rqst *, __be32 *, struct nfsd3_writeres *);
316int nfs3svc_encode_createres(struct svc_rqst *, __be32 *,
317 struct nfsd3_diropres *);
318int nfs3svc_encode_renameres(struct svc_rqst *, __be32 *,
319 struct nfsd3_renameres *);
320int nfs3svc_encode_linkres(struct svc_rqst *, __be32 *,
321 struct nfsd3_linkres *);
322int nfs3svc_encode_readdirres(struct svc_rqst *, __be32 *,
323 struct nfsd3_readdirres *);
324int nfs3svc_encode_fsstatres(struct svc_rqst *, __be32 *,
325 struct nfsd3_fsstatres *);
326int nfs3svc_encode_fsinfores(struct svc_rqst *, __be32 *,
327 struct nfsd3_fsinfores *);
328int nfs3svc_encode_pathconfres(struct svc_rqst *, __be32 *,
329 struct nfsd3_pathconfres *);
330int nfs3svc_encode_commitres(struct svc_rqst *, __be32 *,
331 struct nfsd3_commitres *);
332
333int nfs3svc_release_fhandle(struct svc_rqst *, __be32 *,
334 struct nfsd3_attrstat *);
335int nfs3svc_release_fhandle2(struct svc_rqst *, __be32 *,
336 struct nfsd3_fhandle_pair *);
337int nfs3svc_encode_entry(void *, const char *name, 307int nfs3svc_encode_entry(void *, const char *name,
338 int namlen, loff_t offset, u64 ino, 308 int namlen, loff_t offset, u64 ino,
339 unsigned int); 309 unsigned int);
diff --git a/fs/nfsd/xdr4.h b/fs/nfsd/xdr4.h
index 8fda4abdf3b1..72c6ad136107 100644
--- a/fs/nfsd/xdr4.h
+++ b/fs/nfsd/xdr4.h
@@ -539,7 +539,7 @@ struct nfsd4_seek {
539struct nfsd4_op { 539struct nfsd4_op {
540 int opnum; 540 int opnum;
541 __be32 status; 541 __be32 status;
542 union { 542 union nfsd4_op_u {
543 struct nfsd4_access access; 543 struct nfsd4_access access;
544 struct nfsd4_close close; 544 struct nfsd4_close close;
545 struct nfsd4_commit commit; 545 struct nfsd4_commit commit;
@@ -577,6 +577,7 @@ struct nfsd4_op {
577 struct nfsd4_bind_conn_to_session bind_conn_to_session; 577 struct nfsd4_bind_conn_to_session bind_conn_to_session;
578 struct nfsd4_create_session create_session; 578 struct nfsd4_create_session create_session;
579 struct nfsd4_destroy_session destroy_session; 579 struct nfsd4_destroy_session destroy_session;
580 struct nfsd4_destroy_clientid destroy_clientid;
580 struct nfsd4_sequence sequence; 581 struct nfsd4_sequence sequence;
581 struct nfsd4_reclaim_complete reclaim_complete; 582 struct nfsd4_reclaim_complete reclaim_complete;
582 struct nfsd4_test_stateid test_stateid; 583 struct nfsd4_test_stateid test_stateid;
@@ -585,6 +586,7 @@ struct nfsd4_op {
585 struct nfsd4_layoutget layoutget; 586 struct nfsd4_layoutget layoutget;
586 struct nfsd4_layoutcommit layoutcommit; 587 struct nfsd4_layoutcommit layoutcommit;
587 struct nfsd4_layoutreturn layoutreturn; 588 struct nfsd4_layoutreturn layoutreturn;
589 struct nfsd4_secinfo_no_name secinfo_no_name;
588 590
589 /* NFSv4.2 */ 591 /* NFSv4.2 */
590 struct nfsd4_fallocate allocate; 592 struct nfsd4_fallocate allocate;
@@ -682,11 +684,9 @@ set_change_info(struct nfsd4_change_info *cinfo, struct svc_fh *fhp)
682 684
683 685
684bool nfsd4_mach_creds_match(struct nfs4_client *cl, struct svc_rqst *rqstp); 686bool nfsd4_mach_creds_match(struct nfs4_client *cl, struct svc_rqst *rqstp);
685int nfs4svc_encode_voidres(struct svc_rqst *, __be32 *, void *); 687int nfs4svc_encode_voidres(struct svc_rqst *, __be32 *);
686int nfs4svc_decode_compoundargs(struct svc_rqst *, __be32 *, 688int nfs4svc_decode_compoundargs(struct svc_rqst *, __be32 *);
687 struct nfsd4_compoundargs *); 689int nfs4svc_encode_compoundres(struct svc_rqst *, __be32 *);
688int nfs4svc_encode_compoundres(struct svc_rqst *, __be32 *,
689 struct nfsd4_compoundres *);
690__be32 nfsd4_check_resp_size(struct nfsd4_compoundres *, u32); 690__be32 nfsd4_check_resp_size(struct nfsd4_compoundres *, u32);
691void nfsd4_encode_operation(struct nfsd4_compoundres *, struct nfsd4_op *); 691void nfsd4_encode_operation(struct nfsd4_compoundres *, struct nfsd4_op *);
692void nfsd4_encode_replay(struct xdr_stream *xdr, struct nfsd4_op *op); 692void nfsd4_encode_replay(struct xdr_stream *xdr, struct nfsd4_op *op);
@@ -695,27 +695,26 @@ __be32 nfsd4_encode_fattr_to_buf(__be32 **p, int words,
695 struct dentry *dentry, 695 struct dentry *dentry,
696 u32 *bmval, struct svc_rqst *, int ignore_crossmnt); 696 u32 *bmval, struct svc_rqst *, int ignore_crossmnt);
697extern __be32 nfsd4_setclientid(struct svc_rqst *rqstp, 697extern __be32 nfsd4_setclientid(struct svc_rqst *rqstp,
698 struct nfsd4_compound_state *, 698 struct nfsd4_compound_state *, union nfsd4_op_u *u);
699 struct nfsd4_setclientid *setclid);
700extern __be32 nfsd4_setclientid_confirm(struct svc_rqst *rqstp, 699extern __be32 nfsd4_setclientid_confirm(struct svc_rqst *rqstp,
701 struct nfsd4_compound_state *, 700 struct nfsd4_compound_state *, union nfsd4_op_u *u);
702 struct nfsd4_setclientid_confirm *setclientid_confirm);
703extern __be32 nfsd4_exchange_id(struct svc_rqst *rqstp, 701extern __be32 nfsd4_exchange_id(struct svc_rqst *rqstp,
704 struct nfsd4_compound_state *, struct nfsd4_exchange_id *); 702 struct nfsd4_compound_state *, union nfsd4_op_u *u);
705extern __be32 nfsd4_backchannel_ctl(struct svc_rqst *, struct nfsd4_compound_state *, struct nfsd4_backchannel_ctl *); 703extern __be32 nfsd4_backchannel_ctl(struct svc_rqst *,
706extern __be32 nfsd4_bind_conn_to_session(struct svc_rqst *, struct nfsd4_compound_state *, struct nfsd4_bind_conn_to_session *); 704 struct nfsd4_compound_state *, union nfsd4_op_u *u);
705extern __be32 nfsd4_bind_conn_to_session(struct svc_rqst *,
706 struct nfsd4_compound_state *, union nfsd4_op_u *u);
707extern __be32 nfsd4_create_session(struct svc_rqst *, 707extern __be32 nfsd4_create_session(struct svc_rqst *,
708 struct nfsd4_compound_state *, 708 struct nfsd4_compound_state *, union nfsd4_op_u *u);
709 struct nfsd4_create_session *);
710extern __be32 nfsd4_sequence(struct svc_rqst *, 709extern __be32 nfsd4_sequence(struct svc_rqst *,
711 struct nfsd4_compound_state *, 710 struct nfsd4_compound_state *, union nfsd4_op_u *u);
712 struct nfsd4_sequence *);
713extern void nfsd4_sequence_done(struct nfsd4_compoundres *resp); 711extern void nfsd4_sequence_done(struct nfsd4_compoundres *resp);
714extern __be32 nfsd4_destroy_session(struct svc_rqst *, 712extern __be32 nfsd4_destroy_session(struct svc_rqst *,
715 struct nfsd4_compound_state *, 713 struct nfsd4_compound_state *, union nfsd4_op_u *u);
716 struct nfsd4_destroy_session *); 714extern __be32 nfsd4_destroy_clientid(struct svc_rqst *, struct nfsd4_compound_state *,
717extern __be32 nfsd4_destroy_clientid(struct svc_rqst *, struct nfsd4_compound_state *, struct nfsd4_destroy_clientid *); 715 union nfsd4_op_u *u);
718__be32 nfsd4_reclaim_complete(struct svc_rqst *, struct nfsd4_compound_state *, struct nfsd4_reclaim_complete *); 716__be32 nfsd4_reclaim_complete(struct svc_rqst *, struct nfsd4_compound_state *,
717 union nfsd4_op_u *u);
719extern __be32 nfsd4_process_open1(struct nfsd4_compound_state *, 718extern __be32 nfsd4_process_open1(struct nfsd4_compound_state *,
720 struct nfsd4_open *open, struct nfsd_net *nn); 719 struct nfsd4_open *open, struct nfsd_net *nn);
721extern __be32 nfsd4_process_open2(struct svc_rqst *rqstp, 720extern __be32 nfsd4_process_open2(struct svc_rqst *rqstp,
@@ -724,34 +723,29 @@ extern void nfsd4_cstate_clear_replay(struct nfsd4_compound_state *cstate);
724extern void nfsd4_cleanup_open_state(struct nfsd4_compound_state *cstate, 723extern void nfsd4_cleanup_open_state(struct nfsd4_compound_state *cstate,
725 struct nfsd4_open *open); 724 struct nfsd4_open *open);
726extern __be32 nfsd4_open_confirm(struct svc_rqst *rqstp, 725extern __be32 nfsd4_open_confirm(struct svc_rqst *rqstp,
727 struct nfsd4_compound_state *, struct nfsd4_open_confirm *oc); 726 struct nfsd4_compound_state *, union nfsd4_op_u *u);
728extern __be32 nfsd4_close(struct svc_rqst *rqstp, 727extern __be32 nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *,
729 struct nfsd4_compound_state *, 728 union nfsd4_op_u *u);
730 struct nfsd4_close *close);
731extern __be32 nfsd4_open_downgrade(struct svc_rqst *rqstp, 729extern __be32 nfsd4_open_downgrade(struct svc_rqst *rqstp,
732 struct nfsd4_compound_state *, 730 struct nfsd4_compound_state *, union nfsd4_op_u *u);
733 struct nfsd4_open_downgrade *od);
734extern __be32 nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *, 731extern __be32 nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *,
735 struct nfsd4_lock *lock); 732 union nfsd4_op_u *u);
736extern __be32 nfsd4_lockt(struct svc_rqst *rqstp, 733extern __be32 nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *,
737 struct nfsd4_compound_state *, 734 union nfsd4_op_u *u);
738 struct nfsd4_lockt *lockt); 735extern __be32 nfsd4_locku(struct svc_rqst *rqstp, struct nfsd4_compound_state *,
739extern __be32 nfsd4_locku(struct svc_rqst *rqstp, 736 union nfsd4_op_u *u);
740 struct nfsd4_compound_state *,
741 struct nfsd4_locku *locku);
742extern __be32 737extern __be32
743nfsd4_release_lockowner(struct svc_rqst *rqstp, 738nfsd4_release_lockowner(struct svc_rqst *rqstp,
744 struct nfsd4_compound_state *, 739 struct nfsd4_compound_state *, union nfsd4_op_u *u);
745 struct nfsd4_release_lockowner *rlockowner); 740extern void nfsd4_release_compoundargs(struct svc_rqst *rqstp);
746extern int nfsd4_release_compoundargs(void *rq, __be32 *p, void *resp);
747extern __be32 nfsd4_delegreturn(struct svc_rqst *rqstp, 741extern __be32 nfsd4_delegreturn(struct svc_rqst *rqstp,
748 struct nfsd4_compound_state *, struct nfsd4_delegreturn *dr); 742 struct nfsd4_compound_state *, union nfsd4_op_u *u);
749extern __be32 nfsd4_renew(struct svc_rqst *rqstp, 743extern __be32 nfsd4_renew(struct svc_rqst *rqstp, struct nfsd4_compound_state *,
750 struct nfsd4_compound_state *, clientid_t *clid); 744 union nfsd4_op_u *u);
751extern __be32 nfsd4_test_stateid(struct svc_rqst *rqstp, 745extern __be32 nfsd4_test_stateid(struct svc_rqst *rqstp,
752 struct nfsd4_compound_state *, struct nfsd4_test_stateid *test_stateid); 746 struct nfsd4_compound_state *, union nfsd4_op_u *);
753extern __be32 nfsd4_free_stateid(struct svc_rqst *rqstp, 747extern __be32 nfsd4_free_stateid(struct svc_rqst *rqstp,
754 struct nfsd4_compound_state *, struct nfsd4_free_stateid *free_stateid); 748 struct nfsd4_compound_state *, union nfsd4_op_u *);
755extern void nfsd4_bump_seqid(struct nfsd4_compound_state *, __be32 nfserr); 749extern void nfsd4_bump_seqid(struct nfsd4_compound_state *, __be32 nfserr);
756 750
757#endif 751#endif
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index 41f7b6a04d69..3eca67728366 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -192,9 +192,9 @@ struct nlm_block {
192 * Global variables 192 * Global variables
193 */ 193 */
194extern const struct rpc_program nlm_program; 194extern const struct rpc_program nlm_program;
195extern struct svc_procedure nlmsvc_procedures[]; 195extern const struct svc_procedure nlmsvc_procedures[];
196#ifdef CONFIG_LOCKD_V4 196#ifdef CONFIG_LOCKD_V4
197extern struct svc_procedure nlmsvc_procedures4[]; 197extern const struct svc_procedure nlmsvc_procedures4[];
198#endif 198#endif
199extern int nlmsvc_grace_period; 199extern int nlmsvc_grace_period;
200extern unsigned long nlmsvc_timeout; 200extern unsigned long nlmsvc_timeout;
diff --git a/include/linux/lockd/xdr.h b/include/linux/lockd/xdr.h
index d39ed1cc5fbf..7acbecc21a40 100644
--- a/include/linux/lockd/xdr.h
+++ b/include/linux/lockd/xdr.h
@@ -95,19 +95,19 @@ struct nlm_reboot {
95 */ 95 */
96#define NLMSVC_XDRSIZE sizeof(struct nlm_args) 96#define NLMSVC_XDRSIZE sizeof(struct nlm_args)
97 97
98int nlmsvc_decode_testargs(struct svc_rqst *, __be32 *, struct nlm_args *); 98int nlmsvc_decode_testargs(struct svc_rqst *, __be32 *);
99int nlmsvc_encode_testres(struct svc_rqst *, __be32 *, struct nlm_res *); 99int nlmsvc_encode_testres(struct svc_rqst *, __be32 *);
100int nlmsvc_decode_lockargs(struct svc_rqst *, __be32 *, struct nlm_args *); 100int nlmsvc_decode_lockargs(struct svc_rqst *, __be32 *);
101int nlmsvc_decode_cancargs(struct svc_rqst *, __be32 *, struct nlm_args *); 101int nlmsvc_decode_cancargs(struct svc_rqst *, __be32 *);
102int nlmsvc_decode_unlockargs(struct svc_rqst *, __be32 *, struct nlm_args *); 102int nlmsvc_decode_unlockargs(struct svc_rqst *, __be32 *);
103int nlmsvc_encode_res(struct svc_rqst *, __be32 *, struct nlm_res *); 103int nlmsvc_encode_res(struct svc_rqst *, __be32 *);
104int nlmsvc_decode_res(struct svc_rqst *, __be32 *, struct nlm_res *); 104int nlmsvc_decode_res(struct svc_rqst *, __be32 *);
105int nlmsvc_encode_void(struct svc_rqst *, __be32 *, void *); 105int nlmsvc_encode_void(struct svc_rqst *, __be32 *);
106int nlmsvc_decode_void(struct svc_rqst *, __be32 *, void *); 106int nlmsvc_decode_void(struct svc_rqst *, __be32 *);
107int nlmsvc_decode_shareargs(struct svc_rqst *, __be32 *, struct nlm_args *); 107int nlmsvc_decode_shareargs(struct svc_rqst *, __be32 *);
108int nlmsvc_encode_shareres(struct svc_rqst *, __be32 *, struct nlm_res *); 108int nlmsvc_encode_shareres(struct svc_rqst *, __be32 *);
109int nlmsvc_decode_notify(struct svc_rqst *, __be32 *, struct nlm_args *); 109int nlmsvc_decode_notify(struct svc_rqst *, __be32 *);
110int nlmsvc_decode_reboot(struct svc_rqst *, __be32 *, struct nlm_reboot *); 110int nlmsvc_decode_reboot(struct svc_rqst *, __be32 *);
111/* 111/*
112int nlmclt_encode_testargs(struct rpc_rqst *, u32 *, struct nlm_args *); 112int nlmclt_encode_testargs(struct rpc_rqst *, u32 *, struct nlm_args *);
113int nlmclt_encode_lockargs(struct rpc_rqst *, u32 *, struct nlm_args *); 113int nlmclt_encode_lockargs(struct rpc_rqst *, u32 *, struct nlm_args *);
diff --git a/include/linux/lockd/xdr4.h b/include/linux/lockd/xdr4.h
index e58c88b52ce1..bf1645609225 100644
--- a/include/linux/lockd/xdr4.h
+++ b/include/linux/lockd/xdr4.h
@@ -23,19 +23,19 @@
23 23
24 24
25 25
26int nlm4svc_decode_testargs(struct svc_rqst *, __be32 *, struct nlm_args *); 26int nlm4svc_decode_testargs(struct svc_rqst *, __be32 *);
27int nlm4svc_encode_testres(struct svc_rqst *, __be32 *, struct nlm_res *); 27int nlm4svc_encode_testres(struct svc_rqst *, __be32 *);
28int nlm4svc_decode_lockargs(struct svc_rqst *, __be32 *, struct nlm_args *); 28int nlm4svc_decode_lockargs(struct svc_rqst *, __be32 *);
29int nlm4svc_decode_cancargs(struct svc_rqst *, __be32 *, struct nlm_args *); 29int nlm4svc_decode_cancargs(struct svc_rqst *, __be32 *);
30int nlm4svc_decode_unlockargs(struct svc_rqst *, __be32 *, struct nlm_args *); 30int nlm4svc_decode_unlockargs(struct svc_rqst *, __be32 *);
31int nlm4svc_encode_res(struct svc_rqst *, __be32 *, struct nlm_res *); 31int nlm4svc_encode_res(struct svc_rqst *, __be32 *);
32int nlm4svc_decode_res(struct svc_rqst *, __be32 *, struct nlm_res *); 32int nlm4svc_decode_res(struct svc_rqst *, __be32 *);
33int nlm4svc_encode_void(struct svc_rqst *, __be32 *, void *); 33int nlm4svc_encode_void(struct svc_rqst *, __be32 *);
34int nlm4svc_decode_void(struct svc_rqst *, __be32 *, void *); 34int nlm4svc_decode_void(struct svc_rqst *, __be32 *);
35int nlm4svc_decode_shareargs(struct svc_rqst *, __be32 *, struct nlm_args *); 35int nlm4svc_decode_shareargs(struct svc_rqst *, __be32 *);
36int nlm4svc_encode_shareres(struct svc_rqst *, __be32 *, struct nlm_res *); 36int nlm4svc_encode_shareres(struct svc_rqst *, __be32 *);
37int nlm4svc_decode_notify(struct svc_rqst *, __be32 *, struct nlm_args *); 37int nlm4svc_decode_notify(struct svc_rqst *, __be32 *);
38int nlm4svc_decode_reboot(struct svc_rqst *, __be32 *, struct nlm_reboot *); 38int nlm4svc_decode_reboot(struct svc_rqst *, __be32 *);
39/* 39/*
40int nlmclt_encode_testargs(struct rpc_rqst *, u32 *, struct nlm_args *); 40int nlmclt_encode_testargs(struct rpc_rqst *, u32 *, struct nlm_args *);
41int nlmclt_encode_lockargs(struct rpc_rqst *, u32 *, struct nlm_args *); 41int nlmclt_encode_lockargs(struct rpc_rqst *, u32 *, struct nlm_args *);
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index 6095ecba0dde..55ef67bea06b 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -39,7 +39,7 @@ struct rpc_clnt {
39 struct list_head cl_tasks; /* List of tasks */ 39 struct list_head cl_tasks; /* List of tasks */
40 spinlock_t cl_lock; /* spinlock */ 40 spinlock_t cl_lock; /* spinlock */
41 struct rpc_xprt __rcu * cl_xprt; /* transport */ 41 struct rpc_xprt __rcu * cl_xprt; /* transport */
42 struct rpc_procinfo * cl_procinfo; /* procedure info */ 42 const struct rpc_procinfo *cl_procinfo; /* procedure info */
43 u32 cl_prog, /* RPC program number */ 43 u32 cl_prog, /* RPC program number */
44 cl_vers, /* RPC version number */ 44 cl_vers, /* RPC version number */
45 cl_maxproc; /* max procedure number */ 45 cl_maxproc; /* max procedure number */
@@ -87,7 +87,8 @@ struct rpc_program {
87struct rpc_version { 87struct rpc_version {
88 u32 number; /* version number */ 88 u32 number; /* version number */
89 unsigned int nrprocs; /* number of procs */ 89 unsigned int nrprocs; /* number of procs */
90 struct rpc_procinfo * procs; /* procedure array */ 90 const struct rpc_procinfo *procs; /* procedure array */
91 unsigned int *counts; /* call counts */
91}; 92};
92 93
93/* 94/*
@@ -99,7 +100,6 @@ struct rpc_procinfo {
99 kxdrdproc_t p_decode; /* XDR decode function */ 100 kxdrdproc_t p_decode; /* XDR decode function */
100 unsigned int p_arglen; /* argument hdr length (u32) */ 101 unsigned int p_arglen; /* argument hdr length (u32) */
101 unsigned int p_replen; /* reply hdr length (u32) */ 102 unsigned int p_replen; /* reply hdr length (u32) */
102 unsigned int p_count; /* call count */
103 unsigned int p_timer; /* Which RTT timer to use */ 103 unsigned int p_timer; /* Which RTT timer to use */
104 u32 p_statidx; /* Which procedure to account */ 104 u32 p_statidx; /* Which procedure to account */
105 const char * p_name; /* name of procedure */ 105 const char * p_name; /* name of procedure */
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 9d7529ffc4ce..50a99a117da7 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -22,7 +22,7 @@
22 */ 22 */
23struct rpc_procinfo; 23struct rpc_procinfo;
24struct rpc_message { 24struct rpc_message {
25 struct rpc_procinfo * rpc_proc; /* Procedure information */ 25 const struct rpc_procinfo *rpc_proc; /* Procedure information */
26 void * rpc_argp; /* Arguments */ 26 void * rpc_argp; /* Arguments */
27 void * rpc_resp; /* Result */ 27 void * rpc_resp; /* Result */
28 struct rpc_cred * rpc_cred; /* Credentials */ 28 struct rpc_cred * rpc_cred; /* Credentials */
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 11cef5a7bc87..a3f8af9bd543 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -237,7 +237,7 @@ struct svc_rqst {
237 237
238 struct svc_serv * rq_server; /* RPC service definition */ 238 struct svc_serv * rq_server; /* RPC service definition */
239 struct svc_pool * rq_pool; /* thread pool */ 239 struct svc_pool * rq_pool; /* thread pool */
240 struct svc_procedure * rq_procinfo; /* procedure info */ 240 const struct svc_procedure *rq_procinfo;/* procedure info */
241 struct auth_ops * rq_authop; /* authentication flavour */ 241 struct auth_ops * rq_authop; /* authentication flavour */
242 struct svc_cred rq_cred; /* auth info */ 242 struct svc_cred rq_cred; /* auth info */
243 void * rq_xprt_ctxt; /* transport specific context ptr */ 243 void * rq_xprt_ctxt; /* transport specific context ptr */
@@ -246,7 +246,7 @@ struct svc_rqst {
246 size_t rq_xprt_hlen; /* xprt header len */ 246 size_t rq_xprt_hlen; /* xprt header len */
247 struct xdr_buf rq_arg; 247 struct xdr_buf rq_arg;
248 struct xdr_buf rq_res; 248 struct xdr_buf rq_res;
249 struct page * rq_pages[RPCSVC_MAXPAGES]; 249 struct page *rq_pages[RPCSVC_MAXPAGES + 1];
250 struct page * *rq_respages; /* points into rq_pages */ 250 struct page * *rq_respages; /* points into rq_pages */
251 struct page * *rq_next_page; /* next reply page to use */ 251 struct page * *rq_next_page; /* next reply page to use */
252 struct page * *rq_page_end; /* one past the last page */ 252 struct page * *rq_page_end; /* one past the last page */
@@ -384,7 +384,7 @@ struct svc_program {
384 unsigned int pg_lovers; /* lowest version */ 384 unsigned int pg_lovers; /* lowest version */
385 unsigned int pg_hivers; /* highest version */ 385 unsigned int pg_hivers; /* highest version */
386 unsigned int pg_nvers; /* number of versions */ 386 unsigned int pg_nvers; /* number of versions */
387 struct svc_version ** pg_vers; /* version array */ 387 const struct svc_version **pg_vers; /* version array */
388 char * pg_name; /* service name */ 388 char * pg_name; /* service name */
389 char * pg_class; /* class name: services sharing authentication */ 389 char * pg_class; /* class name: services sharing authentication */
390 struct svc_stat * pg_stats; /* rpc statistics */ 390 struct svc_stat * pg_stats; /* rpc statistics */
@@ -397,7 +397,8 @@ struct svc_program {
397struct svc_version { 397struct svc_version {
398 u32 vs_vers; /* version number */ 398 u32 vs_vers; /* version number */
399 u32 vs_nproc; /* number of procedures */ 399 u32 vs_nproc; /* number of procedures */
400 struct svc_procedure * vs_proc; /* per-procedure info */ 400 const struct svc_procedure *vs_proc; /* per-procedure info */
401 unsigned int *vs_count; /* call counts */
401 u32 vs_xdrsize; /* xdrsize needed for this version */ 402 u32 vs_xdrsize; /* xdrsize needed for this version */
402 403
403 /* Don't register with rpcbind */ 404 /* Don't register with rpcbind */
@@ -419,15 +420,17 @@ struct svc_version {
419/* 420/*
420 * RPC procedure info 421 * RPC procedure info
421 */ 422 */
422typedef __be32 (*svc_procfunc)(struct svc_rqst *, void *argp, void *resp);
423struct svc_procedure { 423struct svc_procedure {
424 svc_procfunc pc_func; /* process the request */ 424 /* process the request: */
425 kxdrproc_t pc_decode; /* XDR decode args */ 425 __be32 (*pc_func)(struct svc_rqst *);
426 kxdrproc_t pc_encode; /* XDR encode result */ 426 /* XDR decode args: */
427 kxdrproc_t pc_release; /* XDR free result */ 427 int (*pc_decode)(struct svc_rqst *, __be32 *data);
428 /* XDR encode result: */
429 int (*pc_encode)(struct svc_rqst *, __be32 *data);
430 /* XDR free result: */
431 void (*pc_release)(struct svc_rqst *);
428 unsigned int pc_argsize; /* argument struct size */ 432 unsigned int pc_argsize; /* argument struct size */
429 unsigned int pc_ressize; /* result struct size */ 433 unsigned int pc_ressize; /* result struct size */
430 unsigned int pc_count; /* call count */
431 unsigned int pc_cachetype; /* cache info (NFS) */ 434 unsigned int pc_cachetype; /* cache info (NFS) */
432 unsigned int pc_xdrressize; /* maximum size of XDR reply */ 435 unsigned int pc_xdrressize; /* maximum size of XDR reply */
433}; 436};
diff --git a/include/linux/sunrpc/svc_rdma.h b/include/linux/sunrpc/svc_rdma.h
index f3787d800ba4..995c6fe9ee90 100644
--- a/include/linux/sunrpc/svc_rdma.h
+++ b/include/linux/sunrpc/svc_rdma.h
@@ -77,46 +77,25 @@ extern atomic_t rdma_stat_sq_prod;
77 */ 77 */
78struct svc_rdma_op_ctxt { 78struct svc_rdma_op_ctxt {
79 struct list_head list; 79 struct list_head list;
80 struct svc_rdma_op_ctxt *read_hdr;
81 struct svc_rdma_fastreg_mr *frmr;
82 int hdr_count;
83 struct xdr_buf arg; 80 struct xdr_buf arg;
84 struct ib_cqe cqe; 81 struct ib_cqe cqe;
85 struct ib_cqe reg_cqe;
86 struct ib_cqe inv_cqe;
87 u32 byte_len; 82 u32 byte_len;
88 u32 position;
89 struct svcxprt_rdma *xprt; 83 struct svcxprt_rdma *xprt;
90 unsigned long flags;
91 enum dma_data_direction direction; 84 enum dma_data_direction direction;
92 int count; 85 int count;
93 unsigned int mapped_sges; 86 unsigned int mapped_sges;
87 int hdr_count;
94 struct ib_send_wr send_wr; 88 struct ib_send_wr send_wr;
95 struct ib_sge sge[1 + RPCRDMA_MAX_INLINE_THRESH / PAGE_SIZE]; 89 struct ib_sge sge[1 + RPCRDMA_MAX_INLINE_THRESH / PAGE_SIZE];
96 struct page *pages[RPCSVC_MAXPAGES]; 90 struct page *pages[RPCSVC_MAXPAGES];
97}; 91};
98 92
99struct svc_rdma_fastreg_mr {
100 struct ib_mr *mr;
101 struct scatterlist *sg;
102 int sg_nents;
103 unsigned long access_flags;
104 enum dma_data_direction direction;
105 struct list_head frmr_list;
106};
107
108#define RDMACTXT_F_LAST_CTXT 2
109
110#define SVCRDMA_DEVCAP_FAST_REG 1 /* fast mr registration */
111#define SVCRDMA_DEVCAP_READ_W_INV 2 /* read w/ invalidate */
112
113struct svcxprt_rdma { 93struct svcxprt_rdma {
114 struct svc_xprt sc_xprt; /* SVC transport structure */ 94 struct svc_xprt sc_xprt; /* SVC transport structure */
115 struct rdma_cm_id *sc_cm_id; /* RDMA connection id */ 95 struct rdma_cm_id *sc_cm_id; /* RDMA connection id */
116 struct list_head sc_accept_q; /* Conn. waiting accept */ 96 struct list_head sc_accept_q; /* Conn. waiting accept */
117 int sc_ord; /* RDMA read limit */ 97 int sc_ord; /* RDMA read limit */
118 int sc_max_sge; 98 int sc_max_sge;
119 int sc_max_sge_rd; /* max sge for read target */
120 bool sc_snd_w_inv; /* OK to use Send With Invalidate */ 99 bool sc_snd_w_inv; /* OK to use Send With Invalidate */
121 100
122 atomic_t sc_sq_avail; /* SQEs ready to be consumed */ 101 atomic_t sc_sq_avail; /* SQEs ready to be consumed */
@@ -141,14 +120,6 @@ struct svcxprt_rdma {
141 struct ib_qp *sc_qp; 120 struct ib_qp *sc_qp;
142 struct ib_cq *sc_rq_cq; 121 struct ib_cq *sc_rq_cq;
143 struct ib_cq *sc_sq_cq; 122 struct ib_cq *sc_sq_cq;
144 int (*sc_reader)(struct svcxprt_rdma *,
145 struct svc_rqst *,
146 struct svc_rdma_op_ctxt *,
147 int *, u32 *, u32, u32, u64, bool);
148 u32 sc_dev_caps; /* distilled device caps */
149 unsigned int sc_frmr_pg_list_len;
150 struct list_head sc_frmr_q;
151 spinlock_t sc_frmr_q_lock;
152 123
153 spinlock_t sc_lock; /* transport lock */ 124 spinlock_t sc_lock; /* transport lock */
154 125
@@ -185,20 +156,14 @@ extern int svc_rdma_handle_bc_reply(struct rpc_xprt *xprt,
185 __be32 *rdma_resp, 156 __be32 *rdma_resp,
186 struct xdr_buf *rcvbuf); 157 struct xdr_buf *rcvbuf);
187 158
188/* svc_rdma_marshal.c */
189extern int svc_rdma_xdr_decode_req(struct xdr_buf *);
190
191/* svc_rdma_recvfrom.c */ 159/* svc_rdma_recvfrom.c */
192extern int svc_rdma_recvfrom(struct svc_rqst *); 160extern int svc_rdma_recvfrom(struct svc_rqst *);
193extern int rdma_read_chunk_lcl(struct svcxprt_rdma *, struct svc_rqst *,
194 struct svc_rdma_op_ctxt *, int *, u32 *,
195 u32, u32, u64, bool);
196extern int rdma_read_chunk_frmr(struct svcxprt_rdma *, struct svc_rqst *,
197 struct svc_rdma_op_ctxt *, int *, u32 *,
198 u32, u32, u64, bool);
199 161
200/* svc_rdma_rw.c */ 162/* svc_rdma_rw.c */
201extern void svc_rdma_destroy_rw_ctxts(struct svcxprt_rdma *rdma); 163extern void svc_rdma_destroy_rw_ctxts(struct svcxprt_rdma *rdma);
164extern int svc_rdma_recv_read_chunk(struct svcxprt_rdma *rdma,
165 struct svc_rqst *rqstp,
166 struct svc_rdma_op_ctxt *head, __be32 *p);
202extern int svc_rdma_send_write_chunk(struct svcxprt_rdma *rdma, 167extern int svc_rdma_send_write_chunk(struct svcxprt_rdma *rdma,
203 __be32 *wr_ch, struct xdr_buf *xdr); 168 __be32 *wr_ch, struct xdr_buf *xdr);
204extern int svc_rdma_send_reply_chunk(struct svcxprt_rdma *rdma, 169extern int svc_rdma_send_reply_chunk(struct svcxprt_rdma *rdma,
@@ -226,9 +191,6 @@ extern int svc_rdma_create_listen(struct svc_serv *, int, struct sockaddr *);
226extern struct svc_rdma_op_ctxt *svc_rdma_get_context(struct svcxprt_rdma *); 191extern struct svc_rdma_op_ctxt *svc_rdma_get_context(struct svcxprt_rdma *);
227extern void svc_rdma_put_context(struct svc_rdma_op_ctxt *, int); 192extern void svc_rdma_put_context(struct svc_rdma_op_ctxt *, int);
228extern void svc_rdma_unmap_dma(struct svc_rdma_op_ctxt *ctxt); 193extern void svc_rdma_unmap_dma(struct svc_rdma_op_ctxt *ctxt);
229extern struct svc_rdma_fastreg_mr *svc_rdma_get_frmr(struct svcxprt_rdma *);
230extern void svc_rdma_put_frmr(struct svcxprt_rdma *,
231 struct svc_rdma_fastreg_mr *);
232extern void svc_sq_reap(struct svcxprt_rdma *); 194extern void svc_sq_reap(struct svcxprt_rdma *);
233extern void svc_rq_reap(struct svcxprt_rdma *); 195extern void svc_rq_reap(struct svcxprt_rdma *);
234extern void svc_rdma_prep_reply_hdr(struct svc_rqst *); 196extern void svc_rdma_prep_reply_hdr(struct svc_rqst *);
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index 054c8cde18f3..261b48a2701d 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -17,6 +17,8 @@
17#include <asm/unaligned.h> 17#include <asm/unaligned.h>
18#include <linux/scatterlist.h> 18#include <linux/scatterlist.h>
19 19
20struct rpc_rqst;
21
20/* 22/*
21 * Buffer adjustment 23 * Buffer adjustment
22 */ 24 */
@@ -33,13 +35,6 @@ struct xdr_netobj {
33}; 35};
34 36
35/* 37/*
36 * This is the legacy generic XDR function. rqstp is either a rpc_rqst
37 * (client side) or svc_rqst pointer (server side).
38 * Encode functions always assume there's enough room in the buffer.
39 */
40typedef int (*kxdrproc_t)(void *rqstp, __be32 *data, void *obj);
41
42/*
43 * Basic structure for transmission/reception of a client XDR message. 38 * Basic structure for transmission/reception of a client XDR message.
44 * Features a header (for a linear buffer containing RPC headers 39 * Features a header (for a linear buffer containing RPC headers
45 * and the data payload for short messages), and then an array of 40 * and the data payload for short messages), and then an array of
@@ -222,8 +217,10 @@ struct xdr_stream {
222/* 217/*
223 * These are the xdr_stream style generic XDR encode and decode functions. 218 * These are the xdr_stream style generic XDR encode and decode functions.
224 */ 219 */
225typedef void (*kxdreproc_t)(void *rqstp, struct xdr_stream *xdr, void *obj); 220typedef void (*kxdreproc_t)(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
226typedef int (*kxdrdproc_t)(void *rqstp, struct xdr_stream *xdr, void *obj); 221 const void *obj);
222typedef int (*kxdrdproc_t)(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
223 void *obj);
227 224
228extern void xdr_init_encode(struct xdr_stream *xdr, struct xdr_buf *buf, __be32 *p); 225extern void xdr_init_encode(struct xdr_stream *xdr, struct xdr_buf *buf, __be32 *p);
229extern __be32 *xdr_reserve_space(struct xdr_stream *xdr, size_t nbytes); 226extern __be32 *xdr_reserve_space(struct xdr_stream *xdr, size_t nbytes);
diff --git a/net/sunrpc/auth_gss/gss_rpc_upcall.c b/net/sunrpc/auth_gss/gss_rpc_upcall.c
index f0c6a8c78a56..46b295e4f2b8 100644
--- a/net/sunrpc/auth_gss/gss_rpc_upcall.c
+++ b/net/sunrpc/auth_gss/gss_rpc_upcall.c
@@ -55,15 +55,15 @@ enum {
55#define PROC(proc, name) \ 55#define PROC(proc, name) \
56[GSSX_##proc] = { \ 56[GSSX_##proc] = { \
57 .p_proc = GSSX_##proc, \ 57 .p_proc = GSSX_##proc, \
58 .p_encode = (kxdreproc_t)gssx_enc_##name, \ 58 .p_encode = gssx_enc_##name, \
59 .p_decode = (kxdrdproc_t)gssx_dec_##name, \ 59 .p_decode = gssx_dec_##name, \
60 .p_arglen = GSSX_ARG_##name##_sz, \ 60 .p_arglen = GSSX_ARG_##name##_sz, \
61 .p_replen = GSSX_RES_##name##_sz, \ 61 .p_replen = GSSX_RES_##name##_sz, \
62 .p_statidx = GSSX_##proc, \ 62 .p_statidx = GSSX_##proc, \
63 .p_name = #proc, \ 63 .p_name = #proc, \
64} 64}
65 65
66static struct rpc_procinfo gssp_procedures[] = { 66static const struct rpc_procinfo gssp_procedures[] = {
67 PROC(INDICATE_MECHS, indicate_mechs), 67 PROC(INDICATE_MECHS, indicate_mechs),
68 PROC(GET_CALL_CONTEXT, get_call_context), 68 PROC(GET_CALL_CONTEXT, get_call_context),
69 PROC(IMPORT_AND_CANON_NAME, import_and_canon_name), 69 PROC(IMPORT_AND_CANON_NAME, import_and_canon_name),
@@ -364,11 +364,12 @@ void gssp_free_upcall_data(struct gssp_upcall_data *data)
364/* 364/*
365 * Initialization stuff 365 * Initialization stuff
366 */ 366 */
367 367static unsigned int gssp_version1_counts[ARRAY_SIZE(gssp_procedures)];
368static const struct rpc_version gssp_version1 = { 368static const struct rpc_version gssp_version1 = {
369 .number = GSSPROXY_VERS_1, 369 .number = GSSPROXY_VERS_1,
370 .nrprocs = ARRAY_SIZE(gssp_procedures), 370 .nrprocs = ARRAY_SIZE(gssp_procedures),
371 .procs = gssp_procedures, 371 .procs = gssp_procedures,
372 .counts = gssp_version1_counts,
372}; 373};
373 374
374static const struct rpc_version *gssp_version[] = { 375static const struct rpc_version *gssp_version[] = {
diff --git a/net/sunrpc/auth_gss/gss_rpc_xdr.c b/net/sunrpc/auth_gss/gss_rpc_xdr.c
index 25d9a9cf7b66..c4778cae58ef 100644
--- a/net/sunrpc/auth_gss/gss_rpc_xdr.c
+++ b/net/sunrpc/auth_gss/gss_rpc_xdr.c
@@ -44,7 +44,7 @@ static int gssx_dec_bool(struct xdr_stream *xdr, u32 *v)
44} 44}
45 45
46static int gssx_enc_buffer(struct xdr_stream *xdr, 46static int gssx_enc_buffer(struct xdr_stream *xdr,
47 gssx_buffer *buf) 47 const gssx_buffer *buf)
48{ 48{
49 __be32 *p; 49 __be32 *p;
50 50
@@ -56,7 +56,7 @@ static int gssx_enc_buffer(struct xdr_stream *xdr,
56} 56}
57 57
58static int gssx_enc_in_token(struct xdr_stream *xdr, 58static int gssx_enc_in_token(struct xdr_stream *xdr,
59 struct gssp_in_token *in) 59 const struct gssp_in_token *in)
60{ 60{
61 __be32 *p; 61 __be32 *p;
62 62
@@ -130,7 +130,7 @@ static int gssx_dec_option(struct xdr_stream *xdr,
130} 130}
131 131
132static int dummy_enc_opt_array(struct xdr_stream *xdr, 132static int dummy_enc_opt_array(struct xdr_stream *xdr,
133 struct gssx_option_array *oa) 133 const struct gssx_option_array *oa)
134{ 134{
135 __be32 *p; 135 __be32 *p;
136 136
@@ -348,7 +348,7 @@ static int gssx_dec_status(struct xdr_stream *xdr,
348} 348}
349 349
350static int gssx_enc_call_ctx(struct xdr_stream *xdr, 350static int gssx_enc_call_ctx(struct xdr_stream *xdr,
351 struct gssx_call_ctx *ctx) 351 const struct gssx_call_ctx *ctx)
352{ 352{
353 struct gssx_option opt; 353 struct gssx_option opt;
354 __be32 *p; 354 __be32 *p;
@@ -733,8 +733,9 @@ static int gssx_enc_cb(struct xdr_stream *xdr, struct gssx_cb *cb)
733 733
734void gssx_enc_accept_sec_context(struct rpc_rqst *req, 734void gssx_enc_accept_sec_context(struct rpc_rqst *req,
735 struct xdr_stream *xdr, 735 struct xdr_stream *xdr,
736 struct gssx_arg_accept_sec_context *arg) 736 const void *data)
737{ 737{
738 const struct gssx_arg_accept_sec_context *arg = data;
738 int err; 739 int err;
739 740
740 err = gssx_enc_call_ctx(xdr, &arg->call_ctx); 741 err = gssx_enc_call_ctx(xdr, &arg->call_ctx);
@@ -789,8 +790,9 @@ done:
789 790
790int gssx_dec_accept_sec_context(struct rpc_rqst *rqstp, 791int gssx_dec_accept_sec_context(struct rpc_rqst *rqstp,
791 struct xdr_stream *xdr, 792 struct xdr_stream *xdr,
792 struct gssx_res_accept_sec_context *res) 793 void *data)
793{ 794{
795 struct gssx_res_accept_sec_context *res = data;
794 u32 value_follows; 796 u32 value_follows;
795 int err; 797 int err;
796 struct page *scratch; 798 struct page *scratch;
diff --git a/net/sunrpc/auth_gss/gss_rpc_xdr.h b/net/sunrpc/auth_gss/gss_rpc_xdr.h
index 9d88c6239f01..146c31032917 100644
--- a/net/sunrpc/auth_gss/gss_rpc_xdr.h
+++ b/net/sunrpc/auth_gss/gss_rpc_xdr.h
@@ -179,10 +179,10 @@ struct gssx_res_accept_sec_context {
179#define gssx_dec_init_sec_context NULL 179#define gssx_dec_init_sec_context NULL
180void gssx_enc_accept_sec_context(struct rpc_rqst *req, 180void gssx_enc_accept_sec_context(struct rpc_rqst *req,
181 struct xdr_stream *xdr, 181 struct xdr_stream *xdr,
182 struct gssx_arg_accept_sec_context *args); 182 const void *data);
183int gssx_dec_accept_sec_context(struct rpc_rqst *rqstp, 183int gssx_dec_accept_sec_context(struct rpc_rqst *rqstp,
184 struct xdr_stream *xdr, 184 struct xdr_stream *xdr,
185 struct gssx_res_accept_sec_context *res); 185 void *data);
186#define gssx_enc_release_handle NULL 186#define gssx_enc_release_handle NULL
187#define gssx_dec_release_handle NULL 187#define gssx_dec_release_handle NULL
188#define gssx_enc_get_mic NULL 188#define gssx_enc_get_mic NULL
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c
index a54a7a3d28f5..7b1ee5a0b03c 100644
--- a/net/sunrpc/auth_gss/svcauth_gss.c
+++ b/net/sunrpc/auth_gss/svcauth_gss.c
@@ -838,6 +838,14 @@ unwrap_integ_data(struct svc_rqst *rqstp, struct xdr_buf *buf, u32 seq, struct g
838 struct xdr_netobj mic; 838 struct xdr_netobj mic;
839 struct xdr_buf integ_buf; 839 struct xdr_buf integ_buf;
840 840
841 /* NFS READ normally uses splice to send data in-place. However
842 * the data in cache can change after the reply's MIC is computed
843 * but before the RPC reply is sent. To prevent the client from
844 * rejecting the server-computed MIC in this somewhat rare case,
845 * do not use splice with the GSS integrity service.
846 */
847 clear_bit(RQ_SPLICE_OK, &rqstp->rq_flags);
848
841 /* Did we already verify the signature on the original pass through? */ 849 /* Did we already verify the signature on the original pass through? */
842 if (rqstp->rq_deferred) 850 if (rqstp->rq_deferred)
843 return 0; 851 return 0;
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index b5cb921775a0..2e49d1f892b7 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -1517,14 +1517,16 @@ static void
1517call_start(struct rpc_task *task) 1517call_start(struct rpc_task *task)
1518{ 1518{
1519 struct rpc_clnt *clnt = task->tk_client; 1519 struct rpc_clnt *clnt = task->tk_client;
1520 int idx = task->tk_msg.rpc_proc->p_statidx;
1520 1521
1521 dprintk("RPC: %5u call_start %s%d proc %s (%s)\n", task->tk_pid, 1522 dprintk("RPC: %5u call_start %s%d proc %s (%s)\n", task->tk_pid,
1522 clnt->cl_program->name, clnt->cl_vers, 1523 clnt->cl_program->name, clnt->cl_vers,
1523 rpc_proc_name(task), 1524 rpc_proc_name(task),
1524 (RPC_IS_ASYNC(task) ? "async" : "sync")); 1525 (RPC_IS_ASYNC(task) ? "async" : "sync"));
1525 1526
1526 /* Increment call count */ 1527 /* Increment call count (version might not be valid for ping) */
1527 task->tk_msg.rpc_proc->p_count++; 1528 if (clnt->cl_program->version[clnt->cl_vers])
1529 clnt->cl_program->version[clnt->cl_vers]->counts[idx]++;
1528 clnt->cl_stats->rpccnt++; 1530 clnt->cl_stats->rpccnt++;
1529 task->tk_action = call_reserve; 1531 task->tk_action = call_reserve;
1530} 1532}
@@ -1672,7 +1674,7 @@ call_allocate(struct rpc_task *task)
1672 unsigned int slack = task->tk_rqstp->rq_cred->cr_auth->au_cslack; 1674 unsigned int slack = task->tk_rqstp->rq_cred->cr_auth->au_cslack;
1673 struct rpc_rqst *req = task->tk_rqstp; 1675 struct rpc_rqst *req = task->tk_rqstp;
1674 struct rpc_xprt *xprt = req->rq_xprt; 1676 struct rpc_xprt *xprt = req->rq_xprt;
1675 struct rpc_procinfo *proc = task->tk_msg.rpc_proc; 1677 const struct rpc_procinfo *proc = task->tk_msg.rpc_proc;
1676 int status; 1678 int status;
1677 1679
1678 dprint_status(task); 1680 dprint_status(task);
@@ -2476,16 +2478,18 @@ out_overflow:
2476 goto out_garbage; 2478 goto out_garbage;
2477} 2479}
2478 2480
2479static void rpcproc_encode_null(void *rqstp, struct xdr_stream *xdr, void *obj) 2481static void rpcproc_encode_null(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
2482 const void *obj)
2480{ 2483{
2481} 2484}
2482 2485
2483static int rpcproc_decode_null(void *rqstp, struct xdr_stream *xdr, void *obj) 2486static int rpcproc_decode_null(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
2487 void *obj)
2484{ 2488{
2485 return 0; 2489 return 0;
2486} 2490}
2487 2491
2488static struct rpc_procinfo rpcproc_null = { 2492static const struct rpc_procinfo rpcproc_null = {
2489 .p_encode = rpcproc_encode_null, 2493 .p_encode = rpcproc_encode_null,
2490 .p_decode = rpcproc_decode_null, 2494 .p_decode = rpcproc_decode_null,
2491}; 2495};
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c
index 5b30603596d0..ea0676f199c8 100644
--- a/net/sunrpc/rpcb_clnt.c
+++ b/net/sunrpc/rpcb_clnt.c
@@ -128,13 +128,13 @@ struct rpcbind_args {
128 int r_status; 128 int r_status;
129}; 129};
130 130
131static struct rpc_procinfo rpcb_procedures2[]; 131static const struct rpc_procinfo rpcb_procedures2[];
132static struct rpc_procinfo rpcb_procedures3[]; 132static const struct rpc_procinfo rpcb_procedures3[];
133static struct rpc_procinfo rpcb_procedures4[]; 133static const struct rpc_procinfo rpcb_procedures4[];
134 134
135struct rpcb_info { 135struct rpcb_info {
136 u32 rpc_vers; 136 u32 rpc_vers;
137 struct rpc_procinfo * rpc_proc; 137 const struct rpc_procinfo *rpc_proc;
138}; 138};
139 139
140static const struct rpcb_info rpcb_next_version[]; 140static const struct rpcb_info rpcb_next_version[];
@@ -620,7 +620,8 @@ int rpcb_v4_register(struct net *net, const u32 program, const u32 version,
620 return -EAFNOSUPPORT; 620 return -EAFNOSUPPORT;
621} 621}
622 622
623static struct rpc_task *rpcb_call_async(struct rpc_clnt *rpcb_clnt, struct rpcbind_args *map, struct rpc_procinfo *proc) 623static struct rpc_task *rpcb_call_async(struct rpc_clnt *rpcb_clnt,
624 struct rpcbind_args *map, const struct rpc_procinfo *proc)
624{ 625{
625 struct rpc_message msg = { 626 struct rpc_message msg = {
626 .rpc_proc = proc, 627 .rpc_proc = proc,
@@ -671,7 +672,7 @@ static struct rpc_clnt *rpcb_find_transport_owner(struct rpc_clnt *clnt)
671void rpcb_getport_async(struct rpc_task *task) 672void rpcb_getport_async(struct rpc_task *task)
672{ 673{
673 struct rpc_clnt *clnt; 674 struct rpc_clnt *clnt;
674 struct rpc_procinfo *proc; 675 const struct rpc_procinfo *proc;
675 u32 bind_version; 676 u32 bind_version;
676 struct rpc_xprt *xprt; 677 struct rpc_xprt *xprt;
677 struct rpc_clnt *rpcb_clnt; 678 struct rpc_clnt *rpcb_clnt;
@@ -843,8 +844,9 @@ static void rpcb_getport_done(struct rpc_task *child, void *data)
843 */ 844 */
844 845
845static void rpcb_enc_mapping(struct rpc_rqst *req, struct xdr_stream *xdr, 846static void rpcb_enc_mapping(struct rpc_rqst *req, struct xdr_stream *xdr,
846 const struct rpcbind_args *rpcb) 847 const void *data)
847{ 848{
849 const struct rpcbind_args *rpcb = data;
848 __be32 *p; 850 __be32 *p;
849 851
850 dprintk("RPC: %5u encoding PMAP_%s call (%u, %u, %d, %u)\n", 852 dprintk("RPC: %5u encoding PMAP_%s call (%u, %u, %d, %u)\n",
@@ -860,8 +862,9 @@ static void rpcb_enc_mapping(struct rpc_rqst *req, struct xdr_stream *xdr,
860} 862}
861 863
862static int rpcb_dec_getport(struct rpc_rqst *req, struct xdr_stream *xdr, 864static int rpcb_dec_getport(struct rpc_rqst *req, struct xdr_stream *xdr,
863 struct rpcbind_args *rpcb) 865 void *data)
864{ 866{
867 struct rpcbind_args *rpcb = data;
865 unsigned long port; 868 unsigned long port;
866 __be32 *p; 869 __be32 *p;
867 870
@@ -882,8 +885,9 @@ static int rpcb_dec_getport(struct rpc_rqst *req, struct xdr_stream *xdr,
882} 885}
883 886
884static int rpcb_dec_set(struct rpc_rqst *req, struct xdr_stream *xdr, 887static int rpcb_dec_set(struct rpc_rqst *req, struct xdr_stream *xdr,
885 unsigned int *boolp) 888 void *data)
886{ 889{
890 unsigned int *boolp = data;
887 __be32 *p; 891 __be32 *p;
888 892
889 p = xdr_inline_decode(xdr, 4); 893 p = xdr_inline_decode(xdr, 4);
@@ -917,8 +921,9 @@ static void encode_rpcb_string(struct xdr_stream *xdr, const char *string,
917} 921}
918 922
919static void rpcb_enc_getaddr(struct rpc_rqst *req, struct xdr_stream *xdr, 923static void rpcb_enc_getaddr(struct rpc_rqst *req, struct xdr_stream *xdr,
920 const struct rpcbind_args *rpcb) 924 const void *data)
921{ 925{
926 const struct rpcbind_args *rpcb = data;
922 __be32 *p; 927 __be32 *p;
923 928
924 dprintk("RPC: %5u encoding RPCB_%s call (%u, %u, '%s', '%s')\n", 929 dprintk("RPC: %5u encoding RPCB_%s call (%u, %u, '%s', '%s')\n",
@@ -937,8 +942,9 @@ static void rpcb_enc_getaddr(struct rpc_rqst *req, struct xdr_stream *xdr,
937} 942}
938 943
939static int rpcb_dec_getaddr(struct rpc_rqst *req, struct xdr_stream *xdr, 944static int rpcb_dec_getaddr(struct rpc_rqst *req, struct xdr_stream *xdr,
940 struct rpcbind_args *rpcb) 945 void *data)
941{ 946{
947 struct rpcbind_args *rpcb = data;
942 struct sockaddr_storage address; 948 struct sockaddr_storage address;
943 struct sockaddr *sap = (struct sockaddr *)&address; 949 struct sockaddr *sap = (struct sockaddr *)&address;
944 __be32 *p; 950 __be32 *p;
@@ -989,11 +995,11 @@ out_fail:
989 * since the Linux kernel RPC code requires only these. 995 * since the Linux kernel RPC code requires only these.
990 */ 996 */
991 997
992static struct rpc_procinfo rpcb_procedures2[] = { 998static const struct rpc_procinfo rpcb_procedures2[] = {
993 [RPCBPROC_SET] = { 999 [RPCBPROC_SET] = {
994 .p_proc = RPCBPROC_SET, 1000 .p_proc = RPCBPROC_SET,
995 .p_encode = (kxdreproc_t)rpcb_enc_mapping, 1001 .p_encode = rpcb_enc_mapping,
996 .p_decode = (kxdrdproc_t)rpcb_dec_set, 1002 .p_decode = rpcb_dec_set,
997 .p_arglen = RPCB_mappingargs_sz, 1003 .p_arglen = RPCB_mappingargs_sz,
998 .p_replen = RPCB_setres_sz, 1004 .p_replen = RPCB_setres_sz,
999 .p_statidx = RPCBPROC_SET, 1005 .p_statidx = RPCBPROC_SET,
@@ -1002,8 +1008,8 @@ static struct rpc_procinfo rpcb_procedures2[] = {
1002 }, 1008 },
1003 [RPCBPROC_UNSET] = { 1009 [RPCBPROC_UNSET] = {
1004 .p_proc = RPCBPROC_UNSET, 1010 .p_proc = RPCBPROC_UNSET,
1005 .p_encode = (kxdreproc_t)rpcb_enc_mapping, 1011 .p_encode = rpcb_enc_mapping,
1006 .p_decode = (kxdrdproc_t)rpcb_dec_set, 1012 .p_decode = rpcb_dec_set,
1007 .p_arglen = RPCB_mappingargs_sz, 1013 .p_arglen = RPCB_mappingargs_sz,
1008 .p_replen = RPCB_setres_sz, 1014 .p_replen = RPCB_setres_sz,
1009 .p_statidx = RPCBPROC_UNSET, 1015 .p_statidx = RPCBPROC_UNSET,
@@ -1012,8 +1018,8 @@ static struct rpc_procinfo rpcb_procedures2[] = {
1012 }, 1018 },
1013 [RPCBPROC_GETPORT] = { 1019 [RPCBPROC_GETPORT] = {
1014 .p_proc = RPCBPROC_GETPORT, 1020 .p_proc = RPCBPROC_GETPORT,
1015 .p_encode = (kxdreproc_t)rpcb_enc_mapping, 1021 .p_encode = rpcb_enc_mapping,
1016 .p_decode = (kxdrdproc_t)rpcb_dec_getport, 1022 .p_decode = rpcb_dec_getport,
1017 .p_arglen = RPCB_mappingargs_sz, 1023 .p_arglen = RPCB_mappingargs_sz,
1018 .p_replen = RPCB_getportres_sz, 1024 .p_replen = RPCB_getportres_sz,
1019 .p_statidx = RPCBPROC_GETPORT, 1025 .p_statidx = RPCBPROC_GETPORT,
@@ -1022,11 +1028,11 @@ static struct rpc_procinfo rpcb_procedures2[] = {
1022 }, 1028 },
1023}; 1029};
1024 1030
1025static struct rpc_procinfo rpcb_procedures3[] = { 1031static const struct rpc_procinfo rpcb_procedures3[] = {
1026 [RPCBPROC_SET] = { 1032 [RPCBPROC_SET] = {
1027 .p_proc = RPCBPROC_SET, 1033 .p_proc = RPCBPROC_SET,
1028 .p_encode = (kxdreproc_t)rpcb_enc_getaddr, 1034 .p_encode = rpcb_enc_getaddr,
1029 .p_decode = (kxdrdproc_t)rpcb_dec_set, 1035 .p_decode = rpcb_dec_set,
1030 .p_arglen = RPCB_getaddrargs_sz, 1036 .p_arglen = RPCB_getaddrargs_sz,
1031 .p_replen = RPCB_setres_sz, 1037 .p_replen = RPCB_setres_sz,
1032 .p_statidx = RPCBPROC_SET, 1038 .p_statidx = RPCBPROC_SET,
@@ -1035,8 +1041,8 @@ static struct rpc_procinfo rpcb_procedures3[] = {
1035 }, 1041 },
1036 [RPCBPROC_UNSET] = { 1042 [RPCBPROC_UNSET] = {
1037 .p_proc = RPCBPROC_UNSET, 1043 .p_proc = RPCBPROC_UNSET,
1038 .p_encode = (kxdreproc_t)rpcb_enc_getaddr, 1044 .p_encode = rpcb_enc_getaddr,
1039 .p_decode = (kxdrdproc_t)rpcb_dec_set, 1045 .p_decode = rpcb_dec_set,
1040 .p_arglen = RPCB_getaddrargs_sz, 1046 .p_arglen = RPCB_getaddrargs_sz,
1041 .p_replen = RPCB_setres_sz, 1047 .p_replen = RPCB_setres_sz,
1042 .p_statidx = RPCBPROC_UNSET, 1048 .p_statidx = RPCBPROC_UNSET,
@@ -1045,8 +1051,8 @@ static struct rpc_procinfo rpcb_procedures3[] = {
1045 }, 1051 },
1046 [RPCBPROC_GETADDR] = { 1052 [RPCBPROC_GETADDR] = {
1047 .p_proc = RPCBPROC_GETADDR, 1053 .p_proc = RPCBPROC_GETADDR,
1048 .p_encode = (kxdreproc_t)rpcb_enc_getaddr, 1054 .p_encode = rpcb_enc_getaddr,
1049 .p_decode = (kxdrdproc_t)rpcb_dec_getaddr, 1055 .p_decode = rpcb_dec_getaddr,
1050 .p_arglen = RPCB_getaddrargs_sz, 1056 .p_arglen = RPCB_getaddrargs_sz,
1051 .p_replen = RPCB_getaddrres_sz, 1057 .p_replen = RPCB_getaddrres_sz,
1052 .p_statidx = RPCBPROC_GETADDR, 1058 .p_statidx = RPCBPROC_GETADDR,
@@ -1055,11 +1061,11 @@ static struct rpc_procinfo rpcb_procedures3[] = {
1055 }, 1061 },
1056}; 1062};
1057 1063
1058static struct rpc_procinfo rpcb_procedures4[] = { 1064static const struct rpc_procinfo rpcb_procedures4[] = {
1059 [RPCBPROC_SET] = { 1065 [RPCBPROC_SET] = {
1060 .p_proc = RPCBPROC_SET, 1066 .p_proc = RPCBPROC_SET,
1061 .p_encode = (kxdreproc_t)rpcb_enc_getaddr, 1067 .p_encode = rpcb_enc_getaddr,
1062 .p_decode = (kxdrdproc_t)rpcb_dec_set, 1068 .p_decode = rpcb_dec_set,
1063 .p_arglen = RPCB_getaddrargs_sz, 1069 .p_arglen = RPCB_getaddrargs_sz,
1064 .p_replen = RPCB_setres_sz, 1070 .p_replen = RPCB_setres_sz,
1065 .p_statidx = RPCBPROC_SET, 1071 .p_statidx = RPCBPROC_SET,
@@ -1068,8 +1074,8 @@ static struct rpc_procinfo rpcb_procedures4[] = {
1068 }, 1074 },
1069 [RPCBPROC_UNSET] = { 1075 [RPCBPROC_UNSET] = {
1070 .p_proc = RPCBPROC_UNSET, 1076 .p_proc = RPCBPROC_UNSET,
1071 .p_encode = (kxdreproc_t)rpcb_enc_getaddr, 1077 .p_encode = rpcb_enc_getaddr,
1072 .p_decode = (kxdrdproc_t)rpcb_dec_set, 1078 .p_decode = rpcb_dec_set,
1073 .p_arglen = RPCB_getaddrargs_sz, 1079 .p_arglen = RPCB_getaddrargs_sz,
1074 .p_replen = RPCB_setres_sz, 1080 .p_replen = RPCB_setres_sz,
1075 .p_statidx = RPCBPROC_UNSET, 1081 .p_statidx = RPCBPROC_UNSET,
@@ -1078,8 +1084,8 @@ static struct rpc_procinfo rpcb_procedures4[] = {
1078 }, 1084 },
1079 [RPCBPROC_GETADDR] = { 1085 [RPCBPROC_GETADDR] = {
1080 .p_proc = RPCBPROC_GETADDR, 1086 .p_proc = RPCBPROC_GETADDR,
1081 .p_encode = (kxdreproc_t)rpcb_enc_getaddr, 1087 .p_encode = rpcb_enc_getaddr,
1082 .p_decode = (kxdrdproc_t)rpcb_dec_getaddr, 1088 .p_decode = rpcb_dec_getaddr,
1083 .p_arglen = RPCB_getaddrargs_sz, 1089 .p_arglen = RPCB_getaddrargs_sz,
1084 .p_replen = RPCB_getaddrres_sz, 1090 .p_replen = RPCB_getaddrres_sz,
1085 .p_statidx = RPCBPROC_GETADDR, 1091 .p_statidx = RPCBPROC_GETADDR,
@@ -1112,22 +1118,28 @@ static const struct rpcb_info rpcb_next_version6[] = {
1112 }, 1118 },
1113}; 1119};
1114 1120
1121static unsigned int rpcb_version2_counts[ARRAY_SIZE(rpcb_procedures2)];
1115static const struct rpc_version rpcb_version2 = { 1122static const struct rpc_version rpcb_version2 = {
1116 .number = RPCBVERS_2, 1123 .number = RPCBVERS_2,
1117 .nrprocs = ARRAY_SIZE(rpcb_procedures2), 1124 .nrprocs = ARRAY_SIZE(rpcb_procedures2),
1118 .procs = rpcb_procedures2 1125 .procs = rpcb_procedures2,
1126 .counts = rpcb_version2_counts,
1119}; 1127};
1120 1128
1129static unsigned int rpcb_version3_counts[ARRAY_SIZE(rpcb_procedures3)];
1121static const struct rpc_version rpcb_version3 = { 1130static const struct rpc_version rpcb_version3 = {
1122 .number = RPCBVERS_3, 1131 .number = RPCBVERS_3,
1123 .nrprocs = ARRAY_SIZE(rpcb_procedures3), 1132 .nrprocs = ARRAY_SIZE(rpcb_procedures3),
1124 .procs = rpcb_procedures3 1133 .procs = rpcb_procedures3,
1134 .counts = rpcb_version3_counts,
1125}; 1135};
1126 1136
1137static unsigned int rpcb_version4_counts[ARRAY_SIZE(rpcb_procedures4)];
1127static const struct rpc_version rpcb_version4 = { 1138static const struct rpc_version rpcb_version4 = {
1128 .number = RPCBVERS_4, 1139 .number = RPCBVERS_4,
1129 .nrprocs = ARRAY_SIZE(rpcb_procedures4), 1140 .nrprocs = ARRAY_SIZE(rpcb_procedures4),
1130 .procs = rpcb_procedures4 1141 .procs = rpcb_procedures4,
1142 .counts = rpcb_version4_counts,
1131}; 1143};
1132 1144
1133static const struct rpc_version *rpcb_version[] = { 1145static const struct rpc_version *rpcb_version[] = {
diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c
index caeb01ad2b5a..1e671333c3d5 100644
--- a/net/sunrpc/stats.c
+++ b/net/sunrpc/stats.c
@@ -55,8 +55,7 @@ static int rpc_proc_show(struct seq_file *seq, void *v) {
55 seq_printf(seq, "proc%u %u", 55 seq_printf(seq, "proc%u %u",
56 vers->number, vers->nrprocs); 56 vers->number, vers->nrprocs);
57 for (j = 0; j < vers->nrprocs; j++) 57 for (j = 0; j < vers->nrprocs; j++)
58 seq_printf(seq, " %u", 58 seq_printf(seq, " %u", vers->counts[j]);
59 vers->procs[j].p_count);
60 seq_putc(seq, '\n'); 59 seq_putc(seq, '\n');
61 } 60 }
62 return 0; 61 return 0;
@@ -78,9 +77,9 @@ static const struct file_operations rpc_proc_fops = {
78/* 77/*
79 * Get RPC server stats 78 * Get RPC server stats
80 */ 79 */
81void svc_seq_show(struct seq_file *seq, const struct svc_stat *statp) { 80void svc_seq_show(struct seq_file *seq, const struct svc_stat *statp)
81{
82 const struct svc_program *prog = statp->program; 82 const struct svc_program *prog = statp->program;
83 const struct svc_procedure *proc;
84 const struct svc_version *vers; 83 const struct svc_version *vers;
85 unsigned int i, j; 84 unsigned int i, j;
86 85
@@ -99,11 +98,12 @@ void svc_seq_show(struct seq_file *seq, const struct svc_stat *statp) {
99 statp->rpcbadclnt); 98 statp->rpcbadclnt);
100 99
101 for (i = 0; i < prog->pg_nvers; i++) { 100 for (i = 0; i < prog->pg_nvers; i++) {
102 if (!(vers = prog->pg_vers[i]) || !(proc = vers->vs_proc)) 101 vers = prog->pg_vers[i];
102 if (!vers)
103 continue; 103 continue;
104 seq_printf(seq, "proc%d %u", i, vers->vs_nproc); 104 seq_printf(seq, "proc%d %u", i, vers->vs_nproc);
105 for (j = 0; j < vers->vs_nproc; j++, proc++) 105 for (j = 0; j < vers->vs_nproc; j++)
106 seq_printf(seq, " %u", proc->pc_count); 106 seq_printf(seq, " %u", vers->vs_count[j]);
107 seq_putc(seq, '\n'); 107 seq_putc(seq, '\n');
108 } 108 }
109} 109}
@@ -192,7 +192,7 @@ void rpc_count_iostats(const struct rpc_task *task, struct rpc_iostats *stats)
192EXPORT_SYMBOL_GPL(rpc_count_iostats); 192EXPORT_SYMBOL_GPL(rpc_count_iostats);
193 193
194static void _print_name(struct seq_file *seq, unsigned int op, 194static void _print_name(struct seq_file *seq, unsigned int op,
195 struct rpc_procinfo *procs) 195 const struct rpc_procinfo *procs)
196{ 196{
197 if (procs[op].p_name) 197 if (procs[op].p_name)
198 seq_printf(seq, "\t%12s: ", procs[op].p_name); 198 seq_printf(seq, "\t%12s: ", procs[op].p_name);
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index bc0f5a0ecbdc..85ce0db5b0a6 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -1008,7 +1008,7 @@ int svc_register(const struct svc_serv *serv, struct net *net,
1008 const unsigned short port) 1008 const unsigned short port)
1009{ 1009{
1010 struct svc_program *progp; 1010 struct svc_program *progp;
1011 struct svc_version *vers; 1011 const struct svc_version *vers;
1012 unsigned int i; 1012 unsigned int i;
1013 int error = 0; 1013 int error = 0;
1014 1014
@@ -1151,10 +1151,9 @@ static int
1151svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv) 1151svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv)
1152{ 1152{
1153 struct svc_program *progp; 1153 struct svc_program *progp;
1154 struct svc_version *versp = NULL; /* compiler food */ 1154 const struct svc_version *versp = NULL; /* compiler food */
1155 struct svc_procedure *procp = NULL; 1155 const struct svc_procedure *procp = NULL;
1156 struct svc_serv *serv = rqstp->rq_server; 1156 struct svc_serv *serv = rqstp->rq_server;
1157 kxdrproc_t xdr;
1158 __be32 *statp; 1157 __be32 *statp;
1159 u32 prog, vers, proc; 1158 u32 prog, vers, proc;
1160 __be32 auth_stat, rpc_stat; 1159 __be32 auth_stat, rpc_stat;
@@ -1166,7 +1165,7 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv)
1166 if (argv->iov_len < 6*4) 1165 if (argv->iov_len < 6*4)
1167 goto err_short_len; 1166 goto err_short_len;
1168 1167
1169 /* Will be turned off only in gss privacy case: */ 1168 /* Will be turned off by GSS integrity and privacy services */
1170 set_bit(RQ_SPLICE_OK, &rqstp->rq_flags); 1169 set_bit(RQ_SPLICE_OK, &rqstp->rq_flags);
1171 /* Will be turned off only when NFSv4 Sessions are used */ 1170 /* Will be turned off only when NFSv4 Sessions are used */
1172 set_bit(RQ_USEDEFERRAL, &rqstp->rq_flags); 1171 set_bit(RQ_USEDEFERRAL, &rqstp->rq_flags);
@@ -1262,7 +1261,7 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv)
1262 svc_putnl(resv, RPC_SUCCESS); 1261 svc_putnl(resv, RPC_SUCCESS);
1263 1262
1264 /* Bump per-procedure stats counter */ 1263 /* Bump per-procedure stats counter */
1265 procp->pc_count++; 1264 versp->vs_count[proc]++;
1266 1265
1267 /* Initialize storage for argp and resp */ 1266 /* Initialize storage for argp and resp */
1268 memset(rqstp->rq_argp, 0, procp->pc_argsize); 1267 memset(rqstp->rq_argp, 0, procp->pc_argsize);
@@ -1276,28 +1275,30 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv)
1276 1275
1277 /* Call the function that processes the request. */ 1276 /* Call the function that processes the request. */
1278 if (!versp->vs_dispatch) { 1277 if (!versp->vs_dispatch) {
1279 /* Decode arguments */ 1278 /*
1280 xdr = procp->pc_decode; 1279 * Decode arguments
1281 if (xdr && !xdr(rqstp, argv->iov_base, rqstp->rq_argp)) 1280 * XXX: why do we ignore the return value?
1281 */
1282 if (procp->pc_decode &&
1283 !procp->pc_decode(rqstp, argv->iov_base))
1282 goto err_garbage; 1284 goto err_garbage;
1283 1285
1284 *statp = procp->pc_func(rqstp, rqstp->rq_argp, rqstp->rq_resp); 1286 *statp = procp->pc_func(rqstp);
1285 1287
1286 /* Encode reply */ 1288 /* Encode reply */
1287 if (*statp == rpc_drop_reply || 1289 if (*statp == rpc_drop_reply ||
1288 test_bit(RQ_DROPME, &rqstp->rq_flags)) { 1290 test_bit(RQ_DROPME, &rqstp->rq_flags)) {
1289 if (procp->pc_release) 1291 if (procp->pc_release)
1290 procp->pc_release(rqstp, NULL, rqstp->rq_resp); 1292 procp->pc_release(rqstp);
1291 goto dropit; 1293 goto dropit;
1292 } 1294 }
1293 if (*statp == rpc_autherr_badcred) { 1295 if (*statp == rpc_autherr_badcred) {
1294 if (procp->pc_release) 1296 if (procp->pc_release)
1295 procp->pc_release(rqstp, NULL, rqstp->rq_resp); 1297 procp->pc_release(rqstp);
1296 goto err_bad_auth; 1298 goto err_bad_auth;
1297 } 1299 }
1298 if (*statp == rpc_success && 1300 if (*statp == rpc_success && procp->pc_encode &&
1299 (xdr = procp->pc_encode) && 1301 !procp->pc_encode(rqstp, resv->iov_base + resv->iov_len)) {
1300 !xdr(rqstp, resv->iov_base+resv->iov_len, rqstp->rq_resp)) {
1301 dprintk("svc: failed to encode reply\n"); 1302 dprintk("svc: failed to encode reply\n");
1302 /* serv->sv_stats->rpcsystemerr++; */ 1303 /* serv->sv_stats->rpcsystemerr++; */
1303 *statp = rpc_system_err; 1304 *statp = rpc_system_err;
@@ -1307,7 +1308,7 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv)
1307 if (!versp->vs_dispatch(rqstp, statp)) { 1308 if (!versp->vs_dispatch(rqstp, statp)) {
1308 /* Release reply info */ 1309 /* Release reply info */
1309 if (procp->pc_release) 1310 if (procp->pc_release)
1310 procp->pc_release(rqstp, NULL, rqstp->rq_resp); 1311 procp->pc_release(rqstp);
1311 goto dropit; 1312 goto dropit;
1312 } 1313 }
1313 } 1314 }
@@ -1318,7 +1319,7 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv)
1318 1319
1319 /* Release reply info */ 1320 /* Release reply info */
1320 if (procp->pc_release) 1321 if (procp->pc_release)
1321 procp->pc_release(rqstp, NULL, rqstp->rq_resp); 1322 procp->pc_release(rqstp);
1322 1323
1323 if (procp->pc_encode == NULL) 1324 if (procp->pc_encode == NULL)
1324 goto dropit; 1325 goto dropit;
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
index 7bfe1fb42add..d16a8b423c20 100644
--- a/net/sunrpc/svc_xprt.c
+++ b/net/sunrpc/svc_xprt.c
@@ -659,11 +659,13 @@ static int svc_alloc_arg(struct svc_rqst *rqstp)
659 int i; 659 int i;
660 660
661 /* now allocate needed pages. If we get a failure, sleep briefly */ 661 /* now allocate needed pages. If we get a failure, sleep briefly */
662 pages = (serv->sv_max_mesg + PAGE_SIZE) / PAGE_SIZE; 662 pages = (serv->sv_max_mesg + 2 * PAGE_SIZE) >> PAGE_SHIFT;
663 WARN_ON_ONCE(pages >= RPCSVC_MAXPAGES); 663 if (pages > RPCSVC_MAXPAGES) {
664 if (pages >= RPCSVC_MAXPAGES) 664 pr_warn_once("svc: warning: pages=%u > RPCSVC_MAXPAGES=%lu\n",
665 pages, RPCSVC_MAXPAGES);
665 /* use as many pages as possible */ 666 /* use as many pages as possible */
666 pages = RPCSVC_MAXPAGES - 1; 667 pages = RPCSVC_MAXPAGES;
668 }
667 for (i = 0; i < pages ; i++) 669 for (i = 0; i < pages ; i++)
668 while (rqstp->rq_pages[i] == NULL) { 670 while (rqstp->rq_pages[i] == NULL) {
669 struct page *p = alloc_page(GFP_KERNEL); 671 struct page *p = alloc_page(GFP_KERNEL);
diff --git a/net/sunrpc/xprtrdma/Makefile b/net/sunrpc/xprtrdma/Makefile
index c1ae8142ab73..b8213ddce2f2 100644
--- a/net/sunrpc/xprtrdma/Makefile
+++ b/net/sunrpc/xprtrdma/Makefile
@@ -3,6 +3,6 @@ obj-$(CONFIG_SUNRPC_XPRT_RDMA) += rpcrdma.o
3rpcrdma-y := transport.o rpc_rdma.o verbs.o \ 3rpcrdma-y := transport.o rpc_rdma.o verbs.o \
4 fmr_ops.o frwr_ops.o \ 4 fmr_ops.o frwr_ops.o \
5 svc_rdma.o svc_rdma_backchannel.o svc_rdma_transport.o \ 5 svc_rdma.o svc_rdma_backchannel.o svc_rdma_transport.o \
6 svc_rdma_marshal.o svc_rdma_sendto.o svc_rdma_recvfrom.o \ 6 svc_rdma_sendto.o svc_rdma_recvfrom.o svc_rdma_rw.o \
7 svc_rdma_rw.o module.o 7 module.o
8rpcrdma-$(CONFIG_SUNRPC_BACKCHANNEL) += backchannel.o 8rpcrdma-$(CONFIG_SUNRPC_BACKCHANNEL) += backchannel.o
diff --git a/net/sunrpc/xprtrdma/svc_rdma_marshal.c b/net/sunrpc/xprtrdma/svc_rdma_marshal.c
deleted file mode 100644
index bdcf7d85a3dc..000000000000
--- a/net/sunrpc/xprtrdma/svc_rdma_marshal.c
+++ /dev/null
@@ -1,168 +0,0 @@
1/*
2 * Copyright (c) 2016 Oracle. All rights reserved.
3 * Copyright (c) 2005-2006 Network Appliance, Inc. All rights reserved.
4 *
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the BSD-type
9 * license below:
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 *
15 * Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 *
18 * Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials provided
21 * with the distribution.
22 *
23 * Neither the name of the Network Appliance, Inc. nor the names of
24 * its contributors may be used to endorse or promote products
25 * derived from this software without specific prior written
26 * permission.
27 *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 *
40 * Author: Tom Tucker <tom@opengridcomputing.com>
41 */
42
43#include <linux/sunrpc/xdr.h>
44#include <linux/sunrpc/debug.h>
45#include <asm/unaligned.h>
46#include <linux/sunrpc/rpc_rdma.h>
47#include <linux/sunrpc/svc_rdma.h>
48
49#define RPCDBG_FACILITY RPCDBG_SVCXPRT
50
51static __be32 *xdr_check_read_list(__be32 *p, __be32 *end)
52{
53 __be32 *next;
54
55 while (*p++ != xdr_zero) {
56 next = p + rpcrdma_readchunk_maxsz - 1;
57 if (next > end)
58 return NULL;
59 p = next;
60 }
61 return p;
62}
63
64static __be32 *xdr_check_write_list(__be32 *p, __be32 *end)
65{
66 __be32 *next;
67
68 while (*p++ != xdr_zero) {
69 next = p + 1 + be32_to_cpup(p) * rpcrdma_segment_maxsz;
70 if (next > end)
71 return NULL;
72 p = next;
73 }
74 return p;
75}
76
77static __be32 *xdr_check_reply_chunk(__be32 *p, __be32 *end)
78{
79 __be32 *next;
80
81 if (*p++ != xdr_zero) {
82 next = p + 1 + be32_to_cpup(p) * rpcrdma_segment_maxsz;
83 if (next > end)
84 return NULL;
85 p = next;
86 }
87 return p;
88}
89
90/**
91 * svc_rdma_xdr_decode_req - Parse incoming RPC-over-RDMA header
92 * @rq_arg: Receive buffer
93 *
94 * On entry, xdr->head[0].iov_base points to first byte in the
95 * RPC-over-RDMA header.
96 *
97 * On successful exit, head[0] points to first byte past the
98 * RPC-over-RDMA header. For RDMA_MSG, this is the RPC message.
99 * The length of the RPC-over-RDMA header is returned.
100 */
101int svc_rdma_xdr_decode_req(struct xdr_buf *rq_arg)
102{
103 __be32 *p, *end, *rdma_argp;
104 unsigned int hdr_len;
105
106 /* Verify that there's enough bytes for header + something */
107 if (rq_arg->len <= RPCRDMA_HDRLEN_ERR)
108 goto out_short;
109
110 rdma_argp = rq_arg->head[0].iov_base;
111 if (*(rdma_argp + 1) != rpcrdma_version)
112 goto out_version;
113
114 switch (*(rdma_argp + 3)) {
115 case rdma_msg:
116 case rdma_nomsg:
117 break;
118
119 case rdma_done:
120 goto out_drop;
121
122 case rdma_error:
123 goto out_drop;
124
125 default:
126 goto out_proc;
127 }
128
129 end = (__be32 *)((unsigned long)rdma_argp + rq_arg->len);
130 p = xdr_check_read_list(rdma_argp + 4, end);
131 if (!p)
132 goto out_inval;
133 p = xdr_check_write_list(p, end);
134 if (!p)
135 goto out_inval;
136 p = xdr_check_reply_chunk(p, end);
137 if (!p)
138 goto out_inval;
139 if (p > end)
140 goto out_inval;
141
142 rq_arg->head[0].iov_base = p;
143 hdr_len = (unsigned long)p - (unsigned long)rdma_argp;
144 rq_arg->head[0].iov_len -= hdr_len;
145 return hdr_len;
146
147out_short:
148 dprintk("svcrdma: header too short = %d\n", rq_arg->len);
149 return -EINVAL;
150
151out_version:
152 dprintk("svcrdma: bad xprt version: %u\n",
153 be32_to_cpup(rdma_argp + 1));
154 return -EPROTONOSUPPORT;
155
156out_drop:
157 dprintk("svcrdma: dropping RDMA_DONE/ERROR message\n");
158 return 0;
159
160out_proc:
161 dprintk("svcrdma: bad rdma procedure (%u)\n",
162 be32_to_cpup(rdma_argp + 3));
163 return -EINVAL;
164
165out_inval:
166 dprintk("svcrdma: failed to parse transport header\n");
167 return -EINVAL;
168}
diff --git a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
index 27a99bf5b1a6..ad4bd62eebf1 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
@@ -1,4 +1,5 @@
1/* 1/*
2 * Copyright (c) 2016, 2017 Oracle. All rights reserved.
2 * Copyright (c) 2014 Open Grid Computing, Inc. All rights reserved. 3 * Copyright (c) 2014 Open Grid Computing, Inc. All rights reserved.
3 * Copyright (c) 2005-2006 Network Appliance, Inc. All rights reserved. 4 * Copyright (c) 2005-2006 Network Appliance, Inc. All rights reserved.
4 * 5 *
@@ -40,12 +41,66 @@
40 * Author: Tom Tucker <tom@opengridcomputing.com> 41 * Author: Tom Tucker <tom@opengridcomputing.com>
41 */ 42 */
42 43
43#include <linux/sunrpc/debug.h> 44/* Operation
44#include <linux/sunrpc/rpc_rdma.h> 45 *
45#include <linux/spinlock.h> 46 * The main entry point is svc_rdma_recvfrom. This is called from
47 * svc_recv when the transport indicates there is incoming data to
48 * be read. "Data Ready" is signaled when an RDMA Receive completes,
49 * or when a set of RDMA Reads complete.
50 *
51 * An svc_rqst is passed in. This structure contains an array of
52 * free pages (rq_pages) that will contain the incoming RPC message.
53 *
54 * Short messages are moved directly into svc_rqst::rq_arg, and
55 * the RPC Call is ready to be processed by the Upper Layer.
56 * svc_rdma_recvfrom returns the length of the RPC Call message,
57 * completing the reception of the RPC Call.
58 *
59 * However, when an incoming message has Read chunks,
60 * svc_rdma_recvfrom must post RDMA Reads to pull the RPC Call's
61 * data payload from the client. svc_rdma_recvfrom sets up the
62 * RDMA Reads using pages in svc_rqst::rq_pages, which are
63 * transferred to an svc_rdma_op_ctxt for the duration of the
64 * I/O. svc_rdma_recvfrom then returns zero, since the RPC message
65 * is still not yet ready.
66 *
67 * When the Read chunk payloads have become available on the
68 * server, "Data Ready" is raised again, and svc_recv calls
69 * svc_rdma_recvfrom again. This second call may use a different
70 * svc_rqst than the first one, thus any information that needs
71 * to be preserved across these two calls is kept in an
72 * svc_rdma_op_ctxt.
73 *
74 * The second call to svc_rdma_recvfrom performs final assembly
75 * of the RPC Call message, using the RDMA Read sink pages kept in
76 * the svc_rdma_op_ctxt. The xdr_buf is copied from the
77 * svc_rdma_op_ctxt to the second svc_rqst. The second call returns
78 * the length of the completed RPC Call message.
79 *
80 * Page Management
81 *
82 * Pages under I/O must be transferred from the first svc_rqst to an
83 * svc_rdma_op_ctxt before the first svc_rdma_recvfrom call returns.
84 *
85 * The first svc_rqst supplies pages for RDMA Reads. These are moved
86 * from rqstp::rq_pages into ctxt::pages. The consumed elements of
87 * the rq_pages array are set to NULL and refilled with the first
88 * svc_rdma_recvfrom call returns.
89 *
90 * During the second svc_rdma_recvfrom call, RDMA Read sink pages
91 * are transferred from the svc_rdma_op_ctxt to the second svc_rqst
92 * (see rdma_read_complete() below).
93 */
94
46#include <asm/unaligned.h> 95#include <asm/unaligned.h>
47#include <rdma/ib_verbs.h> 96#include <rdma/ib_verbs.h>
48#include <rdma/rdma_cm.h> 97#include <rdma/rdma_cm.h>
98
99#include <linux/spinlock.h>
100
101#include <linux/sunrpc/xdr.h>
102#include <linux/sunrpc/debug.h>
103#include <linux/sunrpc/rpc_rdma.h>
49#include <linux/sunrpc/svc_rdma.h> 104#include <linux/sunrpc/svc_rdma.h>
50 105
51#define RPCDBG_FACILITY RPCDBG_SVCXPRT 106#define RPCDBG_FACILITY RPCDBG_SVCXPRT
@@ -59,7 +114,6 @@ static void rdma_build_arg_xdr(struct svc_rqst *rqstp,
59 struct svc_rdma_op_ctxt *ctxt, 114 struct svc_rdma_op_ctxt *ctxt,
60 u32 byte_count) 115 u32 byte_count)
61{ 116{
62 struct rpcrdma_msg *rmsgp;
63 struct page *page; 117 struct page *page;
64 u32 bc; 118 u32 bc;
65 int sge_no; 119 int sge_no;
@@ -83,20 +137,12 @@ static void rdma_build_arg_xdr(struct svc_rqst *rqstp,
83 rqstp->rq_arg.page_len = bc; 137 rqstp->rq_arg.page_len = bc;
84 rqstp->rq_arg.page_base = 0; 138 rqstp->rq_arg.page_base = 0;
85 139
86 /* RDMA_NOMSG: RDMA READ data should land just after RDMA RECV data */
87 rmsgp = (struct rpcrdma_msg *)rqstp->rq_arg.head[0].iov_base;
88 if (rmsgp->rm_type == rdma_nomsg)
89 rqstp->rq_arg.pages = &rqstp->rq_pages[0];
90 else
91 rqstp->rq_arg.pages = &rqstp->rq_pages[1];
92
93 sge_no = 1; 140 sge_no = 1;
94 while (bc && sge_no < ctxt->count) { 141 while (bc && sge_no < ctxt->count) {
95 page = ctxt->pages[sge_no]; 142 page = ctxt->pages[sge_no];
96 put_page(rqstp->rq_pages[sge_no]); 143 put_page(rqstp->rq_pages[sge_no]);
97 rqstp->rq_pages[sge_no] = page; 144 rqstp->rq_pages[sge_no] = page;
98 bc -= min_t(u32, bc, ctxt->sge[sge_no].length); 145 bc -= min_t(u32, bc, ctxt->sge[sge_no].length);
99 rqstp->rq_arg.buflen += ctxt->sge[sge_no].length;
100 sge_no++; 146 sge_no++;
101 } 147 }
102 rqstp->rq_respages = &rqstp->rq_pages[sge_no]; 148 rqstp->rq_respages = &rqstp->rq_pages[sge_no];
@@ -115,406 +161,208 @@ static void rdma_build_arg_xdr(struct svc_rqst *rqstp,
115 rqstp->rq_arg.tail[0].iov_len = 0; 161 rqstp->rq_arg.tail[0].iov_len = 0;
116} 162}
117 163
118/* Issue an RDMA_READ using the local lkey to map the data sink */ 164/* This accommodates the largest possible Write chunk,
119int rdma_read_chunk_lcl(struct svcxprt_rdma *xprt, 165 * in one segment.
120 struct svc_rqst *rqstp, 166 */
121 struct svc_rdma_op_ctxt *head, 167#define MAX_BYTES_WRITE_SEG ((u32)(RPCSVC_MAXPAGES << PAGE_SHIFT))
122 int *page_no,
123 u32 *page_offset,
124 u32 rs_handle,
125 u32 rs_length,
126 u64 rs_offset,
127 bool last)
128{
129 struct ib_rdma_wr read_wr;
130 int pages_needed = PAGE_ALIGN(*page_offset + rs_length) >> PAGE_SHIFT;
131 struct svc_rdma_op_ctxt *ctxt = svc_rdma_get_context(xprt);
132 int ret, read, pno;
133 u32 pg_off = *page_offset;
134 u32 pg_no = *page_no;
135
136 ctxt->direction = DMA_FROM_DEVICE;
137 ctxt->read_hdr = head;
138 pages_needed = min_t(int, pages_needed, xprt->sc_max_sge_rd);
139 read = min_t(int, (pages_needed << PAGE_SHIFT) - *page_offset,
140 rs_length);
141
142 for (pno = 0; pno < pages_needed; pno++) {
143 int len = min_t(int, rs_length, PAGE_SIZE - pg_off);
144
145 head->arg.pages[pg_no] = rqstp->rq_arg.pages[pg_no];
146 head->arg.page_len += len;
147
148 head->arg.len += len;
149 if (!pg_off)
150 head->count++;
151 rqstp->rq_respages = &rqstp->rq_arg.pages[pg_no+1];
152 rqstp->rq_next_page = rqstp->rq_respages + 1;
153 ctxt->sge[pno].addr =
154 ib_dma_map_page(xprt->sc_cm_id->device,
155 head->arg.pages[pg_no], pg_off,
156 PAGE_SIZE - pg_off,
157 DMA_FROM_DEVICE);
158 ret = ib_dma_mapping_error(xprt->sc_cm_id->device,
159 ctxt->sge[pno].addr);
160 if (ret)
161 goto err;
162 svc_rdma_count_mappings(xprt, ctxt);
163
164 ctxt->sge[pno].lkey = xprt->sc_pd->local_dma_lkey;
165 ctxt->sge[pno].length = len;
166 ctxt->count++;
167
168 /* adjust offset and wrap to next page if needed */
169 pg_off += len;
170 if (pg_off == PAGE_SIZE) {
171 pg_off = 0;
172 pg_no++;
173 }
174 rs_length -= len;
175 }
176
177 if (last && rs_length == 0)
178 set_bit(RDMACTXT_F_LAST_CTXT, &ctxt->flags);
179 else
180 clear_bit(RDMACTXT_F_LAST_CTXT, &ctxt->flags);
181
182 memset(&read_wr, 0, sizeof(read_wr));
183 ctxt->cqe.done = svc_rdma_wc_read;
184 read_wr.wr.wr_cqe = &ctxt->cqe;
185 read_wr.wr.opcode = IB_WR_RDMA_READ;
186 read_wr.wr.send_flags = IB_SEND_SIGNALED;
187 read_wr.rkey = rs_handle;
188 read_wr.remote_addr = rs_offset;
189 read_wr.wr.sg_list = ctxt->sge;
190 read_wr.wr.num_sge = pages_needed;
191
192 ret = svc_rdma_send(xprt, &read_wr.wr);
193 if (ret) {
194 pr_err("svcrdma: Error %d posting RDMA_READ\n", ret);
195 set_bit(XPT_CLOSE, &xprt->sc_xprt.xpt_flags);
196 goto err;
197 }
198 168
199 /* return current location in page array */ 169/* This accommodates the largest possible Position-Zero
200 *page_no = pg_no; 170 * Read chunk or Reply chunk, in one segment.
201 *page_offset = pg_off; 171 */
202 ret = read; 172#define MAX_BYTES_SPECIAL_SEG ((u32)((RPCSVC_MAXPAGES + 2) << PAGE_SHIFT))
203 atomic_inc(&rdma_stat_read);
204 return ret;
205 err:
206 svc_rdma_unmap_dma(ctxt);
207 svc_rdma_put_context(ctxt, 0);
208 return ret;
209}
210 173
211/* Issue an RDMA_READ using an FRMR to map the data sink */ 174/* Sanity check the Read list.
212int rdma_read_chunk_frmr(struct svcxprt_rdma *xprt, 175 *
213 struct svc_rqst *rqstp, 176 * Implementation limits:
214 struct svc_rdma_op_ctxt *head, 177 * - This implementation supports only one Read chunk.
215 int *page_no, 178 *
216 u32 *page_offset, 179 * Sanity checks:
217 u32 rs_handle, 180 * - Read list does not overflow buffer.
218 u32 rs_length, 181 * - Segment size limited by largest NFS data payload.
219 u64 rs_offset, 182 *
220 bool last) 183 * The segment count is limited to how many segments can
184 * fit in the transport header without overflowing the
185 * buffer. That's about 40 Read segments for a 1KB inline
186 * threshold.
187 *
188 * Returns pointer to the following Write list.
189 */
190static __be32 *xdr_check_read_list(__be32 *p, const __be32 *end)
221{ 191{
222 struct ib_rdma_wr read_wr; 192 u32 position;
223 struct ib_send_wr inv_wr; 193 bool first;
224 struct ib_reg_wr reg_wr; 194
225 u8 key; 195 first = true;
226 int nents = PAGE_ALIGN(*page_offset + rs_length) >> PAGE_SHIFT; 196 while (*p++ != xdr_zero) {
227 struct svc_rdma_op_ctxt *ctxt = svc_rdma_get_context(xprt); 197 if (first) {
228 struct svc_rdma_fastreg_mr *frmr = svc_rdma_get_frmr(xprt); 198 position = be32_to_cpup(p++);
229 int ret, read, pno, dma_nents, n; 199 first = false;
230 u32 pg_off = *page_offset; 200 } else if (be32_to_cpup(p++) != position) {
231 u32 pg_no = *page_no; 201 return NULL;
232
233 if (IS_ERR(frmr))
234 return -ENOMEM;
235
236 ctxt->direction = DMA_FROM_DEVICE;
237 ctxt->frmr = frmr;
238 nents = min_t(unsigned int, nents, xprt->sc_frmr_pg_list_len);
239 read = min_t(int, (nents << PAGE_SHIFT) - *page_offset, rs_length);
240
241 frmr->direction = DMA_FROM_DEVICE;
242 frmr->access_flags = (IB_ACCESS_LOCAL_WRITE|IB_ACCESS_REMOTE_WRITE);
243 frmr->sg_nents = nents;
244
245 for (pno = 0; pno < nents; pno++) {
246 int len = min_t(int, rs_length, PAGE_SIZE - pg_off);
247
248 head->arg.pages[pg_no] = rqstp->rq_arg.pages[pg_no];
249 head->arg.page_len += len;
250 head->arg.len += len;
251 if (!pg_off)
252 head->count++;
253
254 sg_set_page(&frmr->sg[pno], rqstp->rq_arg.pages[pg_no],
255 len, pg_off);
256
257 rqstp->rq_respages = &rqstp->rq_arg.pages[pg_no+1];
258 rqstp->rq_next_page = rqstp->rq_respages + 1;
259
260 /* adjust offset and wrap to next page if needed */
261 pg_off += len;
262 if (pg_off == PAGE_SIZE) {
263 pg_off = 0;
264 pg_no++;
265 } 202 }
266 rs_length -= len; 203 p++; /* handle */
267 } 204 if (be32_to_cpup(p++) > MAX_BYTES_SPECIAL_SEG)
205 return NULL;
206 p += 2; /* offset */
268 207
269 if (last && rs_length == 0) 208 if (p > end)
270 set_bit(RDMACTXT_F_LAST_CTXT, &ctxt->flags); 209 return NULL;
271 else
272 clear_bit(RDMACTXT_F_LAST_CTXT, &ctxt->flags);
273
274 dma_nents = ib_dma_map_sg(xprt->sc_cm_id->device,
275 frmr->sg, frmr->sg_nents,
276 frmr->direction);
277 if (!dma_nents) {
278 pr_err("svcrdma: failed to dma map sg %p\n",
279 frmr->sg);
280 return -ENOMEM;
281 } 210 }
211 return p;
212}
282 213
283 n = ib_map_mr_sg(frmr->mr, frmr->sg, frmr->sg_nents, NULL, PAGE_SIZE); 214/* The segment count is limited to how many segments can
284 if (unlikely(n != frmr->sg_nents)) { 215 * fit in the transport header without overflowing the
285 pr_err("svcrdma: failed to map mr %p (%d/%d elements)\n", 216 * buffer. That's about 60 Write segments for a 1KB inline
286 frmr->mr, n, frmr->sg_nents); 217 * threshold.
287 return n < 0 ? n : -EINVAL; 218 */
288 } 219static __be32 *xdr_check_write_chunk(__be32 *p, const __be32 *end,
220 u32 maxlen)
221{
222 u32 i, segcount;
289 223
290 /* Bump the key */ 224 segcount = be32_to_cpup(p++);
291 key = (u8)(frmr->mr->lkey & 0x000000FF); 225 for (i = 0; i < segcount; i++) {
292 ib_update_fast_reg_key(frmr->mr, ++key); 226 p++; /* handle */
293 227 if (be32_to_cpup(p++) > maxlen)
294 ctxt->sge[0].addr = frmr->mr->iova; 228 return NULL;
295 ctxt->sge[0].lkey = frmr->mr->lkey; 229 p += 2; /* offset */
296 ctxt->sge[0].length = frmr->mr->length;
297 ctxt->count = 1;
298 ctxt->read_hdr = head;
299
300 /* Prepare REG WR */
301 ctxt->reg_cqe.done = svc_rdma_wc_reg;
302 reg_wr.wr.wr_cqe = &ctxt->reg_cqe;
303 reg_wr.wr.opcode = IB_WR_REG_MR;
304 reg_wr.wr.send_flags = IB_SEND_SIGNALED;
305 reg_wr.wr.num_sge = 0;
306 reg_wr.mr = frmr->mr;
307 reg_wr.key = frmr->mr->lkey;
308 reg_wr.access = frmr->access_flags;
309 reg_wr.wr.next = &read_wr.wr;
310
311 /* Prepare RDMA_READ */
312 memset(&read_wr, 0, sizeof(read_wr));
313 ctxt->cqe.done = svc_rdma_wc_read;
314 read_wr.wr.wr_cqe = &ctxt->cqe;
315 read_wr.wr.send_flags = IB_SEND_SIGNALED;
316 read_wr.rkey = rs_handle;
317 read_wr.remote_addr = rs_offset;
318 read_wr.wr.sg_list = ctxt->sge;
319 read_wr.wr.num_sge = 1;
320 if (xprt->sc_dev_caps & SVCRDMA_DEVCAP_READ_W_INV) {
321 read_wr.wr.opcode = IB_WR_RDMA_READ_WITH_INV;
322 read_wr.wr.ex.invalidate_rkey = ctxt->frmr->mr->lkey;
323 } else {
324 read_wr.wr.opcode = IB_WR_RDMA_READ;
325 read_wr.wr.next = &inv_wr;
326 /* Prepare invalidate */
327 memset(&inv_wr, 0, sizeof(inv_wr));
328 ctxt->inv_cqe.done = svc_rdma_wc_inv;
329 inv_wr.wr_cqe = &ctxt->inv_cqe;
330 inv_wr.opcode = IB_WR_LOCAL_INV;
331 inv_wr.send_flags = IB_SEND_SIGNALED | IB_SEND_FENCE;
332 inv_wr.ex.invalidate_rkey = frmr->mr->lkey;
333 }
334 230
335 /* Post the chain */ 231 if (p > end)
336 ret = svc_rdma_send(xprt, &reg_wr.wr); 232 return NULL;
337 if (ret) {
338 pr_err("svcrdma: Error %d posting RDMA_READ\n", ret);
339 set_bit(XPT_CLOSE, &xprt->sc_xprt.xpt_flags);
340 goto err;
341 } 233 }
342 234
343 /* return current location in page array */ 235 return p;
344 *page_no = pg_no;
345 *page_offset = pg_off;
346 ret = read;
347 atomic_inc(&rdma_stat_read);
348 return ret;
349 err:
350 svc_rdma_put_context(ctxt, 0);
351 svc_rdma_put_frmr(xprt, frmr);
352 return ret;
353}
354
355static unsigned int
356rdma_rcl_chunk_count(struct rpcrdma_read_chunk *ch)
357{
358 unsigned int count;
359
360 for (count = 0; ch->rc_discrim != xdr_zero; ch++)
361 count++;
362 return count;
363} 236}
364 237
365/* If there was additional inline content, append it to the end of arg.pages. 238/* Sanity check the Write list.
366 * Tail copy has to be done after the reader function has determined how many 239 *
367 * pages are needed for RDMA READ. 240 * Implementation limits:
241 * - This implementation supports only one Write chunk.
242 *
243 * Sanity checks:
244 * - Write list does not overflow buffer.
245 * - Segment size limited by largest NFS data payload.
246 *
247 * Returns pointer to the following Reply chunk.
368 */ 248 */
369static int 249static __be32 *xdr_check_write_list(__be32 *p, const __be32 *end)
370rdma_copy_tail(struct svc_rqst *rqstp, struct svc_rdma_op_ctxt *head,
371 u32 position, u32 byte_count, u32 page_offset, int page_no)
372{ 250{
373 char *srcp, *destp; 251 u32 chcount;
374 252
375 srcp = head->arg.head[0].iov_base + position; 253 chcount = 0;
376 byte_count = head->arg.head[0].iov_len - position; 254 while (*p++ != xdr_zero) {
377 if (byte_count > PAGE_SIZE) { 255 p = xdr_check_write_chunk(p, end, MAX_BYTES_WRITE_SEG);
378 dprintk("svcrdma: large tail unsupported\n"); 256 if (!p)
379 return 0; 257 return NULL;
380 } 258 if (chcount++ > 1)
381 259 return NULL;
382 /* Fit as much of the tail on the current page as possible */
383 if (page_offset != PAGE_SIZE) {
384 destp = page_address(rqstp->rq_arg.pages[page_no]);
385 destp += page_offset;
386 while (byte_count--) {
387 *destp++ = *srcp++;
388 page_offset++;
389 if (page_offset == PAGE_SIZE && byte_count)
390 goto more;
391 }
392 goto done;
393 } 260 }
394 261 return p;
395more:
396 /* Fit the rest on the next page */
397 page_no++;
398 destp = page_address(rqstp->rq_arg.pages[page_no]);
399 while (byte_count--)
400 *destp++ = *srcp++;
401
402 rqstp->rq_respages = &rqstp->rq_arg.pages[page_no+1];
403 rqstp->rq_next_page = rqstp->rq_respages + 1;
404
405done:
406 byte_count = head->arg.head[0].iov_len - position;
407 head->arg.page_len += byte_count;
408 head->arg.len += byte_count;
409 head->arg.buflen += byte_count;
410 return 1;
411} 262}
412 263
413/* Returns the address of the first read chunk or <nul> if no read chunk 264/* Sanity check the Reply chunk.
414 * is present 265 *
266 * Sanity checks:
267 * - Reply chunk does not overflow buffer.
268 * - Segment size limited by largest NFS data payload.
269 *
270 * Returns pointer to the following RPC header.
415 */ 271 */
416static struct rpcrdma_read_chunk * 272static __be32 *xdr_check_reply_chunk(__be32 *p, const __be32 *end)
417svc_rdma_get_read_chunk(struct rpcrdma_msg *rmsgp)
418{ 273{
419 struct rpcrdma_read_chunk *ch = 274 if (*p++ != xdr_zero) {
420 (struct rpcrdma_read_chunk *)&rmsgp->rm_body.rm_chunks[0]; 275 p = xdr_check_write_chunk(p, end, MAX_BYTES_SPECIAL_SEG);
421 276 if (!p)
422 if (ch->rc_discrim == xdr_zero) 277 return NULL;
423 return NULL; 278 }
424 return ch; 279 return p;
425} 280}
426 281
427static int rdma_read_chunks(struct svcxprt_rdma *xprt, 282/* On entry, xdr->head[0].iov_base points to first byte in the
428 struct rpcrdma_msg *rmsgp, 283 * RPC-over-RDMA header.
429 struct svc_rqst *rqstp, 284 *
430 struct svc_rdma_op_ctxt *head) 285 * On successful exit, head[0] points to first byte past the
286 * RPC-over-RDMA header. For RDMA_MSG, this is the RPC message.
287 * The length of the RPC-over-RDMA header is returned.
288 *
289 * Assumptions:
290 * - The transport header is entirely contained in the head iovec.
291 */
292static int svc_rdma_xdr_decode_req(struct xdr_buf *rq_arg)
431{ 293{
432 int page_no, ret; 294 __be32 *p, *end, *rdma_argp;
433 struct rpcrdma_read_chunk *ch; 295 unsigned int hdr_len;
434 u32 handle, page_offset, byte_count; 296 char *proc;
435 u32 position; 297
436 u64 rs_offset; 298 /* Verify that there's enough bytes for header + something */
437 bool last; 299 if (rq_arg->len <= RPCRDMA_HDRLEN_ERR)
438 300 goto out_short;
439 /* If no read list is present, return 0 */ 301
440 ch = svc_rdma_get_read_chunk(rmsgp); 302 rdma_argp = rq_arg->head[0].iov_base;
441 if (!ch) 303 if (*(rdma_argp + 1) != rpcrdma_version)
442 return 0; 304 goto out_version;
305
306 switch (*(rdma_argp + 3)) {
307 case rdma_msg:
308 proc = "RDMA_MSG";
309 break;
310 case rdma_nomsg:
311 proc = "RDMA_NOMSG";
312 break;
313
314 case rdma_done:
315 goto out_drop;
443 316
444 if (rdma_rcl_chunk_count(ch) > RPCSVC_MAXPAGES) 317 case rdma_error:
445 return -EINVAL; 318 goto out_drop;
446
447 /* The request is completed when the RDMA_READs complete. The
448 * head context keeps all the pages that comprise the
449 * request.
450 */
451 head->arg.head[0] = rqstp->rq_arg.head[0];
452 head->arg.tail[0] = rqstp->rq_arg.tail[0];
453 head->hdr_count = head->count;
454 head->arg.page_base = 0;
455 head->arg.page_len = 0;
456 head->arg.len = rqstp->rq_arg.len;
457 head->arg.buflen = rqstp->rq_arg.buflen;
458
459 /* RDMA_NOMSG: RDMA READ data should land just after RDMA RECV data */
460 position = be32_to_cpu(ch->rc_position);
461 if (position == 0) {
462 head->arg.pages = &head->pages[0];
463 page_offset = head->byte_len;
464 } else {
465 head->arg.pages = &head->pages[head->count];
466 page_offset = 0;
467 }
468 319
469 ret = 0; 320 default:
470 page_no = 0; 321 goto out_proc;
471 for (; ch->rc_discrim != xdr_zero; ch++) {
472 if (be32_to_cpu(ch->rc_position) != position)
473 goto err;
474
475 handle = be32_to_cpu(ch->rc_target.rs_handle),
476 byte_count = be32_to_cpu(ch->rc_target.rs_length);
477 xdr_decode_hyper((__be32 *)&ch->rc_target.rs_offset,
478 &rs_offset);
479
480 while (byte_count > 0) {
481 last = (ch + 1)->rc_discrim == xdr_zero;
482 ret = xprt->sc_reader(xprt, rqstp, head,
483 &page_no, &page_offset,
484 handle, byte_count,
485 rs_offset, last);
486 if (ret < 0)
487 goto err;
488 byte_count -= ret;
489 rs_offset += ret;
490 head->arg.buflen += ret;
491 }
492 } 322 }
493 323
494 /* Read list may need XDR round-up (see RFC 5666, s. 3.7) */ 324 end = (__be32 *)((unsigned long)rdma_argp + rq_arg->len);
495 if (page_offset & 3) { 325 p = xdr_check_read_list(rdma_argp + 4, end);
496 u32 pad = 4 - (page_offset & 3); 326 if (!p)
497 327 goto out_inval;
498 head->arg.tail[0].iov_len += pad; 328 p = xdr_check_write_list(p, end);
499 head->arg.len += pad; 329 if (!p)
500 head->arg.buflen += pad; 330 goto out_inval;
501 page_offset += pad; 331 p = xdr_check_reply_chunk(p, end);
502 } 332 if (!p)
333 goto out_inval;
334 if (p > end)
335 goto out_inval;
336
337 rq_arg->head[0].iov_base = p;
338 hdr_len = (unsigned long)p - (unsigned long)rdma_argp;
339 rq_arg->head[0].iov_len -= hdr_len;
340 rq_arg->len -= hdr_len;
341 dprintk("svcrdma: received %s request for XID 0x%08x, hdr_len=%u\n",
342 proc, be32_to_cpup(rdma_argp), hdr_len);
343 return hdr_len;
344
345out_short:
346 dprintk("svcrdma: header too short = %d\n", rq_arg->len);
347 return -EINVAL;
348
349out_version:
350 dprintk("svcrdma: bad xprt version: %u\n",
351 be32_to_cpup(rdma_argp + 1));
352 return -EPROTONOSUPPORT;
503 353
504 ret = 1; 354out_drop:
505 if (position && position < head->arg.head[0].iov_len) 355 dprintk("svcrdma: dropping RDMA_DONE/ERROR message\n");
506 ret = rdma_copy_tail(rqstp, head, position, 356 return 0;
507 byte_count, page_offset, page_no);
508 head->arg.head[0].iov_len = position;
509 head->position = position;
510 357
511 err: 358out_proc:
512 /* Detach arg pages. svc_recv will replenish them */ 359 dprintk("svcrdma: bad rdma procedure (%u)\n",
513 for (page_no = 0; 360 be32_to_cpup(rdma_argp + 3));
514 &rqstp->rq_pages[page_no] < rqstp->rq_respages; page_no++) 361 return -EINVAL;
515 rqstp->rq_pages[page_no] = NULL;
516 362
517 return ret; 363out_inval:
364 dprintk("svcrdma: failed to parse transport header\n");
365 return -EINVAL;
518} 366}
519 367
520static void rdma_read_complete(struct svc_rqst *rqstp, 368static void rdma_read_complete(struct svc_rqst *rqstp,
@@ -528,24 +376,9 @@ static void rdma_read_complete(struct svc_rqst *rqstp,
528 rqstp->rq_pages[page_no] = head->pages[page_no]; 376 rqstp->rq_pages[page_no] = head->pages[page_no];
529 } 377 }
530 378
531 /* Adjustments made for RDMA_NOMSG type requests */
532 if (head->position == 0) {
533 if (head->arg.len <= head->sge[0].length) {
534 head->arg.head[0].iov_len = head->arg.len -
535 head->byte_len;
536 head->arg.page_len = 0;
537 } else {
538 head->arg.head[0].iov_len = head->sge[0].length -
539 head->byte_len;
540 head->arg.page_len = head->arg.len -
541 head->sge[0].length;
542 }
543 }
544
545 /* Point rq_arg.pages past header */ 379 /* Point rq_arg.pages past header */
546 rqstp->rq_arg.pages = &rqstp->rq_pages[head->hdr_count]; 380 rqstp->rq_arg.pages = &rqstp->rq_pages[head->hdr_count];
547 rqstp->rq_arg.page_len = head->arg.page_len; 381 rqstp->rq_arg.page_len = head->arg.page_len;
548 rqstp->rq_arg.page_base = head->arg.page_base;
549 382
550 /* rq_respages starts after the last arg page */ 383 /* rq_respages starts after the last arg page */
551 rqstp->rq_respages = &rqstp->rq_pages[page_no]; 384 rqstp->rq_respages = &rqstp->rq_pages[page_no];
@@ -642,21 +475,44 @@ static bool svc_rdma_is_backchannel_reply(struct svc_xprt *xprt,
642 return true; 475 return true;
643} 476}
644 477
645/* 478/**
646 * Set up the rqstp thread context to point to the RQ buffer. If 479 * svc_rdma_recvfrom - Receive an RPC call
647 * necessary, pull additional data from the client with an RDMA_READ 480 * @rqstp: request structure into which to receive an RPC Call
648 * request. 481 *
482 * Returns:
483 * The positive number of bytes in the RPC Call message,
484 * %0 if there were no Calls ready to return,
485 * %-EINVAL if the Read chunk data is too large,
486 * %-ENOMEM if rdma_rw context pool was exhausted,
487 * %-ENOTCONN if posting failed (connection is lost),
488 * %-EIO if rdma_rw initialization failed (DMA mapping, etc).
489 *
490 * Called in a loop when XPT_DATA is set. XPT_DATA is cleared only
491 * when there are no remaining ctxt's to process.
492 *
493 * The next ctxt is removed from the "receive" lists.
494 *
495 * - If the ctxt completes a Read, then finish assembling the Call
496 * message and return the number of bytes in the message.
497 *
498 * - If the ctxt completes a Receive, then construct the Call
499 * message from the contents of the Receive buffer.
500 *
501 * - If there are no Read chunks in this message, then finish
502 * assembling the Call message and return the number of bytes
503 * in the message.
504 *
505 * - If there are Read chunks in this message, post Read WRs to
506 * pull that payload and return 0.
649 */ 507 */
650int svc_rdma_recvfrom(struct svc_rqst *rqstp) 508int svc_rdma_recvfrom(struct svc_rqst *rqstp)
651{ 509{
652 struct svc_xprt *xprt = rqstp->rq_xprt; 510 struct svc_xprt *xprt = rqstp->rq_xprt;
653 struct svcxprt_rdma *rdma_xprt = 511 struct svcxprt_rdma *rdma_xprt =
654 container_of(xprt, struct svcxprt_rdma, sc_xprt); 512 container_of(xprt, struct svcxprt_rdma, sc_xprt);
655 struct svc_rdma_op_ctxt *ctxt = NULL; 513 struct svc_rdma_op_ctxt *ctxt;
656 struct rpcrdma_msg *rmsgp; 514 __be32 *p;
657 int ret = 0; 515 int ret;
658
659 dprintk("svcrdma: rqstp=%p\n", rqstp);
660 516
661 spin_lock(&rdma_xprt->sc_rq_dto_lock); 517 spin_lock(&rdma_xprt->sc_rq_dto_lock);
662 if (!list_empty(&rdma_xprt->sc_read_complete_q)) { 518 if (!list_empty(&rdma_xprt->sc_read_complete_q)) {
@@ -671,22 +527,14 @@ int svc_rdma_recvfrom(struct svc_rqst *rqstp)
671 struct svc_rdma_op_ctxt, list); 527 struct svc_rdma_op_ctxt, list);
672 list_del(&ctxt->list); 528 list_del(&ctxt->list);
673 } else { 529 } else {
674 atomic_inc(&rdma_stat_rq_starve); 530 /* No new incoming requests, terminate the loop */
675 clear_bit(XPT_DATA, &xprt->xpt_flags); 531 clear_bit(XPT_DATA, &xprt->xpt_flags);
676 ctxt = NULL; 532 spin_unlock(&rdma_xprt->sc_rq_dto_lock);
533 return 0;
677 } 534 }
678 spin_unlock(&rdma_xprt->sc_rq_dto_lock); 535 spin_unlock(&rdma_xprt->sc_rq_dto_lock);
679 if (!ctxt) { 536
680 /* This is the EAGAIN path. The svc_recv routine will 537 dprintk("svcrdma: recvfrom: ctxt=%p on xprt=%p, rqstp=%p\n",
681 * return -EAGAIN, the nfsd thread will go to call into
682 * svc_recv again and we shouldn't be on the active
683 * transport list
684 */
685 if (test_bit(XPT_CLOSE, &xprt->xpt_flags))
686 goto defer;
687 goto out;
688 }
689 dprintk("svcrdma: processing ctxt=%p on xprt=%p, rqstp=%p\n",
690 ctxt, rdma_xprt, rqstp); 538 ctxt, rdma_xprt, rqstp);
691 atomic_inc(&rdma_stat_recv); 539 atomic_inc(&rdma_stat_recv);
692 540
@@ -694,7 +542,7 @@ int svc_rdma_recvfrom(struct svc_rqst *rqstp)
694 rdma_build_arg_xdr(rqstp, ctxt, ctxt->byte_len); 542 rdma_build_arg_xdr(rqstp, ctxt, ctxt->byte_len);
695 543
696 /* Decode the RDMA header. */ 544 /* Decode the RDMA header. */
697 rmsgp = (struct rpcrdma_msg *)rqstp->rq_arg.head[0].iov_base; 545 p = (__be32 *)rqstp->rq_arg.head[0].iov_base;
698 ret = svc_rdma_xdr_decode_req(&rqstp->rq_arg); 546 ret = svc_rdma_xdr_decode_req(&rqstp->rq_arg);
699 if (ret < 0) 547 if (ret < 0)
700 goto out_err; 548 goto out_err;
@@ -702,9 +550,8 @@ int svc_rdma_recvfrom(struct svc_rqst *rqstp)
702 goto out_drop; 550 goto out_drop;
703 rqstp->rq_xprt_hlen = ret; 551 rqstp->rq_xprt_hlen = ret;
704 552
705 if (svc_rdma_is_backchannel_reply(xprt, &rmsgp->rm_xid)) { 553 if (svc_rdma_is_backchannel_reply(xprt, p)) {
706 ret = svc_rdma_handle_bc_reply(xprt->xpt_bc_xprt, 554 ret = svc_rdma_handle_bc_reply(xprt->xpt_bc_xprt, p,
707 &rmsgp->rm_xid,
708 &rqstp->rq_arg); 555 &rqstp->rq_arg);
709 svc_rdma_put_context(ctxt, 0); 556 svc_rdma_put_context(ctxt, 0);
710 if (ret) 557 if (ret)
@@ -712,39 +559,34 @@ int svc_rdma_recvfrom(struct svc_rqst *rqstp)
712 return ret; 559 return ret;
713 } 560 }
714 561
715 /* Read read-list data. */ 562 p += rpcrdma_fixed_maxsz;
716 ret = rdma_read_chunks(rdma_xprt, rmsgp, rqstp, ctxt); 563 if (*p != xdr_zero)
717 if (ret > 0) { 564 goto out_readchunk;
718 /* read-list posted, defer until data received from client. */
719 goto defer;
720 } else if (ret < 0) {
721 /* Post of read-list failed, free context. */
722 svc_rdma_put_context(ctxt, 1);
723 return 0;
724 }
725 565
726complete: 566complete:
727 ret = rqstp->rq_arg.head[0].iov_len
728 + rqstp->rq_arg.page_len
729 + rqstp->rq_arg.tail[0].iov_len;
730 svc_rdma_put_context(ctxt, 0); 567 svc_rdma_put_context(ctxt, 0);
731 out: 568 dprintk("svcrdma: recvfrom: xprt=%p, rqstp=%p, rq_arg.len=%u\n",
732 dprintk("svcrdma: ret=%d, rq_arg.len=%u, " 569 rdma_xprt, rqstp, rqstp->rq_arg.len);
733 "rq_arg.head[0].iov_base=%p, rq_arg.head[0].iov_len=%zd\n",
734 ret, rqstp->rq_arg.len,
735 rqstp->rq_arg.head[0].iov_base,
736 rqstp->rq_arg.head[0].iov_len);
737 rqstp->rq_prot = IPPROTO_MAX; 570 rqstp->rq_prot = IPPROTO_MAX;
738 svc_xprt_copy_addrs(rqstp, xprt); 571 svc_xprt_copy_addrs(rqstp, xprt);
739 return ret; 572 return rqstp->rq_arg.len;
573
574out_readchunk:
575 ret = svc_rdma_recv_read_chunk(rdma_xprt, rqstp, ctxt, p);
576 if (ret < 0)
577 goto out_postfail;
578 return 0;
740 579
741out_err: 580out_err:
742 svc_rdma_send_error(rdma_xprt, &rmsgp->rm_xid, ret); 581 svc_rdma_send_error(rdma_xprt, p, ret);
743 svc_rdma_put_context(ctxt, 0); 582 svc_rdma_put_context(ctxt, 0);
744 return 0; 583 return 0;
745 584
746defer: 585out_postfail:
747 return 0; 586 if (ret == -EINVAL)
587 svc_rdma_send_error(rdma_xprt, p, ret);
588 svc_rdma_put_context(ctxt, 1);
589 return ret;
748 590
749out_drop: 591out_drop:
750 svc_rdma_put_context(ctxt, 1); 592 svc_rdma_put_context(ctxt, 1);
diff --git a/net/sunrpc/xprtrdma/svc_rdma_rw.c b/net/sunrpc/xprtrdma/svc_rdma_rw.c
index 0cf620277693..933f79bed270 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_rw.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_rw.c
@@ -12,6 +12,9 @@
12 12
13#define RPCDBG_FACILITY RPCDBG_SVCXPRT 13#define RPCDBG_FACILITY RPCDBG_SVCXPRT
14 14
15static void svc_rdma_write_done(struct ib_cq *cq, struct ib_wc *wc);
16static void svc_rdma_wc_read_done(struct ib_cq *cq, struct ib_wc *wc);
17
15/* Each R/W context contains state for one chain of RDMA Read or 18/* Each R/W context contains state for one chain of RDMA Read or
16 * Write Work Requests. 19 * Write Work Requests.
17 * 20 *
@@ -113,22 +116,20 @@ struct svc_rdma_chunk_ctxt {
113 struct svcxprt_rdma *cc_rdma; 116 struct svcxprt_rdma *cc_rdma;
114 struct list_head cc_rwctxts; 117 struct list_head cc_rwctxts;
115 int cc_sqecount; 118 int cc_sqecount;
116 enum dma_data_direction cc_dir;
117}; 119};
118 120
119static void svc_rdma_cc_init(struct svcxprt_rdma *rdma, 121static void svc_rdma_cc_init(struct svcxprt_rdma *rdma,
120 struct svc_rdma_chunk_ctxt *cc, 122 struct svc_rdma_chunk_ctxt *cc)
121 enum dma_data_direction dir)
122{ 123{
123 cc->cc_rdma = rdma; 124 cc->cc_rdma = rdma;
124 svc_xprt_get(&rdma->sc_xprt); 125 svc_xprt_get(&rdma->sc_xprt);
125 126
126 INIT_LIST_HEAD(&cc->cc_rwctxts); 127 INIT_LIST_HEAD(&cc->cc_rwctxts);
127 cc->cc_sqecount = 0; 128 cc->cc_sqecount = 0;
128 cc->cc_dir = dir;
129} 129}
130 130
131static void svc_rdma_cc_release(struct svc_rdma_chunk_ctxt *cc) 131static void svc_rdma_cc_release(struct svc_rdma_chunk_ctxt *cc,
132 enum dma_data_direction dir)
132{ 133{
133 struct svcxprt_rdma *rdma = cc->cc_rdma; 134 struct svcxprt_rdma *rdma = cc->cc_rdma;
134 struct svc_rdma_rw_ctxt *ctxt; 135 struct svc_rdma_rw_ctxt *ctxt;
@@ -138,7 +139,7 @@ static void svc_rdma_cc_release(struct svc_rdma_chunk_ctxt *cc)
138 139
139 rdma_rw_ctx_destroy(&ctxt->rw_ctx, rdma->sc_qp, 140 rdma_rw_ctx_destroy(&ctxt->rw_ctx, rdma->sc_qp,
140 rdma->sc_port_num, ctxt->rw_sg_table.sgl, 141 rdma->sc_port_num, ctxt->rw_sg_table.sgl,
141 ctxt->rw_nents, cc->cc_dir); 142 ctxt->rw_nents, dir);
142 svc_rdma_put_rw_ctxt(rdma, ctxt); 143 svc_rdma_put_rw_ctxt(rdma, ctxt);
143 } 144 }
144 svc_xprt_put(&rdma->sc_xprt); 145 svc_xprt_put(&rdma->sc_xprt);
@@ -176,13 +177,14 @@ svc_rdma_write_info_alloc(struct svcxprt_rdma *rdma, __be32 *chunk)
176 info->wi_seg_no = 0; 177 info->wi_seg_no = 0;
177 info->wi_nsegs = be32_to_cpup(++chunk); 178 info->wi_nsegs = be32_to_cpup(++chunk);
178 info->wi_segs = ++chunk; 179 info->wi_segs = ++chunk;
179 svc_rdma_cc_init(rdma, &info->wi_cc, DMA_TO_DEVICE); 180 svc_rdma_cc_init(rdma, &info->wi_cc);
181 info->wi_cc.cc_cqe.done = svc_rdma_write_done;
180 return info; 182 return info;
181} 183}
182 184
183static void svc_rdma_write_info_free(struct svc_rdma_write_info *info) 185static void svc_rdma_write_info_free(struct svc_rdma_write_info *info)
184{ 186{
185 svc_rdma_cc_release(&info->wi_cc); 187 svc_rdma_cc_release(&info->wi_cc, DMA_TO_DEVICE);
186 kfree(info); 188 kfree(info);
187} 189}
188 190
@@ -216,6 +218,76 @@ static void svc_rdma_write_done(struct ib_cq *cq, struct ib_wc *wc)
216 svc_rdma_write_info_free(info); 218 svc_rdma_write_info_free(info);
217} 219}
218 220
221/* State for pulling a Read chunk.
222 */
223struct svc_rdma_read_info {
224 struct svc_rdma_op_ctxt *ri_readctxt;
225 unsigned int ri_position;
226 unsigned int ri_pageno;
227 unsigned int ri_pageoff;
228 unsigned int ri_chunklen;
229
230 struct svc_rdma_chunk_ctxt ri_cc;
231};
232
233static struct svc_rdma_read_info *
234svc_rdma_read_info_alloc(struct svcxprt_rdma *rdma)
235{
236 struct svc_rdma_read_info *info;
237
238 info = kmalloc(sizeof(*info), GFP_KERNEL);
239 if (!info)
240 return info;
241
242 svc_rdma_cc_init(rdma, &info->ri_cc);
243 info->ri_cc.cc_cqe.done = svc_rdma_wc_read_done;
244 return info;
245}
246
247static void svc_rdma_read_info_free(struct svc_rdma_read_info *info)
248{
249 svc_rdma_cc_release(&info->ri_cc, DMA_FROM_DEVICE);
250 kfree(info);
251}
252
253/**
254 * svc_rdma_wc_read_done - Handle completion of an RDMA Read ctx
255 * @cq: controlling Completion Queue
256 * @wc: Work Completion
257 *
258 */
259static void svc_rdma_wc_read_done(struct ib_cq *cq, struct ib_wc *wc)
260{
261 struct ib_cqe *cqe = wc->wr_cqe;
262 struct svc_rdma_chunk_ctxt *cc =
263 container_of(cqe, struct svc_rdma_chunk_ctxt, cc_cqe);
264 struct svcxprt_rdma *rdma = cc->cc_rdma;
265 struct svc_rdma_read_info *info =
266 container_of(cc, struct svc_rdma_read_info, ri_cc);
267
268 atomic_add(cc->cc_sqecount, &rdma->sc_sq_avail);
269 wake_up(&rdma->sc_send_wait);
270
271 if (unlikely(wc->status != IB_WC_SUCCESS)) {
272 set_bit(XPT_CLOSE, &rdma->sc_xprt.xpt_flags);
273 if (wc->status != IB_WC_WR_FLUSH_ERR)
274 pr_err("svcrdma: read ctx: %s (%u/0x%x)\n",
275 ib_wc_status_msg(wc->status),
276 wc->status, wc->vendor_err);
277 svc_rdma_put_context(info->ri_readctxt, 1);
278 } else {
279 spin_lock(&rdma->sc_rq_dto_lock);
280 list_add_tail(&info->ri_readctxt->list,
281 &rdma->sc_read_complete_q);
282 spin_unlock(&rdma->sc_rq_dto_lock);
283
284 set_bit(XPT_DATA, &rdma->sc_xprt.xpt_flags);
285 svc_xprt_enqueue(&rdma->sc_xprt);
286 }
287
288 svc_rdma_read_info_free(info);
289}
290
219/* This function sleeps when the transport's Send Queue is congested. 291/* This function sleeps when the transport's Send Queue is congested.
220 * 292 *
221 * Assumptions: 293 * Assumptions:
@@ -232,6 +304,9 @@ static int svc_rdma_post_chunk_ctxt(struct svc_rdma_chunk_ctxt *cc)
232 struct ib_cqe *cqe; 304 struct ib_cqe *cqe;
233 int ret; 305 int ret;
234 306
307 if (cc->cc_sqecount > rdma->sc_sq_depth)
308 return -EINVAL;
309
235 first_wr = NULL; 310 first_wr = NULL;
236 cqe = &cc->cc_cqe; 311 cqe = &cc->cc_cqe;
237 list_for_each(tmp, &cc->cc_rwctxts) { 312 list_for_each(tmp, &cc->cc_rwctxts) {
@@ -295,8 +370,9 @@ static void svc_rdma_pagelist_to_sg(struct svc_rdma_write_info *info,
295 struct scatterlist *sg; 370 struct scatterlist *sg;
296 struct page **page; 371 struct page **page;
297 372
298 page_off = (info->wi_next_off + xdr->page_base) & ~PAGE_MASK; 373 page_off = info->wi_next_off + xdr->page_base;
299 page_no = (info->wi_next_off + xdr->page_base) >> PAGE_SHIFT; 374 page_no = page_off >> PAGE_SHIFT;
375 page_off = offset_in_page(page_off);
300 page = xdr->pages + page_no; 376 page = xdr->pages + page_no;
301 info->wi_next_off += remaining; 377 info->wi_next_off += remaining;
302 sg = ctxt->rw_sg_table.sgl; 378 sg = ctxt->rw_sg_table.sgl;
@@ -332,7 +408,6 @@ svc_rdma_build_writes(struct svc_rdma_write_info *info,
332 __be32 *seg; 408 __be32 *seg;
333 int ret; 409 int ret;
334 410
335 cc->cc_cqe.done = svc_rdma_write_done;
336 seg = info->wi_segs + info->wi_seg_no * rpcrdma_segment_maxsz; 411 seg = info->wi_segs + info->wi_seg_no * rpcrdma_segment_maxsz;
337 do { 412 do {
338 unsigned int write_len; 413 unsigned int write_len;
@@ -425,6 +500,7 @@ static int svc_rdma_send_xdr_pagelist(struct svc_rdma_write_info *info,
425 * 500 *
426 * Returns a non-negative number of bytes the chunk consumed, or 501 * Returns a non-negative number of bytes the chunk consumed, or
427 * %-E2BIG if the payload was larger than the Write chunk, 502 * %-E2BIG if the payload was larger than the Write chunk,
503 * %-EINVAL if client provided too many segments,
428 * %-ENOMEM if rdma_rw context pool was exhausted, 504 * %-ENOMEM if rdma_rw context pool was exhausted,
429 * %-ENOTCONN if posting failed (connection is lost), 505 * %-ENOTCONN if posting failed (connection is lost),
430 * %-EIO if rdma_rw initialization failed (DMA mapping, etc). 506 * %-EIO if rdma_rw initialization failed (DMA mapping, etc).
@@ -465,6 +541,7 @@ out_err:
465 * 541 *
466 * Returns a non-negative number of bytes the chunk consumed, or 542 * Returns a non-negative number of bytes the chunk consumed, or
467 * %-E2BIG if the payload was larger than the Reply chunk, 543 * %-E2BIG if the payload was larger than the Reply chunk,
544 * %-EINVAL if client provided too many segments,
468 * %-ENOMEM if rdma_rw context pool was exhausted, 545 * %-ENOMEM if rdma_rw context pool was exhausted,
469 * %-ENOTCONN if posting failed (connection is lost), 546 * %-ENOTCONN if posting failed (connection is lost),
470 * %-EIO if rdma_rw initialization failed (DMA mapping, etc). 547 * %-EIO if rdma_rw initialization failed (DMA mapping, etc).
@@ -510,3 +587,353 @@ out_err:
510 svc_rdma_write_info_free(info); 587 svc_rdma_write_info_free(info);
511 return ret; 588 return ret;
512} 589}
590
591static int svc_rdma_build_read_segment(struct svc_rdma_read_info *info,
592 struct svc_rqst *rqstp,
593 u32 rkey, u32 len, u64 offset)
594{
595 struct svc_rdma_op_ctxt *head = info->ri_readctxt;
596 struct svc_rdma_chunk_ctxt *cc = &info->ri_cc;
597 struct svc_rdma_rw_ctxt *ctxt;
598 unsigned int sge_no, seg_len;
599 struct scatterlist *sg;
600 int ret;
601
602 sge_no = PAGE_ALIGN(info->ri_pageoff + len) >> PAGE_SHIFT;
603 ctxt = svc_rdma_get_rw_ctxt(cc->cc_rdma, sge_no);
604 if (!ctxt)
605 goto out_noctx;
606 ctxt->rw_nents = sge_no;
607
608 dprintk("svcrdma: reading segment %u@0x%016llx:0x%08x (%u sges)\n",
609 len, offset, rkey, sge_no);
610
611 sg = ctxt->rw_sg_table.sgl;
612 for (sge_no = 0; sge_no < ctxt->rw_nents; sge_no++) {
613 seg_len = min_t(unsigned int, len,
614 PAGE_SIZE - info->ri_pageoff);
615
616 head->arg.pages[info->ri_pageno] =
617 rqstp->rq_pages[info->ri_pageno];
618 if (!info->ri_pageoff)
619 head->count++;
620
621 sg_set_page(sg, rqstp->rq_pages[info->ri_pageno],
622 seg_len, info->ri_pageoff);
623 sg = sg_next(sg);
624
625 info->ri_pageoff += seg_len;
626 if (info->ri_pageoff == PAGE_SIZE) {
627 info->ri_pageno++;
628 info->ri_pageoff = 0;
629 }
630 len -= seg_len;
631
632 /* Safety check */
633 if (len &&
634 &rqstp->rq_pages[info->ri_pageno + 1] > rqstp->rq_page_end)
635 goto out_overrun;
636 }
637
638 ret = rdma_rw_ctx_init(&ctxt->rw_ctx, cc->cc_rdma->sc_qp,
639 cc->cc_rdma->sc_port_num,
640 ctxt->rw_sg_table.sgl, ctxt->rw_nents,
641 0, offset, rkey, DMA_FROM_DEVICE);
642 if (ret < 0)
643 goto out_initerr;
644
645 list_add(&ctxt->rw_list, &cc->cc_rwctxts);
646 cc->cc_sqecount += ret;
647 return 0;
648
649out_noctx:
650 dprintk("svcrdma: no R/W ctxs available\n");
651 return -ENOMEM;
652
653out_overrun:
654 dprintk("svcrdma: request overruns rq_pages\n");
655 return -EINVAL;
656
657out_initerr:
658 svc_rdma_put_rw_ctxt(cc->cc_rdma, ctxt);
659 pr_err("svcrdma: failed to map pagelist (%d)\n", ret);
660 return -EIO;
661}
662
663static int svc_rdma_build_read_chunk(struct svc_rqst *rqstp,
664 struct svc_rdma_read_info *info,
665 __be32 *p)
666{
667 int ret;
668
669 info->ri_chunklen = 0;
670 while (*p++ != xdr_zero) {
671 u32 rs_handle, rs_length;
672 u64 rs_offset;
673
674 if (be32_to_cpup(p++) != info->ri_position)
675 break;
676 rs_handle = be32_to_cpup(p++);
677 rs_length = be32_to_cpup(p++);
678 p = xdr_decode_hyper(p, &rs_offset);
679
680 ret = svc_rdma_build_read_segment(info, rqstp,
681 rs_handle, rs_length,
682 rs_offset);
683 if (ret < 0)
684 break;
685
686 info->ri_chunklen += rs_length;
687 }
688
689 return ret;
690}
691
692/* If there is inline content following the Read chunk, append it to
693 * the page list immediately following the data payload. This has to
694 * be done after the reader function has determined how many pages
695 * were consumed for RDMA Read.
696 *
697 * On entry, ri_pageno and ri_pageoff point directly to the end of the
698 * page list. On exit, both have been updated to the new "next byte".
699 *
700 * Assumptions:
701 * - Inline content fits entirely in rq_pages[0]
702 * - Trailing content is only a handful of bytes
703 */
704static int svc_rdma_copy_tail(struct svc_rqst *rqstp,
705 struct svc_rdma_read_info *info)
706{
707 struct svc_rdma_op_ctxt *head = info->ri_readctxt;
708 unsigned int tail_length, remaining;
709 u8 *srcp, *destp;
710
711 /* Assert that all inline content fits in page 0. This is an
712 * implementation limit, not a protocol limit.
713 */
714 if (head->arg.head[0].iov_len > PAGE_SIZE) {
715 pr_warn_once("svcrdma: too much trailing inline content\n");
716 return -EINVAL;
717 }
718
719 srcp = head->arg.head[0].iov_base;
720 srcp += info->ri_position;
721 tail_length = head->arg.head[0].iov_len - info->ri_position;
722 remaining = tail_length;
723
724 /* If there is room on the last page in the page list, try to
725 * fit the trailing content there.
726 */
727 if (info->ri_pageoff > 0) {
728 unsigned int len;
729
730 len = min_t(unsigned int, remaining,
731 PAGE_SIZE - info->ri_pageoff);
732 destp = page_address(rqstp->rq_pages[info->ri_pageno]);
733 destp += info->ri_pageoff;
734
735 memcpy(destp, srcp, len);
736 srcp += len;
737 destp += len;
738 info->ri_pageoff += len;
739 remaining -= len;
740
741 if (info->ri_pageoff == PAGE_SIZE) {
742 info->ri_pageno++;
743 info->ri_pageoff = 0;
744 }
745 }
746
747 /* Otherwise, a fresh page is needed. */
748 if (remaining) {
749 head->arg.pages[info->ri_pageno] =
750 rqstp->rq_pages[info->ri_pageno];
751 head->count++;
752
753 destp = page_address(rqstp->rq_pages[info->ri_pageno]);
754 memcpy(destp, srcp, remaining);
755 info->ri_pageoff += remaining;
756 }
757
758 head->arg.page_len += tail_length;
759 head->arg.len += tail_length;
760 head->arg.buflen += tail_length;
761 return 0;
762}
763
764/* Construct RDMA Reads to pull over a normal Read chunk. The chunk
765 * data lands in the page list of head->arg.pages.
766 *
767 * Currently NFSD does not look at the head->arg.tail[0] iovec.
768 * Therefore, XDR round-up of the Read chunk and trailing
769 * inline content must both be added at the end of the pagelist.
770 */
771static int svc_rdma_build_normal_read_chunk(struct svc_rqst *rqstp,
772 struct svc_rdma_read_info *info,
773 __be32 *p)
774{
775 struct svc_rdma_op_ctxt *head = info->ri_readctxt;
776 int ret;
777
778 dprintk("svcrdma: Reading Read chunk at position %u\n",
779 info->ri_position);
780
781 info->ri_pageno = head->hdr_count;
782 info->ri_pageoff = 0;
783
784 ret = svc_rdma_build_read_chunk(rqstp, info, p);
785 if (ret < 0)
786 goto out;
787
788 /* Read chunk may need XDR round-up (see RFC 5666, s. 3.7).
789 */
790 if (info->ri_chunklen & 3) {
791 u32 padlen = 4 - (info->ri_chunklen & 3);
792
793 info->ri_chunklen += padlen;
794
795 /* NB: data payload always starts on XDR alignment,
796 * thus the pad can never contain a page boundary.
797 */
798 info->ri_pageoff += padlen;
799 if (info->ri_pageoff == PAGE_SIZE) {
800 info->ri_pageno++;
801 info->ri_pageoff = 0;
802 }
803 }
804
805 head->arg.page_len = info->ri_chunklen;
806 head->arg.len += info->ri_chunklen;
807 head->arg.buflen += info->ri_chunklen;
808
809 if (info->ri_position < head->arg.head[0].iov_len) {
810 ret = svc_rdma_copy_tail(rqstp, info);
811 if (ret < 0)
812 goto out;
813 }
814 head->arg.head[0].iov_len = info->ri_position;
815
816out:
817 return ret;
818}
819
820/* Construct RDMA Reads to pull over a Position Zero Read chunk.
821 * The start of the data lands in the first page just after
822 * the Transport header, and the rest lands in the page list of
823 * head->arg.pages.
824 *
825 * Assumptions:
826 * - A PZRC has an XDR-aligned length (no implicit round-up).
827 * - There can be no trailing inline content (IOW, we assume
828 * a PZRC is never sent in an RDMA_MSG message, though it's
829 * allowed by spec).
830 */
831static int svc_rdma_build_pz_read_chunk(struct svc_rqst *rqstp,
832 struct svc_rdma_read_info *info,
833 __be32 *p)
834{
835 struct svc_rdma_op_ctxt *head = info->ri_readctxt;
836 int ret;
837
838 dprintk("svcrdma: Reading Position Zero Read chunk\n");
839
840 info->ri_pageno = head->hdr_count - 1;
841 info->ri_pageoff = offset_in_page(head->byte_len);
842
843 ret = svc_rdma_build_read_chunk(rqstp, info, p);
844 if (ret < 0)
845 goto out;
846
847 head->arg.len += info->ri_chunklen;
848 head->arg.buflen += info->ri_chunklen;
849
850 if (head->arg.buflen <= head->sge[0].length) {
851 /* Transport header and RPC message fit entirely
852 * in page where head iovec resides.
853 */
854 head->arg.head[0].iov_len = info->ri_chunklen;
855 } else {
856 /* Transport header and part of RPC message reside
857 * in the head iovec's page.
858 */
859 head->arg.head[0].iov_len =
860 head->sge[0].length - head->byte_len;
861 head->arg.page_len =
862 info->ri_chunklen - head->arg.head[0].iov_len;
863 }
864
865out:
866 return ret;
867}
868
869/**
870 * svc_rdma_recv_read_chunk - Pull a Read chunk from the client
871 * @rdma: controlling RDMA transport
872 * @rqstp: set of pages to use as Read sink buffers
873 * @head: pages under I/O collect here
874 * @p: pointer to start of Read chunk
875 *
876 * Returns:
877 * %0 if all needed RDMA Reads were posted successfully,
878 * %-EINVAL if client provided too many segments,
879 * %-ENOMEM if rdma_rw context pool was exhausted,
880 * %-ENOTCONN if posting failed (connection is lost),
881 * %-EIO if rdma_rw initialization failed (DMA mapping, etc).
882 *
883 * Assumptions:
884 * - All Read segments in @p have the same Position value.
885 */
886int svc_rdma_recv_read_chunk(struct svcxprt_rdma *rdma, struct svc_rqst *rqstp,
887 struct svc_rdma_op_ctxt *head, __be32 *p)
888{
889 struct svc_rdma_read_info *info;
890 struct page **page;
891 int ret;
892
893 /* The request (with page list) is constructed in
894 * head->arg. Pages involved with RDMA Read I/O are
895 * transferred there.
896 */
897 head->hdr_count = head->count;
898 head->arg.head[0] = rqstp->rq_arg.head[0];
899 head->arg.tail[0] = rqstp->rq_arg.tail[0];
900 head->arg.pages = head->pages;
901 head->arg.page_base = 0;
902 head->arg.page_len = 0;
903 head->arg.len = rqstp->rq_arg.len;
904 head->arg.buflen = rqstp->rq_arg.buflen;
905
906 info = svc_rdma_read_info_alloc(rdma);
907 if (!info)
908 return -ENOMEM;
909 info->ri_readctxt = head;
910
911 info->ri_position = be32_to_cpup(p + 1);
912 if (info->ri_position)
913 ret = svc_rdma_build_normal_read_chunk(rqstp, info, p);
914 else
915 ret = svc_rdma_build_pz_read_chunk(rqstp, info, p);
916
917 /* Mark the start of the pages that can be used for the reply */
918 if (info->ri_pageoff > 0)
919 info->ri_pageno++;
920 rqstp->rq_respages = &rqstp->rq_pages[info->ri_pageno];
921 rqstp->rq_next_page = rqstp->rq_respages + 1;
922
923 if (ret < 0)
924 goto out;
925
926 ret = svc_rdma_post_chunk_ctxt(&info->ri_cc);
927
928out:
929 /* Read sink pages have been moved from rqstp->rq_pages to
930 * head->arg.pages. Force svc_recv to refill those slots
931 * in rq_pages.
932 */
933 for (page = rqstp->rq_pages; page < rqstp->rq_respages; page++)
934 *page = NULL;
935
936 if (ret < 0)
937 svc_rdma_read_info_free(info);
938 return ret;
939}
diff --git a/net/sunrpc/xprtrdma/svc_rdma_sendto.c b/net/sunrpc/xprtrdma/svc_rdma_sendto.c
index 1736337f3a55..7c3a211e0e9a 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_sendto.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_sendto.c
@@ -313,13 +313,17 @@ static int svc_rdma_dma_map_buf(struct svcxprt_rdma *rdma,
313 dma_addr = ib_dma_map_page(dev, virt_to_page(base), 313 dma_addr = ib_dma_map_page(dev, virt_to_page(base),
314 offset, len, DMA_TO_DEVICE); 314 offset, len, DMA_TO_DEVICE);
315 if (ib_dma_mapping_error(dev, dma_addr)) 315 if (ib_dma_mapping_error(dev, dma_addr))
316 return -EIO; 316 goto out_maperr;
317 317
318 ctxt->sge[sge_no].addr = dma_addr; 318 ctxt->sge[sge_no].addr = dma_addr;
319 ctxt->sge[sge_no].length = len; 319 ctxt->sge[sge_no].length = len;
320 ctxt->sge[sge_no].lkey = rdma->sc_pd->local_dma_lkey; 320 ctxt->sge[sge_no].lkey = rdma->sc_pd->local_dma_lkey;
321 svc_rdma_count_mappings(rdma, ctxt); 321 svc_rdma_count_mappings(rdma, ctxt);
322 return 0; 322 return 0;
323
324out_maperr:
325 pr_err("svcrdma: failed to map buffer\n");
326 return -EIO;
323} 327}
324 328
325static int svc_rdma_dma_map_page(struct svcxprt_rdma *rdma, 329static int svc_rdma_dma_map_page(struct svcxprt_rdma *rdma,
@@ -334,13 +338,17 @@ static int svc_rdma_dma_map_page(struct svcxprt_rdma *rdma,
334 338
335 dma_addr = ib_dma_map_page(dev, page, offset, len, DMA_TO_DEVICE); 339 dma_addr = ib_dma_map_page(dev, page, offset, len, DMA_TO_DEVICE);
336 if (ib_dma_mapping_error(dev, dma_addr)) 340 if (ib_dma_mapping_error(dev, dma_addr))
337 return -EIO; 341 goto out_maperr;
338 342
339 ctxt->sge[sge_no].addr = dma_addr; 343 ctxt->sge[sge_no].addr = dma_addr;
340 ctxt->sge[sge_no].length = len; 344 ctxt->sge[sge_no].length = len;
341 ctxt->sge[sge_no].lkey = rdma->sc_pd->local_dma_lkey; 345 ctxt->sge[sge_no].lkey = rdma->sc_pd->local_dma_lkey;
342 svc_rdma_count_mappings(rdma, ctxt); 346 svc_rdma_count_mappings(rdma, ctxt);
343 return 0; 347 return 0;
348
349out_maperr:
350 pr_err("svcrdma: failed to map page\n");
351 return -EIO;
344} 352}
345 353
346/** 354/**
@@ -547,7 +555,6 @@ static int svc_rdma_send_reply_msg(struct svcxprt_rdma *rdma,
547 return 0; 555 return 0;
548 556
549err: 557err:
550 pr_err("svcrdma: failed to post Send WR (%d)\n", ret);
551 svc_rdma_unmap_dma(ctxt); 558 svc_rdma_unmap_dma(ctxt);
552 svc_rdma_put_context(ctxt, 1); 559 svc_rdma_put_context(ctxt, 1);
553 return ret; 560 return ret;
@@ -677,7 +684,7 @@ int svc_rdma_sendto(struct svc_rqst *rqstp)
677 return 0; 684 return 0;
678 685
679 err2: 686 err2:
680 if (ret != -E2BIG) 687 if (ret != -E2BIG && ret != -EINVAL)
681 goto err1; 688 goto err1;
682 689
683 ret = svc_rdma_post_recv(rdma, GFP_KERNEL); 690 ret = svc_rdma_post_recv(rdma, GFP_KERNEL);
diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c
index a9d9cb1ba4c6..e660d4965b18 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_transport.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c
@@ -202,7 +202,6 @@ struct svc_rdma_op_ctxt *svc_rdma_get_context(struct svcxprt_rdma *xprt)
202out: 202out:
203 ctxt->count = 0; 203 ctxt->count = 0;
204 ctxt->mapped_sges = 0; 204 ctxt->mapped_sges = 0;
205 ctxt->frmr = NULL;
206 return ctxt; 205 return ctxt;
207 206
208out_empty: 207out_empty:
@@ -226,22 +225,13 @@ void svc_rdma_unmap_dma(struct svc_rdma_op_ctxt *ctxt)
226{ 225{
227 struct svcxprt_rdma *xprt = ctxt->xprt; 226 struct svcxprt_rdma *xprt = ctxt->xprt;
228 struct ib_device *device = xprt->sc_cm_id->device; 227 struct ib_device *device = xprt->sc_cm_id->device;
229 u32 lkey = xprt->sc_pd->local_dma_lkey;
230 unsigned int i; 228 unsigned int i;
231 229
232 for (i = 0; i < ctxt->mapped_sges; i++) { 230 for (i = 0; i < ctxt->mapped_sges; i++)
233 /* 231 ib_dma_unmap_page(device,
234 * Unmap the DMA addr in the SGE if the lkey matches 232 ctxt->sge[i].addr,
235 * the local_dma_lkey, otherwise, ignore it since it is 233 ctxt->sge[i].length,
236 * an FRMR lkey and will be unmapped later when the 234 ctxt->direction);
237 * last WR that uses it completes.
238 */
239 if (ctxt->sge[i].lkey == lkey)
240 ib_dma_unmap_page(device,
241 ctxt->sge[i].addr,
242 ctxt->sge[i].length,
243 ctxt->direction);
244 }
245 ctxt->mapped_sges = 0; 235 ctxt->mapped_sges = 0;
246} 236}
247 237
@@ -346,36 +336,6 @@ out:
346 svc_xprt_put(&xprt->sc_xprt); 336 svc_xprt_put(&xprt->sc_xprt);
347} 337}
348 338
349static void svc_rdma_send_wc_common(struct svcxprt_rdma *xprt,
350 struct ib_wc *wc,
351 const char *opname)
352{
353 if (wc->status != IB_WC_SUCCESS)
354 goto err;
355
356out:
357 atomic_inc(&xprt->sc_sq_avail);
358 wake_up(&xprt->sc_send_wait);
359 return;
360
361err:
362 set_bit(XPT_CLOSE, &xprt->sc_xprt.xpt_flags);
363 if (wc->status != IB_WC_WR_FLUSH_ERR)
364 pr_err("svcrdma: %s: %s (%u/0x%x)\n",
365 opname, ib_wc_status_msg(wc->status),
366 wc->status, wc->vendor_err);
367 goto out;
368}
369
370static void svc_rdma_send_wc_common_put(struct ib_cq *cq, struct ib_wc *wc,
371 const char *opname)
372{
373 struct svcxprt_rdma *xprt = cq->cq_context;
374
375 svc_rdma_send_wc_common(xprt, wc, opname);
376 svc_xprt_put(&xprt->sc_xprt);
377}
378
379/** 339/**
380 * svc_rdma_wc_send - Invoked by RDMA provider for each polled Send WC 340 * svc_rdma_wc_send - Invoked by RDMA provider for each polled Send WC
381 * @cq: completion queue 341 * @cq: completion queue
@@ -384,73 +344,28 @@ static void svc_rdma_send_wc_common_put(struct ib_cq *cq, struct ib_wc *wc,
384 */ 344 */
385void svc_rdma_wc_send(struct ib_cq *cq, struct ib_wc *wc) 345void svc_rdma_wc_send(struct ib_cq *cq, struct ib_wc *wc)
386{ 346{
387 struct ib_cqe *cqe = wc->wr_cqe;
388 struct svc_rdma_op_ctxt *ctxt;
389
390 svc_rdma_send_wc_common_put(cq, wc, "send");
391
392 ctxt = container_of(cqe, struct svc_rdma_op_ctxt, cqe);
393 svc_rdma_unmap_dma(ctxt);
394 svc_rdma_put_context(ctxt, 1);
395}
396
397/**
398 * svc_rdma_wc_reg - Invoked by RDMA provider for each polled FASTREG WC
399 * @cq: completion queue
400 * @wc: completed WR
401 *
402 */
403void svc_rdma_wc_reg(struct ib_cq *cq, struct ib_wc *wc)
404{
405 svc_rdma_send_wc_common_put(cq, wc, "fastreg");
406}
407
408/**
409 * svc_rdma_wc_read - Invoked by RDMA provider for each polled Read WC
410 * @cq: completion queue
411 * @wc: completed WR
412 *
413 */
414void svc_rdma_wc_read(struct ib_cq *cq, struct ib_wc *wc)
415{
416 struct svcxprt_rdma *xprt = cq->cq_context; 347 struct svcxprt_rdma *xprt = cq->cq_context;
417 struct ib_cqe *cqe = wc->wr_cqe; 348 struct ib_cqe *cqe = wc->wr_cqe;
418 struct svc_rdma_op_ctxt *ctxt; 349 struct svc_rdma_op_ctxt *ctxt;
419 350
420 svc_rdma_send_wc_common(xprt, wc, "read"); 351 atomic_inc(&xprt->sc_sq_avail);
352 wake_up(&xprt->sc_send_wait);
421 353
422 ctxt = container_of(cqe, struct svc_rdma_op_ctxt, cqe); 354 ctxt = container_of(cqe, struct svc_rdma_op_ctxt, cqe);
423 svc_rdma_unmap_dma(ctxt); 355 svc_rdma_unmap_dma(ctxt);
424 svc_rdma_put_frmr(xprt, ctxt->frmr); 356 svc_rdma_put_context(ctxt, 1);
425
426 if (test_bit(RDMACTXT_F_LAST_CTXT, &ctxt->flags)) {
427 struct svc_rdma_op_ctxt *read_hdr;
428
429 read_hdr = ctxt->read_hdr;
430 spin_lock(&xprt->sc_rq_dto_lock);
431 list_add_tail(&read_hdr->list,
432 &xprt->sc_read_complete_q);
433 spin_unlock(&xprt->sc_rq_dto_lock);
434 357
435 set_bit(XPT_DATA, &xprt->sc_xprt.xpt_flags); 358 if (unlikely(wc->status != IB_WC_SUCCESS)) {
436 svc_xprt_enqueue(&xprt->sc_xprt); 359 set_bit(XPT_CLOSE, &xprt->sc_xprt.xpt_flags);
360 if (wc->status != IB_WC_WR_FLUSH_ERR)
361 pr_err("svcrdma: Send: %s (%u/0x%x)\n",
362 ib_wc_status_msg(wc->status),
363 wc->status, wc->vendor_err);
437 } 364 }
438 365
439 svc_rdma_put_context(ctxt, 0);
440 svc_xprt_put(&xprt->sc_xprt); 366 svc_xprt_put(&xprt->sc_xprt);
441} 367}
442 368
443/**
444 * svc_rdma_wc_inv - Invoked by RDMA provider for each polled LOCAL_INV WC
445 * @cq: completion queue
446 * @wc: completed WR
447 *
448 */
449void svc_rdma_wc_inv(struct ib_cq *cq, struct ib_wc *wc)
450{
451 svc_rdma_send_wc_common_put(cq, wc, "localInv");
452}
453
454static struct svcxprt_rdma *rdma_create_xprt(struct svc_serv *serv, 369static struct svcxprt_rdma *rdma_create_xprt(struct svc_serv *serv,
455 int listener) 370 int listener)
456{ 371{
@@ -462,14 +377,12 @@ static struct svcxprt_rdma *rdma_create_xprt(struct svc_serv *serv,
462 INIT_LIST_HEAD(&cma_xprt->sc_accept_q); 377 INIT_LIST_HEAD(&cma_xprt->sc_accept_q);
463 INIT_LIST_HEAD(&cma_xprt->sc_rq_dto_q); 378 INIT_LIST_HEAD(&cma_xprt->sc_rq_dto_q);
464 INIT_LIST_HEAD(&cma_xprt->sc_read_complete_q); 379 INIT_LIST_HEAD(&cma_xprt->sc_read_complete_q);
465 INIT_LIST_HEAD(&cma_xprt->sc_frmr_q);
466 INIT_LIST_HEAD(&cma_xprt->sc_ctxts); 380 INIT_LIST_HEAD(&cma_xprt->sc_ctxts);
467 INIT_LIST_HEAD(&cma_xprt->sc_rw_ctxts); 381 INIT_LIST_HEAD(&cma_xprt->sc_rw_ctxts);
468 init_waitqueue_head(&cma_xprt->sc_send_wait); 382 init_waitqueue_head(&cma_xprt->sc_send_wait);
469 383
470 spin_lock_init(&cma_xprt->sc_lock); 384 spin_lock_init(&cma_xprt->sc_lock);
471 spin_lock_init(&cma_xprt->sc_rq_dto_lock); 385 spin_lock_init(&cma_xprt->sc_rq_dto_lock);
472 spin_lock_init(&cma_xprt->sc_frmr_q_lock);
473 spin_lock_init(&cma_xprt->sc_ctxt_lock); 386 spin_lock_init(&cma_xprt->sc_ctxt_lock);
474 spin_lock_init(&cma_xprt->sc_rw_ctxt_lock); 387 spin_lock_init(&cma_xprt->sc_rw_ctxt_lock);
475 388
@@ -780,86 +693,6 @@ static struct svc_xprt *svc_rdma_create(struct svc_serv *serv,
780 return ERR_PTR(ret); 693 return ERR_PTR(ret);
781} 694}
782 695
783static struct svc_rdma_fastreg_mr *rdma_alloc_frmr(struct svcxprt_rdma *xprt)
784{
785 struct ib_mr *mr;
786 struct scatterlist *sg;
787 struct svc_rdma_fastreg_mr *frmr;
788 u32 num_sg;
789
790 frmr = kmalloc(sizeof(*frmr), GFP_KERNEL);
791 if (!frmr)
792 goto err;
793
794 num_sg = min_t(u32, RPCSVC_MAXPAGES, xprt->sc_frmr_pg_list_len);
795 mr = ib_alloc_mr(xprt->sc_pd, IB_MR_TYPE_MEM_REG, num_sg);
796 if (IS_ERR(mr))
797 goto err_free_frmr;
798
799 sg = kcalloc(RPCSVC_MAXPAGES, sizeof(*sg), GFP_KERNEL);
800 if (!sg)
801 goto err_free_mr;
802
803 sg_init_table(sg, RPCSVC_MAXPAGES);
804
805 frmr->mr = mr;
806 frmr->sg = sg;
807 INIT_LIST_HEAD(&frmr->frmr_list);
808 return frmr;
809
810 err_free_mr:
811 ib_dereg_mr(mr);
812 err_free_frmr:
813 kfree(frmr);
814 err:
815 return ERR_PTR(-ENOMEM);
816}
817
818static void rdma_dealloc_frmr_q(struct svcxprt_rdma *xprt)
819{
820 struct svc_rdma_fastreg_mr *frmr;
821
822 while (!list_empty(&xprt->sc_frmr_q)) {
823 frmr = list_entry(xprt->sc_frmr_q.next,
824 struct svc_rdma_fastreg_mr, frmr_list);
825 list_del_init(&frmr->frmr_list);
826 kfree(frmr->sg);
827 ib_dereg_mr(frmr->mr);
828 kfree(frmr);
829 }
830}
831
832struct svc_rdma_fastreg_mr *svc_rdma_get_frmr(struct svcxprt_rdma *rdma)
833{
834 struct svc_rdma_fastreg_mr *frmr = NULL;
835
836 spin_lock(&rdma->sc_frmr_q_lock);
837 if (!list_empty(&rdma->sc_frmr_q)) {
838 frmr = list_entry(rdma->sc_frmr_q.next,
839 struct svc_rdma_fastreg_mr, frmr_list);
840 list_del_init(&frmr->frmr_list);
841 frmr->sg_nents = 0;
842 }
843 spin_unlock(&rdma->sc_frmr_q_lock);
844 if (frmr)
845 return frmr;
846
847 return rdma_alloc_frmr(rdma);
848}
849
850void svc_rdma_put_frmr(struct svcxprt_rdma *rdma,
851 struct svc_rdma_fastreg_mr *frmr)
852{
853 if (frmr) {
854 ib_dma_unmap_sg(rdma->sc_cm_id->device,
855 frmr->sg, frmr->sg_nents, frmr->direction);
856 spin_lock(&rdma->sc_frmr_q_lock);
857 WARN_ON_ONCE(!list_empty(&frmr->frmr_list));
858 list_add(&frmr->frmr_list, &rdma->sc_frmr_q);
859 spin_unlock(&rdma->sc_frmr_q_lock);
860 }
861}
862
863/* 696/*
864 * This is the xpo_recvfrom function for listening endpoints. Its 697 * This is the xpo_recvfrom function for listening endpoints. Its
865 * purpose is to accept incoming connections. The CMA callback handler 698 * purpose is to accept incoming connections. The CMA callback handler
@@ -908,8 +741,6 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt)
908 * capabilities of this particular device */ 741 * capabilities of this particular device */
909 newxprt->sc_max_sge = min((size_t)dev->attrs.max_sge, 742 newxprt->sc_max_sge = min((size_t)dev->attrs.max_sge,
910 (size_t)RPCSVC_MAXPAGES); 743 (size_t)RPCSVC_MAXPAGES);
911 newxprt->sc_max_sge_rd = min_t(size_t, dev->attrs.max_sge_rd,
912 RPCSVC_MAXPAGES);
913 newxprt->sc_max_req_size = svcrdma_max_req_size; 744 newxprt->sc_max_req_size = svcrdma_max_req_size;
914 newxprt->sc_max_requests = min_t(u32, dev->attrs.max_qp_wr, 745 newxprt->sc_max_requests = min_t(u32, dev->attrs.max_qp_wr,
915 svcrdma_max_requests); 746 svcrdma_max_requests);
@@ -952,7 +783,7 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt)
952 memset(&qp_attr, 0, sizeof qp_attr); 783 memset(&qp_attr, 0, sizeof qp_attr);
953 qp_attr.event_handler = qp_event_handler; 784 qp_attr.event_handler = qp_event_handler;
954 qp_attr.qp_context = &newxprt->sc_xprt; 785 qp_attr.qp_context = &newxprt->sc_xprt;
955 qp_attr.port_num = newxprt->sc_cm_id->port_num; 786 qp_attr.port_num = newxprt->sc_port_num;
956 qp_attr.cap.max_rdma_ctxs = newxprt->sc_max_requests; 787 qp_attr.cap.max_rdma_ctxs = newxprt->sc_max_requests;
957 qp_attr.cap.max_send_wr = newxprt->sc_sq_depth; 788 qp_attr.cap.max_send_wr = newxprt->sc_sq_depth;
958 qp_attr.cap.max_recv_wr = newxprt->sc_rq_depth; 789 qp_attr.cap.max_recv_wr = newxprt->sc_rq_depth;
@@ -976,47 +807,12 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt)
976 } 807 }
977 newxprt->sc_qp = newxprt->sc_cm_id->qp; 808 newxprt->sc_qp = newxprt->sc_cm_id->qp;
978 809
979 /* 810 if (!(dev->attrs.device_cap_flags & IB_DEVICE_MEM_MGT_EXTENSIONS))
980 * Use the most secure set of MR resources based on the
981 * transport type and available memory management features in
982 * the device. Here's the table implemented below:
983 *
984 * Fast Global DMA Remote WR
985 * Reg LKEY MR Access
986 * Sup'd Sup'd Needed Needed
987 *
988 * IWARP N N Y Y
989 * N Y Y Y
990 * Y N Y N
991 * Y Y N -
992 *
993 * IB N N Y N
994 * N Y N -
995 * Y N Y N
996 * Y Y N -
997 *
998 * NB: iWARP requires remote write access for the data sink
999 * of an RDMA_READ. IB does not.
1000 */
1001 newxprt->sc_reader = rdma_read_chunk_lcl;
1002 if (dev->attrs.device_cap_flags & IB_DEVICE_MEM_MGT_EXTENSIONS) {
1003 newxprt->sc_frmr_pg_list_len =
1004 dev->attrs.max_fast_reg_page_list_len;
1005 newxprt->sc_dev_caps |= SVCRDMA_DEVCAP_FAST_REG;
1006 newxprt->sc_reader = rdma_read_chunk_frmr;
1007 } else
1008 newxprt->sc_snd_w_inv = false; 811 newxprt->sc_snd_w_inv = false;
1009 812 if (!rdma_protocol_iwarp(dev, newxprt->sc_port_num) &&
1010 /* 813 !rdma_ib_or_roce(dev, newxprt->sc_port_num))
1011 * Determine if a DMA MR is required and if so, what privs are required
1012 */
1013 if (!rdma_protocol_iwarp(dev, newxprt->sc_cm_id->port_num) &&
1014 !rdma_ib_or_roce(dev, newxprt->sc_cm_id->port_num))
1015 goto errout; 814 goto errout;
1016 815
1017 if (rdma_protocol_iwarp(dev, newxprt->sc_cm_id->port_num))
1018 newxprt->sc_dev_caps |= SVCRDMA_DEVCAP_READ_W_INV;
1019
1020 /* Post receive buffers */ 816 /* Post receive buffers */
1021 for (i = 0; i < newxprt->sc_max_requests; i++) { 817 for (i = 0; i < newxprt->sc_max_requests; i++) {
1022 ret = svc_rdma_post_recv(newxprt, GFP_KERNEL); 818 ret = svc_rdma_post_recv(newxprt, GFP_KERNEL);
@@ -1056,7 +852,6 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt)
1056 sap = (struct sockaddr *)&newxprt->sc_cm_id->route.addr.dst_addr; 852 sap = (struct sockaddr *)&newxprt->sc_cm_id->route.addr.dst_addr;
1057 dprintk(" remote address : %pIS:%u\n", sap, rpc_get_port(sap)); 853 dprintk(" remote address : %pIS:%u\n", sap, rpc_get_port(sap));
1058 dprintk(" max_sge : %d\n", newxprt->sc_max_sge); 854 dprintk(" max_sge : %d\n", newxprt->sc_max_sge);
1059 dprintk(" max_sge_rd : %d\n", newxprt->sc_max_sge_rd);
1060 dprintk(" sq_depth : %d\n", newxprt->sc_sq_depth); 855 dprintk(" sq_depth : %d\n", newxprt->sc_sq_depth);
1061 dprintk(" max_requests : %d\n", newxprt->sc_max_requests); 856 dprintk(" max_requests : %d\n", newxprt->sc_max_requests);
1062 dprintk(" ord : %d\n", newxprt->sc_ord); 857 dprintk(" ord : %d\n", newxprt->sc_ord);
@@ -1117,12 +912,6 @@ static void __svc_rdma_free(struct work_struct *work)
1117 pr_err("svcrdma: sc_xprt still in use? (%d)\n", 912 pr_err("svcrdma: sc_xprt still in use? (%d)\n",
1118 kref_read(&xprt->xpt_ref)); 913 kref_read(&xprt->xpt_ref));
1119 914
1120 /*
1121 * Destroy queued, but not processed read completions. Note
1122 * that this cleanup has to be done before destroying the
1123 * cm_id because the device ptr is needed to unmap the dma in
1124 * svc_rdma_put_context.
1125 */
1126 while (!list_empty(&rdma->sc_read_complete_q)) { 915 while (!list_empty(&rdma->sc_read_complete_q)) {
1127 struct svc_rdma_op_ctxt *ctxt; 916 struct svc_rdma_op_ctxt *ctxt;
1128 ctxt = list_first_entry(&rdma->sc_read_complete_q, 917 ctxt = list_first_entry(&rdma->sc_read_complete_q,
@@ -1130,8 +919,6 @@ static void __svc_rdma_free(struct work_struct *work)
1130 list_del(&ctxt->list); 919 list_del(&ctxt->list);
1131 svc_rdma_put_context(ctxt, 1); 920 svc_rdma_put_context(ctxt, 1);
1132 } 921 }
1133
1134 /* Destroy queued, but not processed recv completions */
1135 while (!list_empty(&rdma->sc_rq_dto_q)) { 922 while (!list_empty(&rdma->sc_rq_dto_q)) {
1136 struct svc_rdma_op_ctxt *ctxt; 923 struct svc_rdma_op_ctxt *ctxt;
1137 ctxt = list_first_entry(&rdma->sc_rq_dto_q, 924 ctxt = list_first_entry(&rdma->sc_rq_dto_q,
@@ -1151,7 +938,6 @@ static void __svc_rdma_free(struct work_struct *work)
1151 xprt->xpt_bc_xprt = NULL; 938 xprt->xpt_bc_xprt = NULL;
1152 } 939 }
1153 940
1154 rdma_dealloc_frmr_q(rdma);
1155 svc_rdma_destroy_rw_ctxts(rdma); 941 svc_rdma_destroy_rw_ctxts(rdma);
1156 svc_rdma_destroy_ctxts(rdma); 942 svc_rdma_destroy_ctxts(rdma);
1157 943