aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2010-12-14 09:59:29 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2010-12-16 12:37:25 -0500
commitbf2695516db982e90a22fc94f93491b481796bb1 (patch)
tree367bf134ef892bfc3fcd2c4fe676b14102d97467 /fs
parent9f06c719f474be7003763284a990bed6377bb0d4 (diff)
SUNRPC: New xdr_streams XDR decoder API
Now that all client-side XDR decoder routines use xdr_streams, there should be no need to support the legacy calling sequence [rpc_rqst *, __be32 *, RPC res *] anywhere. We can construct an xdr_stream in the generic RPC code, instead of in each decoder function. This is a refactoring change. It should not cause different behavior. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Tested-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/lockd/clnt4xdr.c20
-rw-r--r--fs/lockd/clntxdr.c20
-rw-r--r--fs/lockd/mon.c30
-rw-r--r--fs/nfs/mount_clnt.c30
-rw-r--r--fs/nfs/nfs2xdr.c68
-rw-r--r--fs/nfs/nfs3xdr.c195
-rw-r--r--fs/nfs/nfs4xdr.c619
-rw-r--r--fs/nfsd/nfs4callback.c16
8 files changed, 468 insertions, 530 deletions
diff --git a/fs/lockd/clnt4xdr.c b/fs/lockd/clnt4xdr.c
index 974f1d9cd323..f848b52c67b1 100644
--- a/fs/lockd/clnt4xdr.c
+++ b/fs/lockd/clnt4xdr.c
@@ -529,17 +529,16 @@ out:
529 return error; 529 return error;
530} 530}
531 531
532static int nlm4_xdr_dec_testres(struct rpc_rqst *req, __be32 *p, 532static int nlm4_xdr_dec_testres(struct rpc_rqst *req,
533 struct xdr_stream *xdr,
533 struct nlm_res *result) 534 struct nlm_res *result)
534{ 535{
535 struct xdr_stream xdr;
536 int error; 536 int error;
537 537
538 xdr_init_decode(&xdr, &req->rq_rcv_buf, p); 538 error = decode_cookie(xdr, &result->cookie);
539 error = decode_cookie(&xdr, &result->cookie);
540 if (unlikely(error)) 539 if (unlikely(error))
541 goto out; 540 goto out;
542 error = decode_nlm4_testrply(&xdr, result); 541 error = decode_nlm4_testrply(xdr, result);
543out: 542out:
544 return error; 543 return error;
545} 544}
@@ -550,17 +549,16 @@ out:
550 * nlm4_stat stat; 549 * nlm4_stat stat;
551 * }; 550 * };
552 */ 551 */
553static int nlm4_xdr_dec_res(struct rpc_rqst *req, __be32 *p, 552static int nlm4_xdr_dec_res(struct rpc_rqst *req,
553 struct xdr_stream *xdr,
554 struct nlm_res *result) 554 struct nlm_res *result)
555{ 555{
556 struct xdr_stream xdr;
557 int error; 556 int error;
558 557
559 xdr_init_decode(&xdr, &req->rq_rcv_buf, p); 558 error = decode_cookie(xdr, &result->cookie);
560 error = decode_cookie(&xdr, &result->cookie);
561 if (unlikely(error)) 559 if (unlikely(error))
562 goto out; 560 goto out;
563 error = decode_nlm4_stat(&xdr, &result->status); 561 error = decode_nlm4_stat(xdr, &result->status);
564out: 562out:
565 return error; 563 return error;
566} 564}
@@ -575,7 +573,7 @@ out:
575[NLMPROC_##proc] = { \ 573[NLMPROC_##proc] = { \
576 .p_proc = NLMPROC_##proc, \ 574 .p_proc = NLMPROC_##proc, \
577 .p_encode = (kxdreproc_t)nlm4_xdr_enc_##argtype, \ 575 .p_encode = (kxdreproc_t)nlm4_xdr_enc_##argtype, \
578 .p_decode = (kxdrproc_t)nlm4_xdr_dec_##restype, \ 576 .p_decode = (kxdrdproc_t)nlm4_xdr_dec_##restype, \
579 .p_arglen = NLM4_##argtype##_sz, \ 577 .p_arglen = NLM4_##argtype##_sz, \
580 .p_replen = NLM4_##restype##_sz, \ 578 .p_replen = NLM4_##restype##_sz, \
581 .p_statidx = NLMPROC_##proc, \ 579 .p_statidx = NLMPROC_##proc, \
diff --git a/fs/lockd/clntxdr.c b/fs/lockd/clntxdr.c
index c6fda8fb1c5b..180ac34feb9a 100644
--- a/fs/lockd/clntxdr.c
+++ b/fs/lockd/clntxdr.c
@@ -527,17 +527,16 @@ out:
527 return error; 527 return error;
528} 528}
529 529
530static int nlm_xdr_dec_testres(struct rpc_rqst *req, __be32 *p, 530static int nlm_xdr_dec_testres(struct rpc_rqst *req,
531 struct xdr_stream *xdr,
531 struct nlm_res *result) 532 struct nlm_res *result)
532{ 533{
533 struct xdr_stream xdr;
534 int error; 534 int error;
535 535
536 xdr_init_decode(&xdr, &req->rq_rcv_buf, p); 536 error = decode_cookie(xdr, &result->cookie);
537 error = decode_cookie(&xdr, &result->cookie);
538 if (unlikely(error)) 537 if (unlikely(error))
539 goto out; 538 goto out;
540 error = decode_nlm_testrply(&xdr, result); 539 error = decode_nlm_testrply(xdr, result);
541out: 540out:
542 return error; 541 return error;
543} 542}
@@ -548,17 +547,16 @@ out:
548 * nlm_stat stat; 547 * nlm_stat stat;
549 * }; 548 * };
550 */ 549 */
551static int nlm_xdr_dec_res(struct rpc_rqst *req, __be32 *p, 550static int nlm_xdr_dec_res(struct rpc_rqst *req,
551 struct xdr_stream *xdr,
552 struct nlm_res *result) 552 struct nlm_res *result)
553{ 553{
554 struct xdr_stream xdr;
555 int error; 554 int error;
556 555
557 xdr_init_decode(&xdr, &req->rq_rcv_buf, p); 556 error = decode_cookie(xdr, &result->cookie);
558 error = decode_cookie(&xdr, &result->cookie);
559 if (unlikely(error)) 557 if (unlikely(error))
560 goto out; 558 goto out;
561 error = decode_nlm_stat(&xdr, &result->status); 559 error = decode_nlm_stat(xdr, &result->status);
562out: 560out:
563 return error; 561 return error;
564} 562}
@@ -573,7 +571,7 @@ out:
573[NLMPROC_##proc] = { \ 571[NLMPROC_##proc] = { \
574 .p_proc = NLMPROC_##proc, \ 572 .p_proc = NLMPROC_##proc, \
575 .p_encode = (kxdreproc_t)nlm_xdr_enc_##argtype, \ 573 .p_encode = (kxdreproc_t)nlm_xdr_enc_##argtype, \
576 .p_decode = (kxdrproc_t)nlm_xdr_dec_##restype, \ 574 .p_decode = (kxdrdproc_t)nlm_xdr_dec_##restype, \
577 .p_arglen = NLM_##argtype##_sz, \ 575 .p_arglen = NLM_##argtype##_sz, \
578 .p_replen = NLM_##restype##_sz, \ 576 .p_replen = NLM_##restype##_sz, \
579 .p_statidx = NLMPROC_##proc, \ 577 .p_statidx = NLMPROC_##proc, \
diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c
index baa77bc9d825..23d7451b2938 100644
--- a/fs/lockd/mon.c
+++ b/fs/lockd/mon.c
@@ -472,35 +472,35 @@ static void nsm_xdr_enc_unmon(struct rpc_rqst *req, struct xdr_stream *xdr,
472 encode_mon_id(xdr, argp); 472 encode_mon_id(xdr, argp);
473} 473}
474 474
475static int xdr_dec_stat_res(struct rpc_rqst *rqstp, __be32 *p, 475static int nsm_xdr_dec_stat_res(struct rpc_rqst *rqstp,
476 struct nsm_res *resp) 476 struct xdr_stream *xdr,
477 struct nsm_res *resp)
477{ 478{
478 struct xdr_stream xdr; 479 __be32 *p;
479 480
480 xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); 481 p = xdr_inline_decode(xdr, 4 + 4);
481 p = xdr_inline_decode(&xdr, 4 + 4);
482 if (unlikely(p == NULL)) 482 if (unlikely(p == NULL))
483 return -EIO; 483 return -EIO;
484 resp->status = be32_to_cpup(p++); 484 resp->status = be32_to_cpup(p++);
485 resp->state = be32_to_cpup(p); 485 resp->state = be32_to_cpup(p);
486 486
487 dprintk("lockd: xdr_dec_stat_res status %d state %d\n", 487 dprintk("lockd: %s status %d state %d\n",
488 resp->status, resp->state); 488 __func__, resp->status, resp->state);
489 return 0; 489 return 0;
490} 490}
491 491
492static int xdr_dec_stat(struct rpc_rqst *rqstp, __be32 *p, 492static int nsm_xdr_dec_stat(struct rpc_rqst *rqstp,
493 struct nsm_res *resp) 493 struct xdr_stream *xdr,
494 struct nsm_res *resp)
494{ 495{
495 struct xdr_stream xdr; 496 __be32 *p;
496 497
497 xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); 498 p = xdr_inline_decode(xdr, 4);
498 p = xdr_inline_decode(&xdr, 4);
499 if (unlikely(p == NULL)) 499 if (unlikely(p == NULL))
500 return -EIO; 500 return -EIO;
501 resp->state = be32_to_cpup(p); 501 resp->state = be32_to_cpup(p);
502 502
503 dprintk("lockd: xdr_dec_stat state %d\n", resp->state); 503 dprintk("lockd: %s state %d\n", __func__, resp->state);
504 return 0; 504 return 0;
505} 505}
506 506
@@ -517,7 +517,7 @@ static struct rpc_procinfo nsm_procedures[] = {
517[NSMPROC_MON] = { 517[NSMPROC_MON] = {
518 .p_proc = NSMPROC_MON, 518 .p_proc = NSMPROC_MON,
519 .p_encode = (kxdreproc_t)nsm_xdr_enc_mon, 519 .p_encode = (kxdreproc_t)nsm_xdr_enc_mon,
520 .p_decode = (kxdrproc_t)xdr_dec_stat_res, 520 .p_decode = (kxdrdproc_t)nsm_xdr_dec_stat_res,
521 .p_arglen = SM_mon_sz, 521 .p_arglen = SM_mon_sz,
522 .p_replen = SM_monres_sz, 522 .p_replen = SM_monres_sz,
523 .p_statidx = NSMPROC_MON, 523 .p_statidx = NSMPROC_MON,
@@ -526,7 +526,7 @@ static struct rpc_procinfo nsm_procedures[] = {
526[NSMPROC_UNMON] = { 526[NSMPROC_UNMON] = {
527 .p_proc = NSMPROC_UNMON, 527 .p_proc = NSMPROC_UNMON,
528 .p_encode = (kxdreproc_t)nsm_xdr_enc_unmon, 528 .p_encode = (kxdreproc_t)nsm_xdr_enc_unmon,
529 .p_decode = (kxdrproc_t)xdr_dec_stat, 529 .p_decode = (kxdrdproc_t)nsm_xdr_dec_stat,
530 .p_arglen = SM_mon_id_sz, 530 .p_arglen = SM_mon_id_sz,
531 .p_replen = SM_unmonres_sz, 531 .p_replen = SM_unmonres_sz,
532 .p_statidx = NSMPROC_UNMON, 532 .p_statidx = NSMPROC_UNMON,
diff --git a/fs/nfs/mount_clnt.c b/fs/nfs/mount_clnt.c
index 979ebd7af3cb..697e07235f30 100644
--- a/fs/nfs/mount_clnt.c
+++ b/fs/nfs/mount_clnt.c
@@ -340,18 +340,16 @@ static int decode_fhandle(struct xdr_stream *xdr, struct mountres *res)
340 return 0; 340 return 0;
341} 341}
342 342
343static int mnt_dec_mountres(struct rpc_rqst *req, __be32 *p, 343static int mnt_xdr_dec_mountres(struct rpc_rqst *req,
344 struct mountres *res) 344 struct xdr_stream *xdr,
345 struct mountres *res)
345{ 346{
346 struct xdr_stream xdr;
347 int status; 347 int status;
348 348
349 xdr_init_decode(&xdr, &req->rq_rcv_buf, p); 349 status = decode_status(xdr, res);
350
351 status = decode_status(&xdr, res);
352 if (unlikely(status != 0 || res->errno != 0)) 350 if (unlikely(status != 0 || res->errno != 0))
353 return status; 351 return status;
354 return decode_fhandle(&xdr, res); 352 return decode_fhandle(xdr, res);
355} 353}
356 354
357static int decode_fhs_status(struct xdr_stream *xdr, struct mountres *res) 355static int decode_fhs_status(struct xdr_stream *xdr, struct mountres *res)
@@ -434,30 +432,28 @@ static int decode_auth_flavors(struct xdr_stream *xdr, struct mountres *res)
434 return 0; 432 return 0;
435} 433}
436 434
437static int mnt_dec_mountres3(struct rpc_rqst *req, __be32 *p, 435static int mnt_xdr_dec_mountres3(struct rpc_rqst *req,
438 struct mountres *res) 436 struct xdr_stream *xdr,
437 struct mountres *res)
439{ 438{
440 struct xdr_stream xdr;
441 int status; 439 int status;
442 440
443 xdr_init_decode(&xdr, &req->rq_rcv_buf, p); 441 status = decode_fhs_status(xdr, res);
444
445 status = decode_fhs_status(&xdr, res);
446 if (unlikely(status != 0 || res->errno != 0)) 442 if (unlikely(status != 0 || res->errno != 0))
447 return status; 443 return status;
448 status = decode_fhandle3(&xdr, res); 444 status = decode_fhandle3(xdr, res);
449 if (unlikely(status != 0)) { 445 if (unlikely(status != 0)) {
450 res->errno = -EBADHANDLE; 446 res->errno = -EBADHANDLE;
451 return 0; 447 return 0;
452 } 448 }
453 return decode_auth_flavors(&xdr, res); 449 return decode_auth_flavors(xdr, res);
454} 450}
455 451
456static struct rpc_procinfo mnt_procedures[] = { 452static struct rpc_procinfo mnt_procedures[] = {
457 [MOUNTPROC_MNT] = { 453 [MOUNTPROC_MNT] = {
458 .p_proc = MOUNTPROC_MNT, 454 .p_proc = MOUNTPROC_MNT,
459 .p_encode = (kxdreproc_t)mnt_xdr_enc_dirpath, 455 .p_encode = (kxdreproc_t)mnt_xdr_enc_dirpath,
460 .p_decode = (kxdrproc_t)mnt_dec_mountres, 456 .p_decode = (kxdrdproc_t)mnt_xdr_dec_mountres,
461 .p_arglen = MNT_enc_dirpath_sz, 457 .p_arglen = MNT_enc_dirpath_sz,
462 .p_replen = MNT_dec_mountres_sz, 458 .p_replen = MNT_dec_mountres_sz,
463 .p_statidx = MOUNTPROC_MNT, 459 .p_statidx = MOUNTPROC_MNT,
@@ -476,7 +472,7 @@ static struct rpc_procinfo mnt3_procedures[] = {
476 [MOUNTPROC3_MNT] = { 472 [MOUNTPROC3_MNT] = {
477 .p_proc = MOUNTPROC3_MNT, 473 .p_proc = MOUNTPROC3_MNT,
478 .p_encode = (kxdreproc_t)mnt_xdr_enc_dirpath, 474 .p_encode = (kxdreproc_t)mnt_xdr_enc_dirpath,
479 .p_decode = (kxdrproc_t)mnt_dec_mountres3, 475 .p_decode = (kxdrdproc_t)mnt_xdr_dec_mountres3,
480 .p_arglen = MNT_enc_dirpath_sz, 476 .p_arglen = MNT_enc_dirpath_sz,
481 .p_replen = MNT_dec_mountres3_sz, 477 .p_replen = MNT_dec_mountres3_sz,
482 .p_statidx = MOUNTPROC3_MNT, 478 .p_statidx = MOUNTPROC3_MNT,
diff --git a/fs/nfs/nfs2xdr.c b/fs/nfs/nfs2xdr.c
index 8f3acbec761f..51f1cfa04d27 100644
--- a/fs/nfs/nfs2xdr.c
+++ b/fs/nfs/nfs2xdr.c
@@ -783,15 +783,13 @@ static void nfs2_xdr_enc_readdirargs(struct rpc_rqst *req,
783 * "NFS: Network File System Protocol Specification". 783 * "NFS: Network File System Protocol Specification".
784 */ 784 */
785 785
786static int nfs2_xdr_dec_stat(struct rpc_rqst *req, __be32 *p, 786static int nfs2_xdr_dec_stat(struct rpc_rqst *req, struct xdr_stream *xdr,
787 void *__unused) 787 void *__unused)
788{ 788{
789 struct xdr_stream xdr;
790 enum nfs_stat status; 789 enum nfs_stat status;
791 int error; 790 int error;
792 791
793 xdr_init_decode(&xdr, &req->rq_rcv_buf, p); 792 error = decode_stat(xdr, &status);
794 error = decode_stat(&xdr, &status);
795 if (unlikely(error)) 793 if (unlikely(error))
796 goto out; 794 goto out;
797 if (status != NFS_OK) 795 if (status != NFS_OK)
@@ -802,22 +800,16 @@ out_default:
802 return nfs_stat_to_errno(status); 800 return nfs_stat_to_errno(status);
803} 801}
804 802
805static int nfs2_xdr_dec_attrstat(struct rpc_rqst *req, __be32 *p, 803static int nfs2_xdr_dec_attrstat(struct rpc_rqst *req, struct xdr_stream *xdr,
806 struct nfs_fattr *result) 804 struct nfs_fattr *result)
807{ 805{
808 struct xdr_stream xdr; 806 return decode_attrstat(xdr, result);
809
810 xdr_init_decode(&xdr, &req->rq_rcv_buf, p);
811 return decode_attrstat(&xdr, result);
812} 807}
813 808
814static int nfs2_xdr_dec_diropres(struct rpc_rqst *req, __be32 *p, 809static int nfs2_xdr_dec_diropres(struct rpc_rqst *req, struct xdr_stream *xdr,
815 struct nfs_diropok *result) 810 struct nfs_diropok *result)
816{ 811{
817 struct xdr_stream xdr; 812 return decode_diropres(xdr, result);
818
819 xdr_init_decode(&xdr, &req->rq_rcv_buf, p);
820 return decode_diropres(&xdr, result);
821} 813}
822 814
823/* 815/*
@@ -830,20 +822,18 @@ static int nfs2_xdr_dec_diropres(struct rpc_rqst *req, __be32 *p,
830 * void; 822 * void;
831 * }; 823 * };
832 */ 824 */
833static int nfs2_xdr_dec_readlinkres(struct rpc_rqst *req, __be32 *p, 825static int nfs2_xdr_dec_readlinkres(struct rpc_rqst *req,
834 void *__unused) 826 struct xdr_stream *xdr, void *__unused)
835{ 827{
836 struct xdr_stream xdr;
837 enum nfs_stat status; 828 enum nfs_stat status;
838 int error; 829 int error;
839 830
840 xdr_init_decode(&xdr, &req->rq_rcv_buf, p); 831 error = decode_stat(xdr, &status);
841 error = decode_stat(&xdr, &status);
842 if (unlikely(error)) 832 if (unlikely(error))
843 goto out; 833 goto out;
844 if (status != NFS_OK) 834 if (status != NFS_OK)
845 goto out_default; 835 goto out_default;
846 error = decode_path(&xdr); 836 error = decode_path(xdr);
847out: 837out:
848 return error; 838 return error;
849out_default: 839out_default:
@@ -861,39 +851,33 @@ out_default:
861 * void; 851 * void;
862 * }; 852 * };
863 */ 853 */
864static int nfs2_xdr_dec_readres(struct rpc_rqst *req, __be32 *p, 854static int nfs2_xdr_dec_readres(struct rpc_rqst *req, struct xdr_stream *xdr,
865 struct nfs_readres *result) 855 struct nfs_readres *result)
866{ 856{
867 struct xdr_stream xdr;
868 enum nfs_stat status; 857 enum nfs_stat status;
869 int error; 858 int error;
870 859
871 xdr_init_decode(&xdr, &req->rq_rcv_buf, p); 860 error = decode_stat(xdr, &status);
872 error = decode_stat(&xdr, &status);
873 if (unlikely(error)) 861 if (unlikely(error))
874 goto out; 862 goto out;
875 if (status != NFS_OK) 863 if (status != NFS_OK)
876 goto out_default; 864 goto out_default;
877 error = decode_fattr(&xdr, result->fattr); 865 error = decode_fattr(xdr, result->fattr);
878 if (unlikely(error)) 866 if (unlikely(error))
879 goto out; 867 goto out;
880 error = decode_nfsdata(&xdr, result); 868 error = decode_nfsdata(xdr, result);
881out: 869out:
882 return error; 870 return error;
883out_default: 871out_default:
884 return nfs_stat_to_errno(status); 872 return nfs_stat_to_errno(status);
885} 873}
886 874
887static int nfs2_xdr_dec_writeres(struct rpc_rqst *req, __be32 *p, 875static int nfs2_xdr_dec_writeres(struct rpc_rqst *req, struct xdr_stream *xdr,
888 struct nfs_writeres *result) 876 struct nfs_writeres *result)
889{ 877{
890 struct xdr_stream xdr;
891
892 /* All NFSv2 writes are "file sync" writes */ 878 /* All NFSv2 writes are "file sync" writes */
893 result->verf->committed = NFS_FILE_SYNC; 879 result->verf->committed = NFS_FILE_SYNC;
894 880 return decode_attrstat(xdr, result->fattr);
895 xdr_init_decode(&xdr, &req->rq_rcv_buf, p);
896 return decode_attrstat(&xdr, result->fattr);
897} 881}
898 882
899/** 883/**
@@ -1008,20 +992,18 @@ out_cheating:
1008 goto out; 992 goto out;
1009} 993}
1010 994
1011static int nfs2_xdr_dec_readdirres(struct rpc_rqst *req, __be32 *p, 995static int nfs2_xdr_dec_readdirres(struct rpc_rqst *req,
1012 void *__unused) 996 struct xdr_stream *xdr, void *__unused)
1013{ 997{
1014 struct xdr_stream xdr;
1015 enum nfs_stat status; 998 enum nfs_stat status;
1016 int error; 999 int error;
1017 1000
1018 xdr_init_decode(&xdr, &req->rq_rcv_buf, p); 1001 error = decode_stat(xdr, &status);
1019 error = decode_stat(&xdr, &status);
1020 if (unlikely(error)) 1002 if (unlikely(error))
1021 goto out; 1003 goto out;
1022 if (status != NFS_OK) 1004 if (status != NFS_OK)
1023 goto out_default; 1005 goto out_default;
1024 error = decode_readdirok(&xdr); 1006 error = decode_readdirok(xdr);
1025out: 1007out:
1026 return error; 1008 return error;
1027out_default: 1009out_default:
@@ -1062,20 +1044,18 @@ out_overflow:
1062 return -EIO; 1044 return -EIO;
1063} 1045}
1064 1046
1065static int nfs2_xdr_dec_statfsres(struct rpc_rqst *req, __be32 *p, 1047static int nfs2_xdr_dec_statfsres(struct rpc_rqst *req, struct xdr_stream *xdr,
1066 struct nfs2_fsstat *result) 1048 struct nfs2_fsstat *result)
1067{ 1049{
1068 struct xdr_stream xdr;
1069 enum nfs_stat status; 1050 enum nfs_stat status;
1070 int error; 1051 int error;
1071 1052
1072 xdr_init_decode(&xdr, &req->rq_rcv_buf, p); 1053 error = decode_stat(xdr, &status);
1073 error = decode_stat(&xdr, &status);
1074 if (unlikely(error)) 1054 if (unlikely(error))
1075 goto out; 1055 goto out;
1076 if (status != NFS_OK) 1056 if (status != NFS_OK)
1077 goto out_default; 1057 goto out_default;
1078 error = decode_info(&xdr, result); 1058 error = decode_info(xdr, result);
1079out: 1059out:
1080 return error; 1060 return error;
1081out_default: 1061out_default:
@@ -1150,7 +1130,7 @@ int nfs_stat_to_errno(enum nfs_stat status)
1150[NFSPROC_##proc] = { \ 1130[NFSPROC_##proc] = { \
1151 .p_proc = NFSPROC_##proc, \ 1131 .p_proc = NFSPROC_##proc, \
1152 .p_encode = (kxdreproc_t)nfs2_xdr_enc_##argtype, \ 1132 .p_encode = (kxdreproc_t)nfs2_xdr_enc_##argtype, \
1153 .p_decode = (kxdrproc_t)nfs2_xdr_dec_##restype, \ 1133 .p_decode = (kxdrdproc_t)nfs2_xdr_dec_##restype, \
1154 .p_arglen = NFS_##argtype##_sz, \ 1134 .p_arglen = NFS_##argtype##_sz, \
1155 .p_replen = NFS_##restype##_sz, \ 1135 .p_replen = NFS_##restype##_sz, \
1156 .p_timer = timer, \ 1136 .p_timer = timer, \
diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c
index ae1b1a43f05e..df30a26cc4fa 100644
--- a/fs/nfs/nfs3xdr.c
+++ b/fs/nfs/nfs3xdr.c
@@ -1366,20 +1366,19 @@ static void nfs3_xdr_enc_setacl3args(struct rpc_rqst *req,
1366 * void; 1366 * void;
1367 * }; 1367 * };
1368 */ 1368 */
1369static int nfs3_xdr_dec_getattr3res(struct rpc_rqst *req, __be32 *p, 1369static int nfs3_xdr_dec_getattr3res(struct rpc_rqst *req,
1370 struct xdr_stream *xdr,
1370 struct nfs_fattr *result) 1371 struct nfs_fattr *result)
1371{ 1372{
1372 struct xdr_stream xdr;
1373 enum nfs_stat status; 1373 enum nfs_stat status;
1374 int error; 1374 int error;
1375 1375
1376 xdr_init_decode(&xdr, &req->rq_rcv_buf, p); 1376 error = decode_nfsstat3(xdr, &status);
1377 error = decode_nfsstat3(&xdr, &status);
1378 if (unlikely(error)) 1377 if (unlikely(error))
1379 goto out; 1378 goto out;
1380 if (status != NFS3_OK) 1379 if (status != NFS3_OK)
1381 goto out_default; 1380 goto out_default;
1382 error = decode_fattr3(&xdr, result); 1381 error = decode_fattr3(xdr, result);
1383out: 1382out:
1384 return error; 1383 return error;
1385out_default: 1384out_default:
@@ -1404,18 +1403,17 @@ out_default:
1404 * SETATTR3resfail resfail; 1403 * SETATTR3resfail resfail;
1405 * }; 1404 * };
1406 */ 1405 */
1407static int nfs3_xdr_dec_setattr3res(struct rpc_rqst *req, __be32 *p, 1406static int nfs3_xdr_dec_setattr3res(struct rpc_rqst *req,
1407 struct xdr_stream *xdr,
1408 struct nfs_fattr *result) 1408 struct nfs_fattr *result)
1409{ 1409{
1410 struct xdr_stream xdr;
1411 enum nfs_stat status; 1410 enum nfs_stat status;
1412 int error; 1411 int error;
1413 1412
1414 xdr_init_decode(&xdr, &req->rq_rcv_buf, p); 1413 error = decode_nfsstat3(xdr, &status);
1415 error = decode_nfsstat3(&xdr, &status);
1416 if (unlikely(error)) 1414 if (unlikely(error))
1417 goto out; 1415 goto out;
1418 error = decode_wcc_data(&xdr, result); 1416 error = decode_wcc_data(xdr, result);
1419 if (unlikely(error)) 1417 if (unlikely(error))
1420 goto out; 1418 goto out;
1421 if (status != NFS3_OK) 1419 if (status != NFS3_OK)
@@ -1446,30 +1444,29 @@ out_status:
1446 * LOOKUP3resfail resfail; 1444 * LOOKUP3resfail resfail;
1447 * }; 1445 * };
1448 */ 1446 */
1449static int nfs3_xdr_dec_lookup3res(struct rpc_rqst *req, __be32 *p, 1447static int nfs3_xdr_dec_lookup3res(struct rpc_rqst *req,
1448 struct xdr_stream *xdr,
1450 struct nfs3_diropres *result) 1449 struct nfs3_diropres *result)
1451{ 1450{
1452 struct xdr_stream xdr;
1453 enum nfs_stat status; 1451 enum nfs_stat status;
1454 int error; 1452 int error;
1455 1453
1456 xdr_init_decode(&xdr, &req->rq_rcv_buf, p); 1454 error = decode_nfsstat3(xdr, &status);
1457 error = decode_nfsstat3(&xdr, &status);
1458 if (unlikely(error)) 1455 if (unlikely(error))
1459 goto out; 1456 goto out;
1460 if (status != NFS3_OK) 1457 if (status != NFS3_OK)
1461 goto out_default; 1458 goto out_default;
1462 error = decode_nfs_fh3(&xdr, result->fh); 1459 error = decode_nfs_fh3(xdr, result->fh);
1463 if (unlikely(error)) 1460 if (unlikely(error))
1464 goto out; 1461 goto out;
1465 error = decode_post_op_attr(&xdr, result->fattr); 1462 error = decode_post_op_attr(xdr, result->fattr);
1466 if (unlikely(error)) 1463 if (unlikely(error))
1467 goto out; 1464 goto out;
1468 error = decode_post_op_attr(&xdr, result->dir_attr); 1465 error = decode_post_op_attr(xdr, result->dir_attr);
1469out: 1466out:
1470 return error; 1467 return error;
1471out_default: 1468out_default:
1472 error = decode_post_op_attr(&xdr, result->dir_attr); 1469 error = decode_post_op_attr(xdr, result->dir_attr);
1473 if (unlikely(error)) 1470 if (unlikely(error))
1474 goto out; 1471 goto out;
1475 return nfs_stat_to_errno(status); 1472 return nfs_stat_to_errno(status);
@@ -1494,23 +1491,22 @@ out_default:
1494 * ACCESS3resfail resfail; 1491 * ACCESS3resfail resfail;
1495 * }; 1492 * };
1496 */ 1493 */
1497static int nfs3_xdr_dec_access3res(struct rpc_rqst *req, __be32 *p, 1494static int nfs3_xdr_dec_access3res(struct rpc_rqst *req,
1495 struct xdr_stream *xdr,
1498 struct nfs3_accessres *result) 1496 struct nfs3_accessres *result)
1499{ 1497{
1500 struct xdr_stream xdr;
1501 enum nfs_stat status; 1498 enum nfs_stat status;
1502 int error; 1499 int error;
1503 1500
1504 xdr_init_decode(&xdr, &req->rq_rcv_buf, p); 1501 error = decode_nfsstat3(xdr, &status);
1505 error = decode_nfsstat3(&xdr, &status);
1506 if (unlikely(error)) 1502 if (unlikely(error))
1507 goto out; 1503 goto out;
1508 error = decode_post_op_attr(&xdr, result->fattr); 1504 error = decode_post_op_attr(xdr, result->fattr);
1509 if (unlikely(error)) 1505 if (unlikely(error))
1510 goto out; 1506 goto out;
1511 if (status != NFS3_OK) 1507 if (status != NFS3_OK)
1512 goto out_default; 1508 goto out_default;
1513 error = decode_uint32(&xdr, &result->access); 1509 error = decode_uint32(xdr, &result->access);
1514out: 1510out:
1515 return error; 1511 return error;
1516out_default: 1512out_default:
@@ -1536,23 +1532,22 @@ out_default:
1536 * READLINK3resfail resfail; 1532 * READLINK3resfail resfail;
1537 * }; 1533 * };
1538 */ 1534 */
1539static int nfs3_xdr_dec_readlink3res(struct rpc_rqst *req, __be32 *p, 1535static int nfs3_xdr_dec_readlink3res(struct rpc_rqst *req,
1536 struct xdr_stream *xdr,
1540 struct nfs_fattr *result) 1537 struct nfs_fattr *result)
1541{ 1538{
1542 struct xdr_stream xdr;
1543 enum nfs_stat status; 1539 enum nfs_stat status;
1544 int error; 1540 int error;
1545 1541
1546 xdr_init_decode(&xdr, &req->rq_rcv_buf, p); 1542 error = decode_nfsstat3(xdr, &status);
1547 error = decode_nfsstat3(&xdr, &status);
1548 if (unlikely(error)) 1543 if (unlikely(error))
1549 goto out; 1544 goto out;
1550 error = decode_post_op_attr(&xdr, result); 1545 error = decode_post_op_attr(xdr, result);
1551 if (unlikely(error)) 1546 if (unlikely(error))
1552 goto out; 1547 goto out;
1553 if (status != NFS3_OK) 1548 if (status != NFS3_OK)
1554 goto out_default; 1549 goto out_default;
1555 error = decode_nfspath3(&xdr); 1550 error = decode_nfspath3(xdr);
1556out: 1551out:
1557 return error; 1552 return error;
1558out_default: 1553out_default:
@@ -1620,23 +1615,21 @@ out_overflow:
1620 return -EIO; 1615 return -EIO;
1621} 1616}
1622 1617
1623static int nfs3_xdr_dec_read3res(struct rpc_rqst *req, __be32 *p, 1618static int nfs3_xdr_dec_read3res(struct rpc_rqst *req, struct xdr_stream *xdr,
1624 struct nfs_readres *result) 1619 struct nfs_readres *result)
1625{ 1620{
1626 struct xdr_stream xdr;
1627 enum nfs_stat status; 1621 enum nfs_stat status;
1628 int error; 1622 int error;
1629 1623
1630 xdr_init_decode(&xdr, &req->rq_rcv_buf, p); 1624 error = decode_nfsstat3(xdr, &status);
1631 error = decode_nfsstat3(&xdr, &status);
1632 if (unlikely(error)) 1625 if (unlikely(error))
1633 goto out; 1626 goto out;
1634 error = decode_post_op_attr(&xdr, result->fattr); 1627 error = decode_post_op_attr(xdr, result->fattr);
1635 if (unlikely(error)) 1628 if (unlikely(error))
1636 goto out; 1629 goto out;
1637 if (status != NFS3_OK) 1630 if (status != NFS3_OK)
1638 goto out_status; 1631 goto out_status;
1639 error = decode_read3resok(&xdr, result); 1632 error = decode_read3resok(xdr, result);
1640out: 1633out:
1641 return error; 1634 return error;
1642out_status: 1635out_status:
@@ -1692,23 +1685,21 @@ out_overflow:
1692 return -EIO; 1685 return -EIO;
1693} 1686}
1694 1687
1695static int nfs3_xdr_dec_write3res(struct rpc_rqst *req, __be32 *p, 1688static int nfs3_xdr_dec_write3res(struct rpc_rqst *req, struct xdr_stream *xdr,
1696 struct nfs_writeres *result) 1689 struct nfs_writeres *result)
1697{ 1690{
1698 struct xdr_stream xdr;
1699 enum nfs_stat status; 1691 enum nfs_stat status;
1700 int error; 1692 int error;
1701 1693
1702 xdr_init_decode(&xdr, &req->rq_rcv_buf, p); 1694 error = decode_nfsstat3(xdr, &status);
1703 error = decode_nfsstat3(&xdr, &status);
1704 if (unlikely(error)) 1695 if (unlikely(error))
1705 goto out; 1696 goto out;
1706 error = decode_wcc_data(&xdr, result->fattr); 1697 error = decode_wcc_data(xdr, result->fattr);
1707 if (unlikely(error)) 1698 if (unlikely(error))
1708 goto out; 1699 goto out;
1709 if (status != NFS3_OK) 1700 if (status != NFS3_OK)
1710 goto out_status; 1701 goto out_status;
1711 error = decode_write3resok(&xdr, result); 1702 error = decode_write3resok(xdr, result);
1712out: 1703out:
1713 return error; 1704 return error;
1714out_status: 1705out_status:
@@ -1757,24 +1748,23 @@ out:
1757 return error; 1748 return error;
1758} 1749}
1759 1750
1760static int nfs3_xdr_dec_create3res(struct rpc_rqst *req, __be32 *p, 1751static int nfs3_xdr_dec_create3res(struct rpc_rqst *req,
1752 struct xdr_stream *xdr,
1761 struct nfs3_diropres *result) 1753 struct nfs3_diropres *result)
1762{ 1754{
1763 struct xdr_stream xdr;
1764 enum nfs_stat status; 1755 enum nfs_stat status;
1765 int error; 1756 int error;
1766 1757
1767 xdr_init_decode(&xdr, &req->rq_rcv_buf, p); 1758 error = decode_nfsstat3(xdr, &status);
1768 error = decode_nfsstat3(&xdr, &status);
1769 if (unlikely(error)) 1759 if (unlikely(error))
1770 goto out; 1760 goto out;
1771 if (status != NFS3_OK) 1761 if (status != NFS3_OK)
1772 goto out_default; 1762 goto out_default;
1773 error = decode_create3resok(&xdr, result); 1763 error = decode_create3resok(xdr, result);
1774out: 1764out:
1775 return error; 1765 return error;
1776out_default: 1766out_default:
1777 error = decode_wcc_data(&xdr, result->dir_attr); 1767 error = decode_wcc_data(xdr, result->dir_attr);
1778 if (unlikely(error)) 1768 if (unlikely(error))
1779 goto out; 1769 goto out;
1780 return nfs_stat_to_errno(status); 1770 return nfs_stat_to_errno(status);
@@ -1798,18 +1788,17 @@ out_default:
1798 * REMOVE3resfail resfail; 1788 * REMOVE3resfail resfail;
1799 * }; 1789 * };
1800 */ 1790 */
1801static int nfs3_xdr_dec_remove3res(struct rpc_rqst *req, __be32 *p, 1791static int nfs3_xdr_dec_remove3res(struct rpc_rqst *req,
1792 struct xdr_stream *xdr,
1802 struct nfs_removeres *result) 1793 struct nfs_removeres *result)
1803{ 1794{
1804 struct xdr_stream xdr;
1805 enum nfs_stat status; 1795 enum nfs_stat status;
1806 int error; 1796 int error;
1807 1797
1808 xdr_init_decode(&xdr, &req->rq_rcv_buf, p); 1798 error = decode_nfsstat3(xdr, &status);
1809 error = decode_nfsstat3(&xdr, &status);
1810 if (unlikely(error)) 1799 if (unlikely(error))
1811 goto out; 1800 goto out;
1812 error = decode_wcc_data(&xdr, result->dir_attr); 1801 error = decode_wcc_data(xdr, result->dir_attr);
1813 if (unlikely(error)) 1802 if (unlikely(error))
1814 goto out; 1803 goto out;
1815 if (status != NFS3_OK) 1804 if (status != NFS3_OK)
@@ -1840,21 +1829,20 @@ out_status:
1840 * RENAME3resfail resfail; 1829 * RENAME3resfail resfail;
1841 * }; 1830 * };
1842 */ 1831 */
1843static int nfs3_xdr_dec_rename3res(struct rpc_rqst *req, __be32 *p, 1832static int nfs3_xdr_dec_rename3res(struct rpc_rqst *req,
1833 struct xdr_stream *xdr,
1844 struct nfs_renameres *result) 1834 struct nfs_renameres *result)
1845{ 1835{
1846 struct xdr_stream xdr;
1847 enum nfs_stat status; 1836 enum nfs_stat status;
1848 int error; 1837 int error;
1849 1838
1850 xdr_init_decode(&xdr, &req->rq_rcv_buf, p); 1839 error = decode_nfsstat3(xdr, &status);
1851 error = decode_nfsstat3(&xdr, &status);
1852 if (unlikely(error)) 1840 if (unlikely(error))
1853 goto out; 1841 goto out;
1854 error = decode_wcc_data(&xdr, result->old_fattr); 1842 error = decode_wcc_data(xdr, result->old_fattr);
1855 if (unlikely(error)) 1843 if (unlikely(error))
1856 goto out; 1844 goto out;
1857 error = decode_wcc_data(&xdr, result->new_fattr); 1845 error = decode_wcc_data(xdr, result->new_fattr);
1858 if (unlikely(error)) 1846 if (unlikely(error))
1859 goto out; 1847 goto out;
1860 if (status != NFS3_OK) 1848 if (status != NFS3_OK)
@@ -1885,21 +1873,19 @@ out_status:
1885 * LINK3resfail resfail; 1873 * LINK3resfail resfail;
1886 * }; 1874 * };
1887 */ 1875 */
1888static int nfs3_xdr_dec_link3res(struct rpc_rqst *req, __be32 *p, 1876static int nfs3_xdr_dec_link3res(struct rpc_rqst *req, struct xdr_stream *xdr,
1889 struct nfs3_linkres *result) 1877 struct nfs3_linkres *result)
1890{ 1878{
1891 struct xdr_stream xdr;
1892 enum nfs_stat status; 1879 enum nfs_stat status;
1893 int error; 1880 int error;
1894 1881
1895 xdr_init_decode(&xdr, &req->rq_rcv_buf, p); 1882 error = decode_nfsstat3(xdr, &status);
1896 error = decode_nfsstat3(&xdr, &status);
1897 if (unlikely(error)) 1883 if (unlikely(error))
1898 goto out; 1884 goto out;
1899 error = decode_post_op_attr(&xdr, result->fattr); 1885 error = decode_post_op_attr(xdr, result->fattr);
1900 if (unlikely(error)) 1886 if (unlikely(error))
1901 goto out; 1887 goto out;
1902 error = decode_wcc_data(&xdr, result->dir_attr); 1888 error = decode_wcc_data(xdr, result->dir_attr);
1903 if (unlikely(error)) 1889 if (unlikely(error))
1904 goto out; 1890 goto out;
1905 if (status != NFS3_OK) 1891 if (status != NFS3_OK)
@@ -2085,24 +2071,23 @@ out:
2085 return error; 2071 return error;
2086} 2072}
2087 2073
2088static int nfs3_xdr_dec_readdir3res(struct rpc_rqst *req, __be32 *p, 2074static int nfs3_xdr_dec_readdir3res(struct rpc_rqst *req,
2075 struct xdr_stream *xdr,
2089 struct nfs3_readdirres *result) 2076 struct nfs3_readdirres *result)
2090{ 2077{
2091 struct xdr_stream xdr;
2092 enum nfs_stat status; 2078 enum nfs_stat status;
2093 int error; 2079 int error;
2094 2080
2095 xdr_init_decode(&xdr, &req->rq_rcv_buf, p); 2081 error = decode_nfsstat3(xdr, &status);
2096 error = decode_nfsstat3(&xdr, &status);
2097 if (unlikely(error)) 2082 if (unlikely(error))
2098 goto out; 2083 goto out;
2099 if (status != NFS3_OK) 2084 if (status != NFS3_OK)
2100 goto out_default; 2085 goto out_default;
2101 error = decode_readdir3resok(&xdr, result); 2086 error = decode_readdir3resok(xdr, result);
2102out: 2087out:
2103 return error; 2088 return error;
2104out_default: 2089out_default:
2105 error = decode_post_op_attr(&xdr, result->dir_attr); 2090 error = decode_post_op_attr(xdr, result->dir_attr);
2106 if (unlikely(error)) 2091 if (unlikely(error))
2107 goto out; 2092 goto out;
2108 return nfs_stat_to_errno(status); 2093 return nfs_stat_to_errno(status);
@@ -2154,23 +2139,22 @@ out_overflow:
2154 return -EIO; 2139 return -EIO;
2155} 2140}
2156 2141
2157static int nfs3_xdr_dec_fsstat3res(struct rpc_rqst *req, __be32 *p, 2142static int nfs3_xdr_dec_fsstat3res(struct rpc_rqst *req,
2143 struct xdr_stream *xdr,
2158 struct nfs_fsstat *result) 2144 struct nfs_fsstat *result)
2159{ 2145{
2160 struct xdr_stream xdr;
2161 enum nfs_stat status; 2146 enum nfs_stat status;
2162 int error; 2147 int error;
2163 2148
2164 xdr_init_decode(&xdr, &req->rq_rcv_buf, p); 2149 error = decode_nfsstat3(xdr, &status);
2165 error = decode_nfsstat3(&xdr, &status);
2166 if (unlikely(error)) 2150 if (unlikely(error))
2167 goto out; 2151 goto out;
2168 error = decode_post_op_attr(&xdr, result->fattr); 2152 error = decode_post_op_attr(xdr, result->fattr);
2169 if (unlikely(error)) 2153 if (unlikely(error))
2170 goto out; 2154 goto out;
2171 if (status != NFS3_OK) 2155 if (status != NFS3_OK)
2172 goto out_status; 2156 goto out_status;
2173 error = decode_fsstat3resok(&xdr, result); 2157 error = decode_fsstat3resok(xdr, result);
2174out: 2158out:
2175 return error; 2159 return error;
2176out_status: 2160out_status:
@@ -2231,23 +2215,22 @@ out_overflow:
2231 return -EIO; 2215 return -EIO;
2232} 2216}
2233 2217
2234static int nfs3_xdr_dec_fsinfo3res(struct rpc_rqst *req, __be32 *p, 2218static int nfs3_xdr_dec_fsinfo3res(struct rpc_rqst *req,
2219 struct xdr_stream *xdr,
2235 struct nfs_fsinfo *result) 2220 struct nfs_fsinfo *result)
2236{ 2221{
2237 struct xdr_stream xdr;
2238 enum nfs_stat status; 2222 enum nfs_stat status;
2239 int error; 2223 int error;
2240 2224
2241 xdr_init_decode(&xdr, &req->rq_rcv_buf, p); 2225 error = decode_nfsstat3(xdr, &status);
2242 error = decode_nfsstat3(&xdr, &status);
2243 if (unlikely(error)) 2226 if (unlikely(error))
2244 goto out; 2227 goto out;
2245 error = decode_post_op_attr(&xdr, result->fattr); 2228 error = decode_post_op_attr(xdr, result->fattr);
2246 if (unlikely(error)) 2229 if (unlikely(error))
2247 goto out; 2230 goto out;
2248 if (status != NFS3_OK) 2231 if (status != NFS3_OK)
2249 goto out_status; 2232 goto out_status;
2250 error = decode_fsinfo3resok(&xdr, result); 2233 error = decode_fsinfo3resok(xdr, result);
2251out: 2234out:
2252 return error; 2235 return error;
2253out_status: 2236out_status:
@@ -2295,23 +2278,22 @@ out_overflow:
2295 return -EIO; 2278 return -EIO;
2296} 2279}
2297 2280
2298static int nfs3_xdr_dec_pathconf3res(struct rpc_rqst *req, __be32 *p, 2281static int nfs3_xdr_dec_pathconf3res(struct rpc_rqst *req,
2282 struct xdr_stream *xdr,
2299 struct nfs_pathconf *result) 2283 struct nfs_pathconf *result)
2300{ 2284{
2301 struct xdr_stream xdr;
2302 enum nfs_stat status; 2285 enum nfs_stat status;
2303 int error; 2286 int error;
2304 2287
2305 xdr_init_decode(&xdr, &req->rq_rcv_buf, p); 2288 error = decode_nfsstat3(xdr, &status);
2306 error = decode_nfsstat3(&xdr, &status);
2307 if (unlikely(error)) 2289 if (unlikely(error))
2308 goto out; 2290 goto out;
2309 error = decode_post_op_attr(&xdr, result->fattr); 2291 error = decode_post_op_attr(xdr, result->fattr);
2310 if (unlikely(error)) 2292 if (unlikely(error))
2311 goto out; 2293 goto out;
2312 if (status != NFS3_OK) 2294 if (status != NFS3_OK)
2313 goto out_status; 2295 goto out_status;
2314 error = decode_pathconf3resok(&xdr, result); 2296 error = decode_pathconf3resok(xdr, result);
2315out: 2297out:
2316 return error; 2298 return error;
2317out_status: 2299out_status:
@@ -2337,23 +2319,22 @@ out_status:
2337 * COMMIT3resfail resfail; 2319 * COMMIT3resfail resfail;
2338 * }; 2320 * };
2339 */ 2321 */
2340static int nfs3_xdr_dec_commit3res(struct rpc_rqst *req, __be32 *p, 2322static int nfs3_xdr_dec_commit3res(struct rpc_rqst *req,
2323 struct xdr_stream *xdr,
2341 struct nfs_writeres *result) 2324 struct nfs_writeres *result)
2342{ 2325{
2343 struct xdr_stream xdr;
2344 enum nfs_stat status; 2326 enum nfs_stat status;
2345 int error; 2327 int error;
2346 2328
2347 xdr_init_decode(&xdr, &req->rq_rcv_buf, p); 2329 error = decode_nfsstat3(xdr, &status);
2348 error = decode_nfsstat3(&xdr, &status);
2349 if (unlikely(error)) 2330 if (unlikely(error))
2350 goto out; 2331 goto out;
2351 error = decode_wcc_data(&xdr, result->fattr); 2332 error = decode_wcc_data(xdr, result->fattr);
2352 if (unlikely(error)) 2333 if (unlikely(error))
2353 goto out; 2334 goto out;
2354 if (status != NFS3_OK) 2335 if (status != NFS3_OK)
2355 goto out_status; 2336 goto out_status;
2356 error = decode_writeverf3(&xdr, result->verf->verifier); 2337 error = decode_writeverf3(xdr, result->verf->verifier);
2357out: 2338out:
2358 return error; 2339 return error;
2359out_status: 2340out_status:
@@ -2406,40 +2387,38 @@ out:
2406 return error; 2387 return error;
2407} 2388}
2408 2389
2409static int nfs3_xdr_dec_getacl3res(struct rpc_rqst *req, __be32 *p, 2390static int nfs3_xdr_dec_getacl3res(struct rpc_rqst *req,
2391 struct xdr_stream *xdr,
2410 struct nfs3_getaclres *result) 2392 struct nfs3_getaclres *result)
2411{ 2393{
2412 struct xdr_stream xdr;
2413 enum nfs_stat status; 2394 enum nfs_stat status;
2414 int error; 2395 int error;
2415 2396
2416 xdr_init_decode(&xdr, &req->rq_rcv_buf, p); 2397 error = decode_nfsstat3(xdr, &status);
2417 error = decode_nfsstat3(&xdr, &status);
2418 if (unlikely(error)) 2398 if (unlikely(error))
2419 goto out; 2399 goto out;
2420 if (status != NFS3_OK) 2400 if (status != NFS3_OK)
2421 goto out_default; 2401 goto out_default;
2422 error = decode_getacl3resok(&xdr, result); 2402 error = decode_getacl3resok(xdr, result);
2423out: 2403out:
2424 return error; 2404 return error;
2425out_default: 2405out_default:
2426 return nfs_stat_to_errno(status); 2406 return nfs_stat_to_errno(status);
2427} 2407}
2428 2408
2429static int nfs3_xdr_dec_setacl3res(struct rpc_rqst *req, __be32 *p, 2409static int nfs3_xdr_dec_setacl3res(struct rpc_rqst *req,
2410 struct xdr_stream *xdr,
2430 struct nfs_fattr *result) 2411 struct nfs_fattr *result)
2431{ 2412{
2432 struct xdr_stream xdr;
2433 enum nfs_stat status; 2413 enum nfs_stat status;
2434 int error; 2414 int error;
2435 2415
2436 xdr_init_decode(&xdr, &req->rq_rcv_buf, p); 2416 error = decode_nfsstat3(xdr, &status);
2437 error = decode_nfsstat3(&xdr, &status);
2438 if (unlikely(error)) 2417 if (unlikely(error))
2439 goto out; 2418 goto out;
2440 if (status != NFS3_OK) 2419 if (status != NFS3_OK)
2441 goto out_default; 2420 goto out_default;
2442 error = decode_post_op_attr(&xdr, result); 2421 error = decode_post_op_attr(xdr, result);
2443out: 2422out:
2444 return error; 2423 return error;
2445out_default: 2424out_default:
@@ -2452,7 +2431,7 @@ out_default:
2452[NFS3PROC_##proc] = { \ 2431[NFS3PROC_##proc] = { \
2453 .p_proc = NFS3PROC_##proc, \ 2432 .p_proc = NFS3PROC_##proc, \
2454 .p_encode = (kxdreproc_t)nfs3_xdr_enc_##argtype##3args, \ 2433 .p_encode = (kxdreproc_t)nfs3_xdr_enc_##argtype##3args, \
2455 .p_decode = (kxdrproc_t)nfs3_xdr_dec_##restype##3res, \ 2434 .p_decode = (kxdrdproc_t)nfs3_xdr_dec_##restype##3res, \
2456 .p_arglen = NFS3_##argtype##args_sz, \ 2435 .p_arglen = NFS3_##argtype##args_sz, \
2457 .p_replen = NFS3_##restype##res_sz, \ 2436 .p_replen = NFS3_##restype##res_sz, \
2458 .p_timer = timer, \ 2437 .p_timer = timer, \
@@ -2495,7 +2474,7 @@ static struct rpc_procinfo nfs3_acl_procedures[] = {
2495 [ACLPROC3_GETACL] = { 2474 [ACLPROC3_GETACL] = {
2496 .p_proc = ACLPROC3_GETACL, 2475 .p_proc = ACLPROC3_GETACL,
2497 .p_encode = (kxdreproc_t)nfs3_xdr_enc_getacl3args, 2476 .p_encode = (kxdreproc_t)nfs3_xdr_enc_getacl3args,
2498 .p_decode = (kxdrproc_t)nfs3_xdr_dec_getacl3res, 2477 .p_decode = (kxdrdproc_t)nfs3_xdr_dec_getacl3res,
2499 .p_arglen = ACL3_getaclargs_sz, 2478 .p_arglen = ACL3_getaclargs_sz,
2500 .p_replen = ACL3_getaclres_sz, 2479 .p_replen = ACL3_getaclres_sz,
2501 .p_timer = 1, 2480 .p_timer = 1,
@@ -2504,7 +2483,7 @@ static struct rpc_procinfo nfs3_acl_procedures[] = {
2504 [ACLPROC3_SETACL] = { 2483 [ACLPROC3_SETACL] = {
2505 .p_proc = ACLPROC3_SETACL, 2484 .p_proc = ACLPROC3_SETACL,
2506 .p_encode = (kxdreproc_t)nfs3_xdr_enc_setacl3args, 2485 .p_encode = (kxdreproc_t)nfs3_xdr_enc_setacl3args,
2507 .p_decode = (kxdrproc_t)nfs3_xdr_dec_setacl3res, 2486 .p_decode = (kxdrdproc_t)nfs3_xdr_dec_setacl3res,
2508 .p_arglen = ACL3_setaclargs_sz, 2487 .p_arglen = ACL3_setaclargs_sz,
2509 .p_replen = ACL3_setaclres_sz, 2488 .p_replen = ACL3_setaclres_sz,
2510 .p_timer = 0, 2489 .p_timer = 0,
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 6ec38b3e4a3d..f3f99156bfcb 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -5013,26 +5013,26 @@ out_overflow:
5013/* 5013/*
5014 * Decode OPEN_DOWNGRADE response 5014 * Decode OPEN_DOWNGRADE response
5015 */ 5015 */
5016static int nfs4_xdr_dec_open_downgrade(struct rpc_rqst *rqstp, __be32 *p, struct nfs_closeres *res) 5016static int nfs4_xdr_dec_open_downgrade(struct rpc_rqst *rqstp,
5017 struct xdr_stream *xdr,
5018 struct nfs_closeres *res)
5017{ 5019{
5018 struct xdr_stream xdr;
5019 struct compound_hdr hdr; 5020 struct compound_hdr hdr;
5020 int status; 5021 int status;
5021 5022
5022 xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); 5023 status = decode_compound_hdr(xdr, &hdr);
5023 status = decode_compound_hdr(&xdr, &hdr);
5024 if (status) 5024 if (status)
5025 goto out; 5025 goto out;
5026 status = decode_sequence(&xdr, &res->seq_res, rqstp); 5026 status = decode_sequence(xdr, &res->seq_res, rqstp);
5027 if (status) 5027 if (status)
5028 goto out; 5028 goto out;
5029 status = decode_putfh(&xdr); 5029 status = decode_putfh(xdr);
5030 if (status) 5030 if (status)
5031 goto out; 5031 goto out;
5032 status = decode_open_downgrade(&xdr, res); 5032 status = decode_open_downgrade(xdr, res);
5033 if (status != 0) 5033 if (status != 0)
5034 goto out; 5034 goto out;
5035 decode_getfattr(&xdr, res->fattr, res->server, 5035 decode_getfattr(xdr, res->fattr, res->server,
5036 !RPC_IS_ASYNC(rqstp->rq_task)); 5036 !RPC_IS_ASYNC(rqstp->rq_task));
5037out: 5037out:
5038 return status; 5038 return status;
@@ -5041,26 +5041,25 @@ out:
5041/* 5041/*
5042 * Decode ACCESS response 5042 * Decode ACCESS response
5043 */ 5043 */
5044static int nfs4_xdr_dec_access(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_accessres *res) 5044static int nfs4_xdr_dec_access(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
5045 struct nfs4_accessres *res)
5045{ 5046{
5046 struct xdr_stream xdr;
5047 struct compound_hdr hdr; 5047 struct compound_hdr hdr;
5048 int status; 5048 int status;
5049 5049
5050 xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); 5050 status = decode_compound_hdr(xdr, &hdr);
5051 status = decode_compound_hdr(&xdr, &hdr);
5052 if (status) 5051 if (status)
5053 goto out; 5052 goto out;
5054 status = decode_sequence(&xdr, &res->seq_res, rqstp); 5053 status = decode_sequence(xdr, &res->seq_res, rqstp);
5055 if (status) 5054 if (status)
5056 goto out; 5055 goto out;
5057 status = decode_putfh(&xdr); 5056 status = decode_putfh(xdr);
5058 if (status != 0) 5057 if (status != 0)
5059 goto out; 5058 goto out;
5060 status = decode_access(&xdr, res); 5059 status = decode_access(xdr, res);
5061 if (status != 0) 5060 if (status != 0)
5062 goto out; 5061 goto out;
5063 decode_getfattr(&xdr, res->fattr, res->server, 5062 decode_getfattr(xdr, res->fattr, res->server,
5064 !RPC_IS_ASYNC(rqstp->rq_task)); 5063 !RPC_IS_ASYNC(rqstp->rq_task));
5065out: 5064out:
5066 return status; 5065 return status;
@@ -5069,26 +5068,28 @@ out:
5069/* 5068/*
5070 * Decode LOOKUP response 5069 * Decode LOOKUP response
5071 */ 5070 */
5072static int nfs4_xdr_dec_lookup(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_lookup_res *res) 5071static int nfs4_xdr_dec_lookup(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
5072 struct nfs4_lookup_res *res)
5073{ 5073{
5074 struct xdr_stream xdr;
5075 struct compound_hdr hdr; 5074 struct compound_hdr hdr;
5076 int status; 5075 int status;
5077 5076
5078 xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); 5077 status = decode_compound_hdr(xdr, &hdr);
5079 status = decode_compound_hdr(&xdr, &hdr);
5080 if (status) 5078 if (status)
5081 goto out; 5079 goto out;
5082 status = decode_sequence(&xdr, &res->seq_res, rqstp); 5080 status = decode_sequence(xdr, &res->seq_res, rqstp);
5083 if (status) 5081 if (status)
5084 goto out; 5082 goto out;
5085 if ((status = decode_putfh(&xdr)) != 0) 5083 status = decode_putfh(xdr);
5084 if (status)
5086 goto out; 5085 goto out;
5087 if ((status = decode_lookup(&xdr)) != 0) 5086 status = decode_lookup(xdr);
5087 if (status)
5088 goto out; 5088 goto out;
5089 if ((status = decode_getfh(&xdr, res->fh)) != 0) 5089 status = decode_getfh(xdr, res->fh);
5090 if (status)
5090 goto out; 5091 goto out;
5091 status = decode_getfattr(&xdr, res->fattr, res->server 5092 status = decode_getfattr(xdr, res->fattr, res->server
5092 ,!RPC_IS_ASYNC(rqstp->rq_task)); 5093 ,!RPC_IS_ASYNC(rqstp->rq_task));
5093out: 5094out:
5094 return status; 5095 return status;
@@ -5097,23 +5098,25 @@ out:
5097/* 5098/*
5098 * Decode LOOKUP_ROOT response 5099 * Decode LOOKUP_ROOT response
5099 */ 5100 */
5100static int nfs4_xdr_dec_lookup_root(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_lookup_res *res) 5101static int nfs4_xdr_dec_lookup_root(struct rpc_rqst *rqstp,
5102 struct xdr_stream *xdr,
5103 struct nfs4_lookup_res *res)
5101{ 5104{
5102 struct xdr_stream xdr;
5103 struct compound_hdr hdr; 5105 struct compound_hdr hdr;
5104 int status; 5106 int status;
5105 5107
5106 xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); 5108 status = decode_compound_hdr(xdr, &hdr);
5107 status = decode_compound_hdr(&xdr, &hdr);
5108 if (status) 5109 if (status)
5109 goto out; 5110 goto out;
5110 status = decode_sequence(&xdr, &res->seq_res, rqstp); 5111 status = decode_sequence(xdr, &res->seq_res, rqstp);
5111 if (status) 5112 if (status)
5112 goto out; 5113 goto out;
5113 if ((status = decode_putrootfh(&xdr)) != 0) 5114 status = decode_putrootfh(xdr);
5115 if (status)
5114 goto out; 5116 goto out;
5115 if ((status = decode_getfh(&xdr, res->fh)) == 0) 5117 status = decode_getfh(xdr, res->fh);
5116 status = decode_getfattr(&xdr, res->fattr, res->server, 5118 if (status == 0)
5119 status = decode_getfattr(xdr, res->fattr, res->server,
5117 !RPC_IS_ASYNC(rqstp->rq_task)); 5120 !RPC_IS_ASYNC(rqstp->rq_task));
5118out: 5121out:
5119 return status; 5122 return status;
@@ -5122,24 +5125,25 @@ out:
5122/* 5125/*
5123 * Decode REMOVE response 5126 * Decode REMOVE response
5124 */ 5127 */
5125static int nfs4_xdr_dec_remove(struct rpc_rqst *rqstp, __be32 *p, struct nfs_removeres *res) 5128static int nfs4_xdr_dec_remove(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
5129 struct nfs_removeres *res)
5126{ 5130{
5127 struct xdr_stream xdr;
5128 struct compound_hdr hdr; 5131 struct compound_hdr hdr;
5129 int status; 5132 int status;
5130 5133
5131 xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); 5134 status = decode_compound_hdr(xdr, &hdr);
5132 status = decode_compound_hdr(&xdr, &hdr);
5133 if (status) 5135 if (status)
5134 goto out; 5136 goto out;
5135 status = decode_sequence(&xdr, &res->seq_res, rqstp); 5137 status = decode_sequence(xdr, &res->seq_res, rqstp);
5136 if (status) 5138 if (status)
5137 goto out; 5139 goto out;
5138 if ((status = decode_putfh(&xdr)) != 0) 5140 status = decode_putfh(xdr);
5141 if (status)
5139 goto out; 5142 goto out;
5140 if ((status = decode_remove(&xdr, &res->cinfo)) != 0) 5143 status = decode_remove(xdr, &res->cinfo);
5144 if (status)
5141 goto out; 5145 goto out;
5142 decode_getfattr(&xdr, res->dir_attr, res->server, 5146 decode_getfattr(xdr, res->dir_attr, res->server,
5143 !RPC_IS_ASYNC(rqstp->rq_task)); 5147 !RPC_IS_ASYNC(rqstp->rq_task));
5144out: 5148out:
5145 return status; 5149 return status;
@@ -5148,34 +5152,38 @@ out:
5148/* 5152/*
5149 * Decode RENAME response 5153 * Decode RENAME response
5150 */ 5154 */
5151static int nfs4_xdr_dec_rename(struct rpc_rqst *rqstp, __be32 *p, struct nfs_renameres *res) 5155static int nfs4_xdr_dec_rename(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
5156 struct nfs_renameres *res)
5152{ 5157{
5153 struct xdr_stream xdr;
5154 struct compound_hdr hdr; 5158 struct compound_hdr hdr;
5155 int status; 5159 int status;
5156 5160
5157 xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); 5161 status = decode_compound_hdr(xdr, &hdr);
5158 status = decode_compound_hdr(&xdr, &hdr);
5159 if (status) 5162 if (status)
5160 goto out; 5163 goto out;
5161 status = decode_sequence(&xdr, &res->seq_res, rqstp); 5164 status = decode_sequence(xdr, &res->seq_res, rqstp);
5162 if (status) 5165 if (status)
5163 goto out; 5166 goto out;
5164 if ((status = decode_putfh(&xdr)) != 0) 5167 status = decode_putfh(xdr);
5168 if (status)
5165 goto out; 5169 goto out;
5166 if ((status = decode_savefh(&xdr)) != 0) 5170 status = decode_savefh(xdr);
5171 if (status)
5167 goto out; 5172 goto out;
5168 if ((status = decode_putfh(&xdr)) != 0) 5173 status = decode_putfh(xdr);
5174 if (status)
5169 goto out; 5175 goto out;
5170 if ((status = decode_rename(&xdr, &res->old_cinfo, &res->new_cinfo)) != 0) 5176 status = decode_rename(xdr, &res->old_cinfo, &res->new_cinfo);
5177 if (status)
5171 goto out; 5178 goto out;
5172 /* Current FH is target directory */ 5179 /* Current FH is target directory */
5173 if (decode_getfattr(&xdr, res->new_fattr, res->server, 5180 if (decode_getfattr(xdr, res->new_fattr, res->server,
5174 !RPC_IS_ASYNC(rqstp->rq_task)) != 0) 5181 !RPC_IS_ASYNC(rqstp->rq_task)) != 0)
5175 goto out; 5182 goto out;
5176 if ((status = decode_restorefh(&xdr)) != 0) 5183 status = decode_restorefh(xdr);
5184 if (status)
5177 goto out; 5185 goto out;
5178 decode_getfattr(&xdr, res->old_fattr, res->server, 5186 decode_getfattr(xdr, res->old_fattr, res->server,
5179 !RPC_IS_ASYNC(rqstp->rq_task)); 5187 !RPC_IS_ASYNC(rqstp->rq_task));
5180out: 5188out:
5181 return status; 5189 return status;
@@ -5184,37 +5192,41 @@ out:
5184/* 5192/*
5185 * Decode LINK response 5193 * Decode LINK response
5186 */ 5194 */
5187static int nfs4_xdr_dec_link(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_link_res *res) 5195static int nfs4_xdr_dec_link(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
5196 struct nfs4_link_res *res)
5188{ 5197{
5189 struct xdr_stream xdr;
5190 struct compound_hdr hdr; 5198 struct compound_hdr hdr;
5191 int status; 5199 int status;
5192 5200
5193 xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); 5201 status = decode_compound_hdr(xdr, &hdr);
5194 status = decode_compound_hdr(&xdr, &hdr);
5195 if (status) 5202 if (status)
5196 goto out; 5203 goto out;
5197 status = decode_sequence(&xdr, &res->seq_res, rqstp); 5204 status = decode_sequence(xdr, &res->seq_res, rqstp);
5198 if (status) 5205 if (status)
5199 goto out; 5206 goto out;
5200 if ((status = decode_putfh(&xdr)) != 0) 5207 status = decode_putfh(xdr);
5208 if (status)
5201 goto out; 5209 goto out;
5202 if ((status = decode_savefh(&xdr)) != 0) 5210 status = decode_savefh(xdr);
5211 if (status)
5203 goto out; 5212 goto out;
5204 if ((status = decode_putfh(&xdr)) != 0) 5213 status = decode_putfh(xdr);
5214 if (status)
5205 goto out; 5215 goto out;
5206 if ((status = decode_link(&xdr, &res->cinfo)) != 0) 5216 status = decode_link(xdr, &res->cinfo);
5217 if (status)
5207 goto out; 5218 goto out;
5208 /* 5219 /*
5209 * Note order: OP_LINK leaves the directory as the current 5220 * Note order: OP_LINK leaves the directory as the current
5210 * filehandle. 5221 * filehandle.
5211 */ 5222 */
5212 if (decode_getfattr(&xdr, res->dir_attr, res->server, 5223 if (decode_getfattr(xdr, res->dir_attr, res->server,
5213 !RPC_IS_ASYNC(rqstp->rq_task)) != 0) 5224 !RPC_IS_ASYNC(rqstp->rq_task)) != 0)
5214 goto out; 5225 goto out;
5215 if ((status = decode_restorefh(&xdr)) != 0) 5226 status = decode_restorefh(xdr);
5227 if (status)
5216 goto out; 5228 goto out;
5217 decode_getfattr(&xdr, res->fattr, res->server, 5229 decode_getfattr(xdr, res->fattr, res->server,
5218 !RPC_IS_ASYNC(rqstp->rq_task)); 5230 !RPC_IS_ASYNC(rqstp->rq_task));
5219out: 5231out:
5220 return status; 5232 return status;
@@ -5223,33 +5235,37 @@ out:
5223/* 5235/*
5224 * Decode CREATE response 5236 * Decode CREATE response
5225 */ 5237 */
5226static int nfs4_xdr_dec_create(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_create_res *res) 5238static int nfs4_xdr_dec_create(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
5239 struct nfs4_create_res *res)
5227{ 5240{
5228 struct xdr_stream xdr;
5229 struct compound_hdr hdr; 5241 struct compound_hdr hdr;
5230 int status; 5242 int status;
5231 5243
5232 xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); 5244 status = decode_compound_hdr(xdr, &hdr);
5233 status = decode_compound_hdr(&xdr, &hdr);
5234 if (status) 5245 if (status)
5235 goto out; 5246 goto out;
5236 status = decode_sequence(&xdr, &res->seq_res, rqstp); 5247 status = decode_sequence(xdr, &res->seq_res, rqstp);
5237 if (status) 5248 if (status)
5238 goto out; 5249 goto out;
5239 if ((status = decode_putfh(&xdr)) != 0) 5250 status = decode_putfh(xdr);
5251 if (status)
5240 goto out; 5252 goto out;
5241 if ((status = decode_savefh(&xdr)) != 0) 5253 status = decode_savefh(xdr);
5254 if (status)
5242 goto out; 5255 goto out;
5243 if ((status = decode_create(&xdr,&res->dir_cinfo)) != 0) 5256 status = decode_create(xdr, &res->dir_cinfo);
5257 if (status)
5244 goto out; 5258 goto out;
5245 if ((status = decode_getfh(&xdr, res->fh)) != 0) 5259 status = decode_getfh(xdr, res->fh);
5260 if (status)
5246 goto out; 5261 goto out;
5247 if (decode_getfattr(&xdr, res->fattr, res->server, 5262 if (decode_getfattr(xdr, res->fattr, res->server,
5248 !RPC_IS_ASYNC(rqstp->rq_task)) != 0) 5263 !RPC_IS_ASYNC(rqstp->rq_task)) != 0)
5249 goto out; 5264 goto out;
5250 if ((status = decode_restorefh(&xdr)) != 0) 5265 status = decode_restorefh(xdr);
5266 if (status)
5251 goto out; 5267 goto out;
5252 decode_getfattr(&xdr, res->dir_fattr, res->server, 5268 decode_getfattr(xdr, res->dir_fattr, res->server,
5253 !RPC_IS_ASYNC(rqstp->rq_task)); 5269 !RPC_IS_ASYNC(rqstp->rq_task));
5254out: 5270out:
5255 return status; 5271 return status;
@@ -5258,31 +5274,31 @@ out:
5258/* 5274/*
5259 * Decode SYMLINK response 5275 * Decode SYMLINK response
5260 */ 5276 */
5261static int nfs4_xdr_dec_symlink(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_create_res *res) 5277static int nfs4_xdr_dec_symlink(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
5278 struct nfs4_create_res *res)
5262{ 5279{
5263 return nfs4_xdr_dec_create(rqstp, p, res); 5280 return nfs4_xdr_dec_create(rqstp, xdr, res);
5264} 5281}
5265 5282
5266/* 5283/*
5267 * Decode GETATTR response 5284 * Decode GETATTR response
5268 */ 5285 */
5269static int nfs4_xdr_dec_getattr(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_getattr_res *res) 5286static int nfs4_xdr_dec_getattr(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
5287 struct nfs4_getattr_res *res)
5270{ 5288{
5271 struct xdr_stream xdr;
5272 struct compound_hdr hdr; 5289 struct compound_hdr hdr;
5273 int status; 5290 int status;
5274 5291
5275 xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); 5292 status = decode_compound_hdr(xdr, &hdr);
5276 status = decode_compound_hdr(&xdr, &hdr);
5277 if (status) 5293 if (status)
5278 goto out; 5294 goto out;
5279 status = decode_sequence(&xdr, &res->seq_res, rqstp); 5295 status = decode_sequence(xdr, &res->seq_res, rqstp);
5280 if (status) 5296 if (status)
5281 goto out; 5297 goto out;
5282 status = decode_putfh(&xdr); 5298 status = decode_putfh(xdr);
5283 if (status) 5299 if (status)
5284 goto out; 5300 goto out;
5285 status = decode_getfattr(&xdr, res->fattr, res->server, 5301 status = decode_getfattr(xdr, res->fattr, res->server,
5286 !RPC_IS_ASYNC(rqstp->rq_task)); 5302 !RPC_IS_ASYNC(rqstp->rq_task));
5287out: 5303out:
5288 return status; 5304 return status;
@@ -5309,24 +5325,22 @@ static void nfs4_xdr_enc_setacl(struct rpc_rqst *req, struct xdr_stream *xdr,
5309 * Decode SETACL response 5325 * Decode SETACL response
5310 */ 5326 */
5311static int 5327static int
5312nfs4_xdr_dec_setacl(struct rpc_rqst *rqstp, __be32 *p, 5328nfs4_xdr_dec_setacl(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
5313 struct nfs_setaclres *res) 5329 struct nfs_setaclres *res)
5314{ 5330{
5315 struct xdr_stream xdr;
5316 struct compound_hdr hdr; 5331 struct compound_hdr hdr;
5317 int status; 5332 int status;
5318 5333
5319 xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); 5334 status = decode_compound_hdr(xdr, &hdr);
5320 status = decode_compound_hdr(&xdr, &hdr);
5321 if (status) 5335 if (status)
5322 goto out; 5336 goto out;
5323 status = decode_sequence(&xdr, &res->seq_res, rqstp); 5337 status = decode_sequence(xdr, &res->seq_res, rqstp);
5324 if (status) 5338 if (status)
5325 goto out; 5339 goto out;
5326 status = decode_putfh(&xdr); 5340 status = decode_putfh(xdr);
5327 if (status) 5341 if (status)
5328 goto out; 5342 goto out;
5329 status = decode_setattr(&xdr); 5343 status = decode_setattr(xdr);
5330out: 5344out:
5331 return status; 5345 return status;
5332} 5346}
@@ -5335,24 +5349,22 @@ out:
5335 * Decode GETACL response 5349 * Decode GETACL response
5336 */ 5350 */
5337static int 5351static int
5338nfs4_xdr_dec_getacl(struct rpc_rqst *rqstp, __be32 *p, 5352nfs4_xdr_dec_getacl(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
5339 struct nfs_getaclres *res) 5353 struct nfs_getaclres *res)
5340{ 5354{
5341 struct xdr_stream xdr;
5342 struct compound_hdr hdr; 5355 struct compound_hdr hdr;
5343 int status; 5356 int status;
5344 5357
5345 xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); 5358 status = decode_compound_hdr(xdr, &hdr);
5346 status = decode_compound_hdr(&xdr, &hdr);
5347 if (status) 5359 if (status)
5348 goto out; 5360 goto out;
5349 status = decode_sequence(&xdr, &res->seq_res, rqstp); 5361 status = decode_sequence(xdr, &res->seq_res, rqstp);
5350 if (status) 5362 if (status)
5351 goto out; 5363 goto out;
5352 status = decode_putfh(&xdr); 5364 status = decode_putfh(xdr);
5353 if (status) 5365 if (status)
5354 goto out; 5366 goto out;
5355 status = decode_getacl(&xdr, rqstp, &res->acl_len); 5367 status = decode_getacl(xdr, rqstp, &res->acl_len);
5356 5368
5357out: 5369out:
5358 return status; 5370 return status;
@@ -5361,23 +5373,22 @@ out:
5361/* 5373/*
5362 * Decode CLOSE response 5374 * Decode CLOSE response
5363 */ 5375 */
5364static int nfs4_xdr_dec_close(struct rpc_rqst *rqstp, __be32 *p, struct nfs_closeres *res) 5376static int nfs4_xdr_dec_close(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
5377 struct nfs_closeres *res)
5365{ 5378{
5366 struct xdr_stream xdr;
5367 struct compound_hdr hdr; 5379 struct compound_hdr hdr;
5368 int status; 5380 int status;
5369 5381
5370 xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); 5382 status = decode_compound_hdr(xdr, &hdr);
5371 status = decode_compound_hdr(&xdr, &hdr);
5372 if (status) 5383 if (status)
5373 goto out; 5384 goto out;
5374 status = decode_sequence(&xdr, &res->seq_res, rqstp); 5385 status = decode_sequence(xdr, &res->seq_res, rqstp);
5375 if (status) 5386 if (status)
5376 goto out; 5387 goto out;
5377 status = decode_putfh(&xdr); 5388 status = decode_putfh(xdr);
5378 if (status) 5389 if (status)
5379 goto out; 5390 goto out;
5380 status = decode_close(&xdr, res); 5391 status = decode_close(xdr, res);
5381 if (status != 0) 5392 if (status != 0)
5382 goto out; 5393 goto out;
5383 /* 5394 /*
@@ -5386,7 +5397,7 @@ static int nfs4_xdr_dec_close(struct rpc_rqst *rqstp, __be32 *p, struct nfs_clos
5386 * an ESTALE error. Shouldn't be a problem, 5397 * an ESTALE error. Shouldn't be a problem,
5387 * though, since fattr->valid will remain unset. 5398 * though, since fattr->valid will remain unset.
5388 */ 5399 */
5389 decode_getfattr(&xdr, res->fattr, res->server, 5400 decode_getfattr(xdr, res->fattr, res->server,
5390 !RPC_IS_ASYNC(rqstp->rq_task)); 5401 !RPC_IS_ASYNC(rqstp->rq_task));
5391out: 5402out:
5392 return status; 5403 return status;
@@ -5395,36 +5406,35 @@ out:
5395/* 5406/*
5396 * Decode OPEN response 5407 * Decode OPEN response
5397 */ 5408 */
5398static int nfs4_xdr_dec_open(struct rpc_rqst *rqstp, __be32 *p, struct nfs_openres *res) 5409static int nfs4_xdr_dec_open(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
5410 struct nfs_openres *res)
5399{ 5411{
5400 struct xdr_stream xdr;
5401 struct compound_hdr hdr; 5412 struct compound_hdr hdr;
5402 int status; 5413 int status;
5403 5414
5404 xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); 5415 status = decode_compound_hdr(xdr, &hdr);
5405 status = decode_compound_hdr(&xdr, &hdr);
5406 if (status) 5416 if (status)
5407 goto out; 5417 goto out;
5408 status = decode_sequence(&xdr, &res->seq_res, rqstp); 5418 status = decode_sequence(xdr, &res->seq_res, rqstp);
5409 if (status) 5419 if (status)
5410 goto out; 5420 goto out;
5411 status = decode_putfh(&xdr); 5421 status = decode_putfh(xdr);
5412 if (status) 5422 if (status)
5413 goto out; 5423 goto out;
5414 status = decode_savefh(&xdr); 5424 status = decode_savefh(xdr);
5415 if (status) 5425 if (status)
5416 goto out; 5426 goto out;
5417 status = decode_open(&xdr, res); 5427 status = decode_open(xdr, res);
5418 if (status) 5428 if (status)
5419 goto out; 5429 goto out;
5420 if (decode_getfh(&xdr, &res->fh) != 0) 5430 if (decode_getfh(xdr, &res->fh) != 0)
5421 goto out; 5431 goto out;
5422 if (decode_getfattr(&xdr, res->f_attr, res->server, 5432 if (decode_getfattr(xdr, res->f_attr, res->server,
5423 !RPC_IS_ASYNC(rqstp->rq_task)) != 0) 5433 !RPC_IS_ASYNC(rqstp->rq_task)) != 0)
5424 goto out; 5434 goto out;
5425 if (decode_restorefh(&xdr) != 0) 5435 if (decode_restorefh(xdr) != 0)
5426 goto out; 5436 goto out;
5427 decode_getfattr(&xdr, res->dir_attr, res->server, 5437 decode_getfattr(xdr, res->dir_attr, res->server,
5428 !RPC_IS_ASYNC(rqstp->rq_task)); 5438 !RPC_IS_ASYNC(rqstp->rq_task));
5429out: 5439out:
5430 return status; 5440 return status;
@@ -5433,20 +5443,20 @@ out:
5433/* 5443/*
5434 * Decode OPEN_CONFIRM response 5444 * Decode OPEN_CONFIRM response
5435 */ 5445 */
5436static int nfs4_xdr_dec_open_confirm(struct rpc_rqst *rqstp, __be32 *p, struct nfs_open_confirmres *res) 5446static int nfs4_xdr_dec_open_confirm(struct rpc_rqst *rqstp,
5447 struct xdr_stream *xdr,
5448 struct nfs_open_confirmres *res)
5437{ 5449{
5438 struct xdr_stream xdr;
5439 struct compound_hdr hdr; 5450 struct compound_hdr hdr;
5440 int status; 5451 int status;
5441 5452
5442 xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); 5453 status = decode_compound_hdr(xdr, &hdr);
5443 status = decode_compound_hdr(&xdr, &hdr);
5444 if (status) 5454 if (status)
5445 goto out; 5455 goto out;
5446 status = decode_putfh(&xdr); 5456 status = decode_putfh(xdr);
5447 if (status) 5457 if (status)
5448 goto out; 5458 goto out;
5449 status = decode_open_confirm(&xdr, res); 5459 status = decode_open_confirm(xdr, res);
5450out: 5460out:
5451 return status; 5461 return status;
5452} 5462}
@@ -5454,26 +5464,26 @@ out:
5454/* 5464/*
5455 * Decode OPEN response 5465 * Decode OPEN response
5456 */ 5466 */
5457static int nfs4_xdr_dec_open_noattr(struct rpc_rqst *rqstp, __be32 *p, struct nfs_openres *res) 5467static int nfs4_xdr_dec_open_noattr(struct rpc_rqst *rqstp,
5468 struct xdr_stream *xdr,
5469 struct nfs_openres *res)
5458{ 5470{
5459 struct xdr_stream xdr;
5460 struct compound_hdr hdr; 5471 struct compound_hdr hdr;
5461 int status; 5472 int status;
5462 5473
5463 xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); 5474 status = decode_compound_hdr(xdr, &hdr);
5464 status = decode_compound_hdr(&xdr, &hdr);
5465 if (status) 5475 if (status)
5466 goto out; 5476 goto out;
5467 status = decode_sequence(&xdr, &res->seq_res, rqstp); 5477 status = decode_sequence(xdr, &res->seq_res, rqstp);
5468 if (status) 5478 if (status)
5469 goto out; 5479 goto out;
5470 status = decode_putfh(&xdr); 5480 status = decode_putfh(xdr);
5471 if (status) 5481 if (status)
5472 goto out; 5482 goto out;
5473 status = decode_open(&xdr, res); 5483 status = decode_open(xdr, res);
5474 if (status) 5484 if (status)
5475 goto out; 5485 goto out;
5476 decode_getfattr(&xdr, res->f_attr, res->server, 5486 decode_getfattr(xdr, res->f_attr, res->server,
5477 !RPC_IS_ASYNC(rqstp->rq_task)); 5487 !RPC_IS_ASYNC(rqstp->rq_task));
5478out: 5488out:
5479 return status; 5489 return status;
@@ -5482,26 +5492,26 @@ out:
5482/* 5492/*
5483 * Decode SETATTR response 5493 * Decode SETATTR response
5484 */ 5494 */
5485static int nfs4_xdr_dec_setattr(struct rpc_rqst *rqstp, __be32 *p, struct nfs_setattrres *res) 5495static int nfs4_xdr_dec_setattr(struct rpc_rqst *rqstp,
5496 struct xdr_stream *xdr,
5497 struct nfs_setattrres *res)
5486{ 5498{
5487 struct xdr_stream xdr;
5488 struct compound_hdr hdr; 5499 struct compound_hdr hdr;
5489 int status; 5500 int status;
5490 5501
5491 xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); 5502 status = decode_compound_hdr(xdr, &hdr);
5492 status = decode_compound_hdr(&xdr, &hdr);
5493 if (status) 5503 if (status)
5494 goto out; 5504 goto out;
5495 status = decode_sequence(&xdr, &res->seq_res, rqstp); 5505 status = decode_sequence(xdr, &res->seq_res, rqstp);
5496 if (status) 5506 if (status)
5497 goto out; 5507 goto out;
5498 status = decode_putfh(&xdr); 5508 status = decode_putfh(xdr);
5499 if (status) 5509 if (status)
5500 goto out; 5510 goto out;
5501 status = decode_setattr(&xdr); 5511 status = decode_setattr(xdr);
5502 if (status) 5512 if (status)
5503 goto out; 5513 goto out;
5504 decode_getfattr(&xdr, res->fattr, res->server, 5514 decode_getfattr(xdr, res->fattr, res->server,
5505 !RPC_IS_ASYNC(rqstp->rq_task)); 5515 !RPC_IS_ASYNC(rqstp->rq_task));
5506out: 5516out:
5507 return status; 5517 return status;
@@ -5510,23 +5520,22 @@ out:
5510/* 5520/*
5511 * Decode LOCK response 5521 * Decode LOCK response
5512 */ 5522 */
5513static int nfs4_xdr_dec_lock(struct rpc_rqst *rqstp, __be32 *p, struct nfs_lock_res *res) 5523static int nfs4_xdr_dec_lock(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
5524 struct nfs_lock_res *res)
5514{ 5525{
5515 struct xdr_stream xdr;
5516 struct compound_hdr hdr; 5526 struct compound_hdr hdr;
5517 int status; 5527 int status;
5518 5528
5519 xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); 5529 status = decode_compound_hdr(xdr, &hdr);
5520 status = decode_compound_hdr(&xdr, &hdr);
5521 if (status) 5530 if (status)
5522 goto out; 5531 goto out;
5523 status = decode_sequence(&xdr, &res->seq_res, rqstp); 5532 status = decode_sequence(xdr, &res->seq_res, rqstp);
5524 if (status) 5533 if (status)
5525 goto out; 5534 goto out;
5526 status = decode_putfh(&xdr); 5535 status = decode_putfh(xdr);
5527 if (status) 5536 if (status)
5528 goto out; 5537 goto out;
5529 status = decode_lock(&xdr, res); 5538 status = decode_lock(xdr, res);
5530out: 5539out:
5531 return status; 5540 return status;
5532} 5541}
@@ -5534,23 +5543,22 @@ out:
5534/* 5543/*
5535 * Decode LOCKT response 5544 * Decode LOCKT response
5536 */ 5545 */
5537static int nfs4_xdr_dec_lockt(struct rpc_rqst *rqstp, __be32 *p, struct nfs_lockt_res *res) 5546static int nfs4_xdr_dec_lockt(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
5547 struct nfs_lockt_res *res)
5538{ 5548{
5539 struct xdr_stream xdr;
5540 struct compound_hdr hdr; 5549 struct compound_hdr hdr;
5541 int status; 5550 int status;
5542 5551
5543 xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); 5552 status = decode_compound_hdr(xdr, &hdr);
5544 status = decode_compound_hdr(&xdr, &hdr);
5545 if (status) 5553 if (status)
5546 goto out; 5554 goto out;
5547 status = decode_sequence(&xdr, &res->seq_res, rqstp); 5555 status = decode_sequence(xdr, &res->seq_res, rqstp);
5548 if (status) 5556 if (status)
5549 goto out; 5557 goto out;
5550 status = decode_putfh(&xdr); 5558 status = decode_putfh(xdr);
5551 if (status) 5559 if (status)
5552 goto out; 5560 goto out;
5553 status = decode_lockt(&xdr, res); 5561 status = decode_lockt(xdr, res);
5554out: 5562out:
5555 return status; 5563 return status;
5556} 5564}
@@ -5558,61 +5566,58 @@ out:
5558/* 5566/*
5559 * Decode LOCKU response 5567 * Decode LOCKU response
5560 */ 5568 */
5561static int nfs4_xdr_dec_locku(struct rpc_rqst *rqstp, __be32 *p, struct nfs_locku_res *res) 5569static int nfs4_xdr_dec_locku(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
5570 struct nfs_locku_res *res)
5562{ 5571{
5563 struct xdr_stream xdr;
5564 struct compound_hdr hdr; 5572 struct compound_hdr hdr;
5565 int status; 5573 int status;
5566 5574
5567 xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); 5575 status = decode_compound_hdr(xdr, &hdr);
5568 status = decode_compound_hdr(&xdr, &hdr);
5569 if (status) 5576 if (status)
5570 goto out; 5577 goto out;
5571 status = decode_sequence(&xdr, &res->seq_res, rqstp); 5578 status = decode_sequence(xdr, &res->seq_res, rqstp);
5572 if (status) 5579 if (status)
5573 goto out; 5580 goto out;
5574 status = decode_putfh(&xdr); 5581 status = decode_putfh(xdr);
5575 if (status) 5582 if (status)
5576 goto out; 5583 goto out;
5577 status = decode_locku(&xdr, res); 5584 status = decode_locku(xdr, res);
5578out: 5585out:
5579 return status; 5586 return status;
5580} 5587}
5581 5588
5582static int nfs4_xdr_dec_release_lockowner(struct rpc_rqst *rqstp, __be32 *p, void *dummy) 5589static int nfs4_xdr_dec_release_lockowner(struct rpc_rqst *rqstp,
5590 struct xdr_stream *xdr, void *dummy)
5583{ 5591{
5584 struct xdr_stream xdr;
5585 struct compound_hdr hdr; 5592 struct compound_hdr hdr;
5586 int status; 5593 int status;
5587 5594
5588 xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); 5595 status = decode_compound_hdr(xdr, &hdr);
5589 status = decode_compound_hdr(&xdr, &hdr);
5590 if (!status) 5596 if (!status)
5591 status = decode_release_lockowner(&xdr); 5597 status = decode_release_lockowner(xdr);
5592 return status; 5598 return status;
5593} 5599}
5594 5600
5595/* 5601/*
5596 * Decode READLINK response 5602 * Decode READLINK response
5597 */ 5603 */
5598static int nfs4_xdr_dec_readlink(struct rpc_rqst *rqstp, __be32 *p, 5604static int nfs4_xdr_dec_readlink(struct rpc_rqst *rqstp,
5605 struct xdr_stream *xdr,
5599 struct nfs4_readlink_res *res) 5606 struct nfs4_readlink_res *res)
5600{ 5607{
5601 struct xdr_stream xdr;
5602 struct compound_hdr hdr; 5608 struct compound_hdr hdr;
5603 int status; 5609 int status;
5604 5610
5605 xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); 5611 status = decode_compound_hdr(xdr, &hdr);
5606 status = decode_compound_hdr(&xdr, &hdr);
5607 if (status) 5612 if (status)
5608 goto out; 5613 goto out;
5609 status = decode_sequence(&xdr, &res->seq_res, rqstp); 5614 status = decode_sequence(xdr, &res->seq_res, rqstp);
5610 if (status) 5615 if (status)
5611 goto out; 5616 goto out;
5612 status = decode_putfh(&xdr); 5617 status = decode_putfh(xdr);
5613 if (status) 5618 if (status)
5614 goto out; 5619 goto out;
5615 status = decode_readlink(&xdr, rqstp); 5620 status = decode_readlink(xdr, rqstp);
5616out: 5621out:
5617 return status; 5622 return status;
5618} 5623}
@@ -5620,23 +5625,22 @@ out:
5620/* 5625/*
5621 * Decode READDIR response 5626 * Decode READDIR response
5622 */ 5627 */
5623static int nfs4_xdr_dec_readdir(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_readdir_res *res) 5628static int nfs4_xdr_dec_readdir(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
5629 struct nfs4_readdir_res *res)
5624{ 5630{
5625 struct xdr_stream xdr;
5626 struct compound_hdr hdr; 5631 struct compound_hdr hdr;
5627 int status; 5632 int status;
5628 5633
5629 xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); 5634 status = decode_compound_hdr(xdr, &hdr);
5630 status = decode_compound_hdr(&xdr, &hdr);
5631 if (status) 5635 if (status)
5632 goto out; 5636 goto out;
5633 status = decode_sequence(&xdr, &res->seq_res, rqstp); 5637 status = decode_sequence(xdr, &res->seq_res, rqstp);
5634 if (status) 5638 if (status)
5635 goto out; 5639 goto out;
5636 status = decode_putfh(&xdr); 5640 status = decode_putfh(xdr);
5637 if (status) 5641 if (status)
5638 goto out; 5642 goto out;
5639 status = decode_readdir(&xdr, rqstp, res); 5643 status = decode_readdir(xdr, rqstp, res);
5640out: 5644out:
5641 return status; 5645 return status;
5642} 5646}
@@ -5644,23 +5648,22 @@ out:
5644/* 5648/*
5645 * Decode Read response 5649 * Decode Read response
5646 */ 5650 */
5647static int nfs4_xdr_dec_read(struct rpc_rqst *rqstp, __be32 *p, struct nfs_readres *res) 5651static int nfs4_xdr_dec_read(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
5652 struct nfs_readres *res)
5648{ 5653{
5649 struct xdr_stream xdr;
5650 struct compound_hdr hdr; 5654 struct compound_hdr hdr;
5651 int status; 5655 int status;
5652 5656
5653 xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); 5657 status = decode_compound_hdr(xdr, &hdr);
5654 status = decode_compound_hdr(&xdr, &hdr);
5655 if (status) 5658 if (status)
5656 goto out; 5659 goto out;
5657 status = decode_sequence(&xdr, &res->seq_res, rqstp); 5660 status = decode_sequence(xdr, &res->seq_res, rqstp);
5658 if (status) 5661 if (status)
5659 goto out; 5662 goto out;
5660 status = decode_putfh(&xdr); 5663 status = decode_putfh(xdr);
5661 if (status) 5664 if (status)
5662 goto out; 5665 goto out;
5663 status = decode_read(&xdr, rqstp, res); 5666 status = decode_read(xdr, rqstp, res);
5664 if (!status) 5667 if (!status)
5665 status = res->count; 5668 status = res->count;
5666out: 5669out:
@@ -5670,26 +5673,25 @@ out:
5670/* 5673/*
5671 * Decode WRITE response 5674 * Decode WRITE response
5672 */ 5675 */
5673static int nfs4_xdr_dec_write(struct rpc_rqst *rqstp, __be32 *p, struct nfs_writeres *res) 5676static int nfs4_xdr_dec_write(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
5677 struct nfs_writeres *res)
5674{ 5678{
5675 struct xdr_stream xdr;
5676 struct compound_hdr hdr; 5679 struct compound_hdr hdr;
5677 int status; 5680 int status;
5678 5681
5679 xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); 5682 status = decode_compound_hdr(xdr, &hdr);
5680 status = decode_compound_hdr(&xdr, &hdr);
5681 if (status) 5683 if (status)
5682 goto out; 5684 goto out;
5683 status = decode_sequence(&xdr, &res->seq_res, rqstp); 5685 status = decode_sequence(xdr, &res->seq_res, rqstp);
5684 if (status) 5686 if (status)
5685 goto out; 5687 goto out;
5686 status = decode_putfh(&xdr); 5688 status = decode_putfh(xdr);
5687 if (status) 5689 if (status)
5688 goto out; 5690 goto out;
5689 status = decode_write(&xdr, res); 5691 status = decode_write(xdr, res);
5690 if (status) 5692 if (status)
5691 goto out; 5693 goto out;
5692 decode_getfattr(&xdr, res->fattr, res->server, 5694 decode_getfattr(xdr, res->fattr, res->server,
5693 !RPC_IS_ASYNC(rqstp->rq_task)); 5695 !RPC_IS_ASYNC(rqstp->rq_task));
5694 if (!status) 5696 if (!status)
5695 status = res->count; 5697 status = res->count;
@@ -5700,26 +5702,25 @@ out:
5700/* 5702/*
5701 * Decode COMMIT response 5703 * Decode COMMIT response
5702 */ 5704 */
5703static int nfs4_xdr_dec_commit(struct rpc_rqst *rqstp, __be32 *p, struct nfs_writeres *res) 5705static int nfs4_xdr_dec_commit(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
5706 struct nfs_writeres *res)
5704{ 5707{
5705 struct xdr_stream xdr;
5706 struct compound_hdr hdr; 5708 struct compound_hdr hdr;
5707 int status; 5709 int status;
5708 5710
5709 xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); 5711 status = decode_compound_hdr(xdr, &hdr);
5710 status = decode_compound_hdr(&xdr, &hdr);
5711 if (status) 5712 if (status)
5712 goto out; 5713 goto out;
5713 status = decode_sequence(&xdr, &res->seq_res, rqstp); 5714 status = decode_sequence(xdr, &res->seq_res, rqstp);
5714 if (status) 5715 if (status)
5715 goto out; 5716 goto out;
5716 status = decode_putfh(&xdr); 5717 status = decode_putfh(xdr);
5717 if (status) 5718 if (status)
5718 goto out; 5719 goto out;
5719 status = decode_commit(&xdr, res); 5720 status = decode_commit(xdr, res);
5720 if (status) 5721 if (status)
5721 goto out; 5722 goto out;
5722 decode_getfattr(&xdr, res->fattr, res->server, 5723 decode_getfattr(xdr, res->fattr, res->server,
5723 !RPC_IS_ASYNC(rqstp->rq_task)); 5724 !RPC_IS_ASYNC(rqstp->rq_task));
5724out: 5725out:
5725 return status; 5726 return status;
@@ -5728,85 +5729,80 @@ out:
5728/* 5729/*
5729 * Decode FSINFO response 5730 * Decode FSINFO response
5730 */ 5731 */
5731static int nfs4_xdr_dec_fsinfo(struct rpc_rqst *req, __be32 *p, 5732static int nfs4_xdr_dec_fsinfo(struct rpc_rqst *req, struct xdr_stream *xdr,
5732 struct nfs4_fsinfo_res *res) 5733 struct nfs4_fsinfo_res *res)
5733{ 5734{
5734 struct xdr_stream xdr;
5735 struct compound_hdr hdr; 5735 struct compound_hdr hdr;
5736 int status; 5736 int status;
5737 5737
5738 xdr_init_decode(&xdr, &req->rq_rcv_buf, p); 5738 status = decode_compound_hdr(xdr, &hdr);
5739 status = decode_compound_hdr(&xdr, &hdr);
5740 if (!status) 5739 if (!status)
5741 status = decode_sequence(&xdr, &res->seq_res, req); 5740 status = decode_sequence(xdr, &res->seq_res, req);
5742 if (!status) 5741 if (!status)
5743 status = decode_putfh(&xdr); 5742 status = decode_putfh(xdr);
5744 if (!status) 5743 if (!status)
5745 status = decode_fsinfo(&xdr, res->fsinfo); 5744 status = decode_fsinfo(xdr, res->fsinfo);
5746 return status; 5745 return status;
5747} 5746}
5748 5747
5749/* 5748/*
5750 * Decode PATHCONF response 5749 * Decode PATHCONF response
5751 */ 5750 */
5752static int nfs4_xdr_dec_pathconf(struct rpc_rqst *req, __be32 *p, 5751static int nfs4_xdr_dec_pathconf(struct rpc_rqst *req, struct xdr_stream *xdr,
5753 struct nfs4_pathconf_res *res) 5752 struct nfs4_pathconf_res *res)
5754{ 5753{
5755 struct xdr_stream xdr;
5756 struct compound_hdr hdr; 5754 struct compound_hdr hdr;
5757 int status; 5755 int status;
5758 5756
5759 xdr_init_decode(&xdr, &req->rq_rcv_buf, p); 5757 status = decode_compound_hdr(xdr, &hdr);
5760 status = decode_compound_hdr(&xdr, &hdr);
5761 if (!status) 5758 if (!status)
5762 status = decode_sequence(&xdr, &res->seq_res, req); 5759 status = decode_sequence(xdr, &res->seq_res, req);
5763 if (!status) 5760 if (!status)
5764 status = decode_putfh(&xdr); 5761 status = decode_putfh(xdr);
5765 if (!status) 5762 if (!status)
5766 status = decode_pathconf(&xdr, res->pathconf); 5763 status = decode_pathconf(xdr, res->pathconf);
5767 return status; 5764 return status;
5768} 5765}
5769 5766
5770/* 5767/*
5771 * Decode STATFS response 5768 * Decode STATFS response
5772 */ 5769 */
5773static int nfs4_xdr_dec_statfs(struct rpc_rqst *req, __be32 *p, 5770static int nfs4_xdr_dec_statfs(struct rpc_rqst *req, struct xdr_stream *xdr,
5774 struct nfs4_statfs_res *res) 5771 struct nfs4_statfs_res *res)
5775{ 5772{
5776 struct xdr_stream xdr;
5777 struct compound_hdr hdr; 5773 struct compound_hdr hdr;
5778 int status; 5774 int status;
5779 5775
5780 xdr_init_decode(&xdr, &req->rq_rcv_buf, p); 5776 status = decode_compound_hdr(xdr, &hdr);
5781 status = decode_compound_hdr(&xdr, &hdr);
5782 if (!status) 5777 if (!status)
5783 status = decode_sequence(&xdr, &res->seq_res, req); 5778 status = decode_sequence(xdr, &res->seq_res, req);
5784 if (!status) 5779 if (!status)
5785 status = decode_putfh(&xdr); 5780 status = decode_putfh(xdr);
5786 if (!status) 5781 if (!status)
5787 status = decode_statfs(&xdr, res->fsstat); 5782 status = decode_statfs(xdr, res->fsstat);
5788 return status; 5783 return status;
5789} 5784}
5790 5785
5791/* 5786/*
5792 * Decode GETATTR_BITMAP response 5787 * Decode GETATTR_BITMAP response
5793 */ 5788 */
5794static int nfs4_xdr_dec_server_caps(struct rpc_rqst *req, __be32 *p, struct nfs4_server_caps_res *res) 5789static int nfs4_xdr_dec_server_caps(struct rpc_rqst *req,
5790 struct xdr_stream *xdr,
5791 struct nfs4_server_caps_res *res)
5795{ 5792{
5796 struct xdr_stream xdr;
5797 struct compound_hdr hdr; 5793 struct compound_hdr hdr;
5798 int status; 5794 int status;
5799 5795
5800 xdr_init_decode(&xdr, &req->rq_rcv_buf, p); 5796 status = decode_compound_hdr(xdr, &hdr);
5801 status = decode_compound_hdr(&xdr, &hdr);
5802 if (status) 5797 if (status)
5803 goto out; 5798 goto out;
5804 status = decode_sequence(&xdr, &res->seq_res, req); 5799 status = decode_sequence(xdr, &res->seq_res, req);
5805 if (status) 5800 if (status)
5806 goto out; 5801 goto out;
5807 if ((status = decode_putfh(&xdr)) != 0) 5802 status = decode_putfh(xdr);
5803 if (status)
5808 goto out; 5804 goto out;
5809 status = decode_server_caps(&xdr, res); 5805 status = decode_server_caps(xdr, res);
5810out: 5806out:
5811 return status; 5807 return status;
5812} 5808}
@@ -5814,79 +5810,77 @@ out:
5814/* 5810/*
5815 * Decode RENEW response 5811 * Decode RENEW response
5816 */ 5812 */
5817static int nfs4_xdr_dec_renew(struct rpc_rqst *rqstp, __be32 *p, void *dummy) 5813static int nfs4_xdr_dec_renew(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
5814 void *__unused)
5818{ 5815{
5819 struct xdr_stream xdr;
5820 struct compound_hdr hdr; 5816 struct compound_hdr hdr;
5821 int status; 5817 int status;
5822 5818
5823 xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); 5819 status = decode_compound_hdr(xdr, &hdr);
5824 status = decode_compound_hdr(&xdr, &hdr);
5825 if (!status) 5820 if (!status)
5826 status = decode_renew(&xdr); 5821 status = decode_renew(xdr);
5827 return status; 5822 return status;
5828} 5823}
5829 5824
5830/* 5825/*
5831 * Decode SETCLIENTID response 5826 * Decode SETCLIENTID response
5832 */ 5827 */
5833static int nfs4_xdr_dec_setclientid(struct rpc_rqst *req, __be32 *p, 5828static int nfs4_xdr_dec_setclientid(struct rpc_rqst *req,
5834 struct nfs4_setclientid_res *res) 5829 struct xdr_stream *xdr,
5830 struct nfs4_setclientid_res *res)
5835{ 5831{
5836 struct xdr_stream xdr;
5837 struct compound_hdr hdr; 5832 struct compound_hdr hdr;
5838 int status; 5833 int status;
5839 5834
5840 xdr_init_decode(&xdr, &req->rq_rcv_buf, p); 5835 status = decode_compound_hdr(xdr, &hdr);
5841 status = decode_compound_hdr(&xdr, &hdr);
5842 if (!status) 5836 if (!status)
5843 status = decode_setclientid(&xdr, res); 5837 status = decode_setclientid(xdr, res);
5844 return status; 5838 return status;
5845} 5839}
5846 5840
5847/* 5841/*
5848 * Decode SETCLIENTID_CONFIRM response 5842 * Decode SETCLIENTID_CONFIRM response
5849 */ 5843 */
5850static int nfs4_xdr_dec_setclientid_confirm(struct rpc_rqst *req, __be32 *p, struct nfs_fsinfo *fsinfo) 5844static int nfs4_xdr_dec_setclientid_confirm(struct rpc_rqst *req,
5845 struct xdr_stream *xdr,
5846 struct nfs_fsinfo *fsinfo)
5851{ 5847{
5852 struct xdr_stream xdr;
5853 struct compound_hdr hdr; 5848 struct compound_hdr hdr;
5854 int status; 5849 int status;
5855 5850
5856 xdr_init_decode(&xdr, &req->rq_rcv_buf, p); 5851 status = decode_compound_hdr(xdr, &hdr);
5857 status = decode_compound_hdr(&xdr, &hdr);
5858 if (!status) 5852 if (!status)
5859 status = decode_setclientid_confirm(&xdr); 5853 status = decode_setclientid_confirm(xdr);
5860 if (!status) 5854 if (!status)
5861 status = decode_putrootfh(&xdr); 5855 status = decode_putrootfh(xdr);
5862 if (!status) 5856 if (!status)
5863 status = decode_fsinfo(&xdr, fsinfo); 5857 status = decode_fsinfo(xdr, fsinfo);
5864 return status; 5858 return status;
5865} 5859}
5866 5860
5867/* 5861/*
5868 * Decode DELEGRETURN response 5862 * Decode DELEGRETURN response
5869 */ 5863 */
5870static int nfs4_xdr_dec_delegreturn(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_delegreturnres *res) 5864static int nfs4_xdr_dec_delegreturn(struct rpc_rqst *rqstp,
5865 struct xdr_stream *xdr,
5866 struct nfs4_delegreturnres *res)
5871{ 5867{
5872 struct xdr_stream xdr;
5873 struct compound_hdr hdr; 5868 struct compound_hdr hdr;
5874 int status; 5869 int status;
5875 5870
5876 xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); 5871 status = decode_compound_hdr(xdr, &hdr);
5877 status = decode_compound_hdr(&xdr, &hdr);
5878 if (status) 5872 if (status)
5879 goto out; 5873 goto out;
5880 status = decode_sequence(&xdr, &res->seq_res, rqstp); 5874 status = decode_sequence(xdr, &res->seq_res, rqstp);
5881 if (status) 5875 if (status)
5882 goto out; 5876 goto out;
5883 status = decode_putfh(&xdr); 5877 status = decode_putfh(xdr);
5884 if (status != 0) 5878 if (status != 0)
5885 goto out; 5879 goto out;
5886 status = decode_delegreturn(&xdr); 5880 status = decode_delegreturn(xdr);
5887 if (status != 0) 5881 if (status != 0)
5888 goto out; 5882 goto out;
5889 decode_getfattr(&xdr, res->fattr, res->server, 5883 decode_getfattr(xdr, res->fattr, res->server,
5890 !RPC_IS_ASYNC(rqstp->rq_task)); 5884 !RPC_IS_ASYNC(rqstp->rq_task));
5891out: 5885out:
5892 return status; 5886 return status;
@@ -5895,26 +5889,27 @@ out:
5895/* 5889/*
5896 * Decode FS_LOCATIONS response 5890 * Decode FS_LOCATIONS response
5897 */ 5891 */
5898static int nfs4_xdr_dec_fs_locations(struct rpc_rqst *req, __be32 *p, 5892static int nfs4_xdr_dec_fs_locations(struct rpc_rqst *req,
5893 struct xdr_stream *xdr,
5899 struct nfs4_fs_locations_res *res) 5894 struct nfs4_fs_locations_res *res)
5900{ 5895{
5901 struct xdr_stream xdr;
5902 struct compound_hdr hdr; 5896 struct compound_hdr hdr;
5903 int status; 5897 int status;
5904 5898
5905 xdr_init_decode(&xdr, &req->rq_rcv_buf, p); 5899 status = decode_compound_hdr(xdr, &hdr);
5906 status = decode_compound_hdr(&xdr, &hdr);
5907 if (status) 5900 if (status)
5908 goto out; 5901 goto out;
5909 status = decode_sequence(&xdr, &res->seq_res, req); 5902 status = decode_sequence(xdr, &res->seq_res, req);
5910 if (status) 5903 if (status)
5911 goto out; 5904 goto out;
5912 if ((status = decode_putfh(&xdr)) != 0) 5905 status = decode_putfh(xdr);
5906 if (status)
5913 goto out; 5907 goto out;
5914 if ((status = decode_lookup(&xdr)) != 0) 5908 status = decode_lookup(xdr);
5909 if (status)
5915 goto out; 5910 goto out;
5916 xdr_enter_page(&xdr, PAGE_SIZE); 5911 xdr_enter_page(xdr, PAGE_SIZE);
5917 status = decode_getfattr(&xdr, &res->fs_locations->fattr, 5912 status = decode_getfattr(xdr, &res->fs_locations->fattr,
5918 res->fs_locations->server, 5913 res->fs_locations->server,
5919 !RPC_IS_ASYNC(req->rq_task)); 5914 !RPC_IS_ASYNC(req->rq_task));
5920out: 5915out:
@@ -5925,129 +5920,122 @@ out:
5925/* 5920/*
5926 * Decode EXCHANGE_ID response 5921 * Decode EXCHANGE_ID response
5927 */ 5922 */
5928static int nfs4_xdr_dec_exchange_id(struct rpc_rqst *rqstp, uint32_t *p, 5923static int nfs4_xdr_dec_exchange_id(struct rpc_rqst *rqstp,
5924 struct xdr_stream *xdr,
5929 void *res) 5925 void *res)
5930{ 5926{
5931 struct xdr_stream xdr;
5932 struct compound_hdr hdr; 5927 struct compound_hdr hdr;
5933 int status; 5928 int status;
5934 5929
5935 xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); 5930 status = decode_compound_hdr(xdr, &hdr);
5936 status = decode_compound_hdr(&xdr, &hdr);
5937 if (!status) 5931 if (!status)
5938 status = decode_exchange_id(&xdr, res); 5932 status = decode_exchange_id(xdr, res);
5939 return status; 5933 return status;
5940} 5934}
5941 5935
5942/* 5936/*
5943 * Decode CREATE_SESSION response 5937 * Decode CREATE_SESSION response
5944 */ 5938 */
5945static int nfs4_xdr_dec_create_session(struct rpc_rqst *rqstp, uint32_t *p, 5939static int nfs4_xdr_dec_create_session(struct rpc_rqst *rqstp,
5940 struct xdr_stream *xdr,
5946 struct nfs41_create_session_res *res) 5941 struct nfs41_create_session_res *res)
5947{ 5942{
5948 struct xdr_stream xdr;
5949 struct compound_hdr hdr; 5943 struct compound_hdr hdr;
5950 int status; 5944 int status;
5951 5945
5952 xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); 5946 status = decode_compound_hdr(xdr, &hdr);
5953 status = decode_compound_hdr(&xdr, &hdr);
5954 if (!status) 5947 if (!status)
5955 status = decode_create_session(&xdr, res); 5948 status = decode_create_session(xdr, res);
5956 return status; 5949 return status;
5957} 5950}
5958 5951
5959/* 5952/*
5960 * Decode DESTROY_SESSION response 5953 * Decode DESTROY_SESSION response
5961 */ 5954 */
5962static int nfs4_xdr_dec_destroy_session(struct rpc_rqst *rqstp, uint32_t *p, 5955static int nfs4_xdr_dec_destroy_session(struct rpc_rqst *rqstp,
5963 void *dummy) 5956 struct xdr_stream *xdr,
5957 void *res)
5964{ 5958{
5965 struct xdr_stream xdr;
5966 struct compound_hdr hdr; 5959 struct compound_hdr hdr;
5967 int status; 5960 int status;
5968 5961
5969 xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); 5962 status = decode_compound_hdr(xdr, &hdr);
5970 status = decode_compound_hdr(&xdr, &hdr);
5971 if (!status) 5963 if (!status)
5972 status = decode_destroy_session(&xdr, dummy); 5964 status = decode_destroy_session(xdr, res);
5973 return status; 5965 return status;
5974} 5966}
5975 5967
5976/* 5968/*
5977 * Decode SEQUENCE response 5969 * Decode SEQUENCE response
5978 */ 5970 */
5979static int nfs4_xdr_dec_sequence(struct rpc_rqst *rqstp, uint32_t *p, 5971static int nfs4_xdr_dec_sequence(struct rpc_rqst *rqstp,
5972 struct xdr_stream *xdr,
5980 struct nfs4_sequence_res *res) 5973 struct nfs4_sequence_res *res)
5981{ 5974{
5982 struct xdr_stream xdr;
5983 struct compound_hdr hdr; 5975 struct compound_hdr hdr;
5984 int status; 5976 int status;
5985 5977
5986 xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); 5978 status = decode_compound_hdr(xdr, &hdr);
5987 status = decode_compound_hdr(&xdr, &hdr);
5988 if (!status) 5979 if (!status)
5989 status = decode_sequence(&xdr, res, rqstp); 5980 status = decode_sequence(xdr, res, rqstp);
5990 return status; 5981 return status;
5991} 5982}
5992 5983
5993/* 5984/*
5994 * Decode GET_LEASE_TIME response 5985 * Decode GET_LEASE_TIME response
5995 */ 5986 */
5996static int nfs4_xdr_dec_get_lease_time(struct rpc_rqst *rqstp, uint32_t *p, 5987static int nfs4_xdr_dec_get_lease_time(struct rpc_rqst *rqstp,
5988 struct xdr_stream *xdr,
5997 struct nfs4_get_lease_time_res *res) 5989 struct nfs4_get_lease_time_res *res)
5998{ 5990{
5999 struct xdr_stream xdr;
6000 struct compound_hdr hdr; 5991 struct compound_hdr hdr;
6001 int status; 5992 int status;
6002 5993
6003 xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); 5994 status = decode_compound_hdr(xdr, &hdr);
6004 status = decode_compound_hdr(&xdr, &hdr);
6005 if (!status) 5995 if (!status)
6006 status = decode_sequence(&xdr, &res->lr_seq_res, rqstp); 5996 status = decode_sequence(xdr, &res->lr_seq_res, rqstp);
6007 if (!status) 5997 if (!status)
6008 status = decode_putrootfh(&xdr); 5998 status = decode_putrootfh(xdr);
6009 if (!status) 5999 if (!status)
6010 status = decode_fsinfo(&xdr, res->lr_fsinfo); 6000 status = decode_fsinfo(xdr, res->lr_fsinfo);
6011 return status; 6001 return status;
6012} 6002}
6013 6003
6014/* 6004/*
6015 * Decode RECLAIM_COMPLETE response 6005 * Decode RECLAIM_COMPLETE response
6016 */ 6006 */
6017static int nfs4_xdr_dec_reclaim_complete(struct rpc_rqst *rqstp, uint32_t *p, 6007static int nfs4_xdr_dec_reclaim_complete(struct rpc_rqst *rqstp,
6008 struct xdr_stream *xdr,
6018 struct nfs41_reclaim_complete_res *res) 6009 struct nfs41_reclaim_complete_res *res)
6019{ 6010{
6020 struct xdr_stream xdr;
6021 struct compound_hdr hdr; 6011 struct compound_hdr hdr;
6022 int status; 6012 int status;
6023 6013
6024 xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); 6014 status = decode_compound_hdr(xdr, &hdr);
6025 status = decode_compound_hdr(&xdr, &hdr);
6026 if (!status) 6015 if (!status)
6027 status = decode_sequence(&xdr, &res->seq_res, rqstp); 6016 status = decode_sequence(xdr, &res->seq_res, rqstp);
6028 if (!status) 6017 if (!status)
6029 status = decode_reclaim_complete(&xdr, (void *)NULL); 6018 status = decode_reclaim_complete(xdr, (void *)NULL);
6030 return status; 6019 return status;
6031} 6020}
6032 6021
6033/* 6022/*
6034 * Decode GETDEVINFO response 6023 * Decode GETDEVINFO response
6035 */ 6024 */
6036static int nfs4_xdr_dec_getdeviceinfo(struct rpc_rqst *rqstp, uint32_t *p, 6025static int nfs4_xdr_dec_getdeviceinfo(struct rpc_rqst *rqstp,
6026 struct xdr_stream *xdr,
6037 struct nfs4_getdeviceinfo_res *res) 6027 struct nfs4_getdeviceinfo_res *res)
6038{ 6028{
6039 struct xdr_stream xdr;
6040 struct compound_hdr hdr; 6029 struct compound_hdr hdr;
6041 int status; 6030 int status;
6042 6031
6043 xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); 6032 status = decode_compound_hdr(xdr, &hdr);
6044 status = decode_compound_hdr(&xdr, &hdr);
6045 if (status != 0) 6033 if (status != 0)
6046 goto out; 6034 goto out;
6047 status = decode_sequence(&xdr, &res->seq_res, rqstp); 6035 status = decode_sequence(xdr, &res->seq_res, rqstp);
6048 if (status != 0) 6036 if (status != 0)
6049 goto out; 6037 goto out;
6050 status = decode_getdeviceinfo(&xdr, res->pdev); 6038 status = decode_getdeviceinfo(xdr, res->pdev);
6051out: 6039out:
6052 return status; 6040 return status;
6053} 6041}
@@ -6055,24 +6043,23 @@ out:
6055/* 6043/*
6056 * Decode LAYOUTGET response 6044 * Decode LAYOUTGET response
6057 */ 6045 */
6058static int nfs4_xdr_dec_layoutget(struct rpc_rqst *rqstp, uint32_t *p, 6046static int nfs4_xdr_dec_layoutget(struct rpc_rqst *rqstp,
6047 struct xdr_stream *xdr,
6059 struct nfs4_layoutget_res *res) 6048 struct nfs4_layoutget_res *res)
6060{ 6049{
6061 struct xdr_stream xdr;
6062 struct compound_hdr hdr; 6050 struct compound_hdr hdr;
6063 int status; 6051 int status;
6064 6052
6065 xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); 6053 status = decode_compound_hdr(xdr, &hdr);
6066 status = decode_compound_hdr(&xdr, &hdr);
6067 if (status) 6054 if (status)
6068 goto out; 6055 goto out;
6069 status = decode_sequence(&xdr, &res->seq_res, rqstp); 6056 status = decode_sequence(xdr, &res->seq_res, rqstp);
6070 if (status) 6057 if (status)
6071 goto out; 6058 goto out;
6072 status = decode_putfh(&xdr); 6059 status = decode_putfh(xdr);
6073 if (status) 6060 if (status)
6074 goto out; 6061 goto out;
6075 status = decode_layoutget(&xdr, rqstp, res); 6062 status = decode_layoutget(xdr, rqstp, res);
6076out: 6063out:
6077 return status; 6064 return status;
6078} 6065}
@@ -6236,7 +6223,7 @@ nfs4_stat_to_errno(int stat)
6236[NFSPROC4_CLNT_##proc] = { \ 6223[NFSPROC4_CLNT_##proc] = { \
6237 .p_proc = NFSPROC4_COMPOUND, \ 6224 .p_proc = NFSPROC4_COMPOUND, \
6238 .p_encode = (kxdreproc_t)nfs4_xdr_##argtype, \ 6225 .p_encode = (kxdreproc_t)nfs4_xdr_##argtype, \
6239 .p_decode = (kxdrproc_t)nfs4_xdr_##restype, \ 6226 .p_decode = (kxdrdproc_t)nfs4_xdr_##restype, \
6240 .p_arglen = NFS4_##argtype##_sz, \ 6227 .p_arglen = NFS4_##argtype##_sz, \
6241 .p_replen = NFS4_##restype##_sz, \ 6228 .p_replen = NFS4_##restype##_sz, \
6242 .p_statidx = NFSPROC4_CLNT_##proc, \ 6229 .p_statidx = NFSPROC4_CLNT_##proc, \
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index c363efda8ecf..21a63da305ff 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -533,7 +533,8 @@ static void nfs4_xdr_enc_cb_recall(struct rpc_rqst *req, struct xdr_stream *xdr,
533 * Protocol". 533 * Protocol".
534 */ 534 */
535 535
536static int nfs4_xdr_dec_cb_null(struct rpc_rqst *req, __be32 *p, void *__unused) 536static int nfs4_xdr_dec_cb_null(struct rpc_rqst *req, struct xdr_stream *xdr,
537 void *__unused)
537{ 538{
538 return 0; 539 return 0;
539} 540}
@@ -541,26 +542,25 @@ static int nfs4_xdr_dec_cb_null(struct rpc_rqst *req, __be32 *p, void *__unused)
541/* 542/*
542 * 20.2. Operation 4: CB_RECALL - Recall a Delegation 543 * 20.2. Operation 4: CB_RECALL - Recall a Delegation
543 */ 544 */
544static int nfs4_xdr_dec_cb_recall(struct rpc_rqst *rqstp, __be32 *p, 545static int nfs4_xdr_dec_cb_recall(struct rpc_rqst *rqstp,
546 struct xdr_stream *xdr,
545 struct nfsd4_callback *cb) 547 struct nfsd4_callback *cb)
546{ 548{
547 struct xdr_stream xdr;
548 struct nfs4_cb_compound_hdr hdr; 549 struct nfs4_cb_compound_hdr hdr;
549 enum nfsstat4 nfserr; 550 enum nfsstat4 nfserr;
550 int status; 551 int status;
551 552
552 xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); 553 status = decode_cb_compound4res(xdr, &hdr);
553 status = decode_cb_compound4res(&xdr, &hdr);
554 if (unlikely(status)) 554 if (unlikely(status))
555 goto out; 555 goto out;
556 556
557 if (cb != NULL) { 557 if (cb != NULL) {
558 status = decode_cb_sequence4res(&xdr, cb); 558 status = decode_cb_sequence4res(xdr, cb);
559 if (unlikely(status)) 559 if (unlikely(status))
560 goto out; 560 goto out;
561 } 561 }
562 562
563 status = decode_cb_op_status(&xdr, OP_CB_RECALL, &nfserr); 563 status = decode_cb_op_status(xdr, OP_CB_RECALL, &nfserr);
564 if (unlikely(status)) 564 if (unlikely(status))
565 goto out; 565 goto out;
566 if (unlikely(nfserr != NFS4_OK)) 566 if (unlikely(nfserr != NFS4_OK))
@@ -578,7 +578,7 @@ out_default:
578[NFSPROC4_CLNT_##proc] = { \ 578[NFSPROC4_CLNT_##proc] = { \
579 .p_proc = NFSPROC4_CB_##call, \ 579 .p_proc = NFSPROC4_CB_##call, \
580 .p_encode = (kxdreproc_t)nfs4_xdr_enc_##argtype, \ 580 .p_encode = (kxdreproc_t)nfs4_xdr_enc_##argtype, \
581 .p_decode = (kxdrproc_t)nfs4_xdr_dec_##restype, \ 581 .p_decode = (kxdrdproc_t)nfs4_xdr_dec_##restype, \
582 .p_arglen = NFS4_enc_##argtype##_sz, \ 582 .p_arglen = NFS4_enc_##argtype##_sz, \
583 .p_replen = NFS4_dec_##restype##_sz, \ 583 .p_replen = NFS4_dec_##restype##_sz, \
584 .p_statidx = NFSPROC4_CB_##call, \ 584 .p_statidx = NFSPROC4_CB_##call, \