diff options
Diffstat (limited to 'fs/nfs/nfs4xdr.c')
-rw-r--r-- | fs/nfs/nfs4xdr.c | 1235 |
1 files changed, 543 insertions, 692 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index b916297d2334..d1e4c8f8a0a9 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -8,7 +8,7 @@ | |||
8 | * | 8 | * |
9 | * Kendrick Smith <kmsmith@umich.edu> | 9 | * Kendrick Smith <kmsmith@umich.edu> |
10 | * Andy Adamson <andros@umich.edu> | 10 | * Andy Adamson <andros@umich.edu> |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
13 | * modification, are permitted provided that the following conditions | 13 | * modification, are permitted provided that the following conditions |
14 | * are met: | 14 | * are met: |
@@ -67,7 +67,7 @@ static int nfs4_stat_to_errno(int); | |||
67 | #define NFS4_MAXTAGLEN 0 | 67 | #define NFS4_MAXTAGLEN 0 |
68 | #endif | 68 | #endif |
69 | 69 | ||
70 | /* lock,open owner id: | 70 | /* lock,open owner id: |
71 | * we currently use size 2 (u64) out of (NFS4_OPAQUE_LIMIT >> 2) | 71 | * we currently use size 2 (u64) out of (NFS4_OPAQUE_LIMIT >> 2) |
72 | */ | 72 | */ |
73 | #define open_owner_id_maxsz (1 + 4) | 73 | #define open_owner_id_maxsz (1 + 4) |
@@ -541,6 +541,7 @@ static struct { | |||
541 | struct compound_hdr { | 541 | struct compound_hdr { |
542 | int32_t status; | 542 | int32_t status; |
543 | uint32_t nops; | 543 | uint32_t nops; |
544 | __be32 * nops_p; | ||
544 | uint32_t taglen; | 545 | uint32_t taglen; |
545 | char * tag; | 546 | char * tag; |
546 | }; | 547 | }; |
@@ -578,7 +579,7 @@ static void encode_string(struct xdr_stream *xdr, unsigned int len, const char * | |||
578 | xdr_encode_opaque(p, str, len); | 579 | xdr_encode_opaque(p, str, len); |
579 | } | 580 | } |
580 | 581 | ||
581 | static int encode_compound_hdr(struct xdr_stream *xdr, struct compound_hdr *hdr) | 582 | static void encode_compound_hdr(struct xdr_stream *xdr, struct compound_hdr *hdr) |
582 | { | 583 | { |
583 | __be32 *p; | 584 | __be32 *p; |
584 | 585 | ||
@@ -588,8 +589,13 @@ static int encode_compound_hdr(struct xdr_stream *xdr, struct compound_hdr *hdr) | |||
588 | WRITE32(hdr->taglen); | 589 | WRITE32(hdr->taglen); |
589 | WRITEMEM(hdr->tag, hdr->taglen); | 590 | WRITEMEM(hdr->tag, hdr->taglen); |
590 | WRITE32(NFS4_MINOR_VERSION); | 591 | WRITE32(NFS4_MINOR_VERSION); |
592 | hdr->nops_p = p; | ||
591 | WRITE32(hdr->nops); | 593 | WRITE32(hdr->nops); |
592 | return 0; | 594 | } |
595 | |||
596 | static void encode_nops(struct compound_hdr *hdr) | ||
597 | { | ||
598 | *hdr->nops_p = htonl(hdr->nops); | ||
593 | } | 599 | } |
594 | 600 | ||
595 | static void encode_nfs4_verifier(struct xdr_stream *xdr, const nfs4_verifier *verf) | 601 | static void encode_nfs4_verifier(struct xdr_stream *xdr, const nfs4_verifier *verf) |
@@ -601,7 +607,7 @@ static void encode_nfs4_verifier(struct xdr_stream *xdr, const nfs4_verifier *ve | |||
601 | xdr_encode_opaque_fixed(p, verf->data, NFS4_VERIFIER_SIZE); | 607 | xdr_encode_opaque_fixed(p, verf->data, NFS4_VERIFIER_SIZE); |
602 | } | 608 | } |
603 | 609 | ||
604 | static int encode_attrs(struct xdr_stream *xdr, const struct iattr *iap, const struct nfs_server *server) | 610 | static void encode_attrs(struct xdr_stream *xdr, const struct iattr *iap, const struct nfs_server *server) |
605 | { | 611 | { |
606 | char owner_name[IDMAP_NAMESZ]; | 612 | char owner_name[IDMAP_NAMESZ]; |
607 | char owner_group[IDMAP_NAMESZ]; | 613 | char owner_group[IDMAP_NAMESZ]; |
@@ -612,7 +618,6 @@ static int encode_attrs(struct xdr_stream *xdr, const struct iattr *iap, const s | |||
612 | int len; | 618 | int len; |
613 | uint32_t bmval0 = 0; | 619 | uint32_t bmval0 = 0; |
614 | uint32_t bmval1 = 0; | 620 | uint32_t bmval1 = 0; |
615 | int status; | ||
616 | 621 | ||
617 | /* | 622 | /* |
618 | * We reserve enough space to write the entire attribute buffer at once. | 623 | * We reserve enough space to write the entire attribute buffer at once. |
@@ -709,7 +714,7 @@ static int encode_attrs(struct xdr_stream *xdr, const struct iattr *iap, const s | |||
709 | bmval1 |= FATTR4_WORD1_TIME_MODIFY_SET; | 714 | bmval1 |= FATTR4_WORD1_TIME_MODIFY_SET; |
710 | WRITE32(NFS4_SET_TO_SERVER_TIME); | 715 | WRITE32(NFS4_SET_TO_SERVER_TIME); |
711 | } | 716 | } |
712 | 717 | ||
713 | /* | 718 | /* |
714 | * Now we backfill the bitmap and the attribute buffer length. | 719 | * Now we backfill the bitmap and the attribute buffer length. |
715 | */ | 720 | */ |
@@ -723,23 +728,20 @@ static int encode_attrs(struct xdr_stream *xdr, const struct iattr *iap, const s | |||
723 | *q++ = htonl(bmval1); | 728 | *q++ = htonl(bmval1); |
724 | *q++ = htonl(len); | 729 | *q++ = htonl(len); |
725 | 730 | ||
726 | status = 0; | ||
727 | /* out: */ | 731 | /* out: */ |
728 | return status; | ||
729 | } | 732 | } |
730 | 733 | ||
731 | static int encode_access(struct xdr_stream *xdr, u32 access) | 734 | static void encode_access(struct xdr_stream *xdr, u32 access, struct compound_hdr *hdr) |
732 | { | 735 | { |
733 | __be32 *p; | 736 | __be32 *p; |
734 | 737 | ||
735 | RESERVE_SPACE(8); | 738 | RESERVE_SPACE(8); |
736 | WRITE32(OP_ACCESS); | 739 | WRITE32(OP_ACCESS); |
737 | WRITE32(access); | 740 | WRITE32(access); |
738 | 741 | hdr->nops++; | |
739 | return 0; | ||
740 | } | 742 | } |
741 | 743 | ||
742 | static int encode_close(struct xdr_stream *xdr, const struct nfs_closeargs *arg) | 744 | static void encode_close(struct xdr_stream *xdr, const struct nfs_closeargs *arg, struct compound_hdr *hdr) |
743 | { | 745 | { |
744 | __be32 *p; | 746 | __be32 *p; |
745 | 747 | ||
@@ -747,26 +749,24 @@ static int encode_close(struct xdr_stream *xdr, const struct nfs_closeargs *arg) | |||
747 | WRITE32(OP_CLOSE); | 749 | WRITE32(OP_CLOSE); |
748 | WRITE32(arg->seqid->sequence->counter); | 750 | WRITE32(arg->seqid->sequence->counter); |
749 | WRITEMEM(arg->stateid->data, NFS4_STATEID_SIZE); | 751 | WRITEMEM(arg->stateid->data, NFS4_STATEID_SIZE); |
750 | 752 | hdr->nops++; | |
751 | return 0; | ||
752 | } | 753 | } |
753 | 754 | ||
754 | static int encode_commit(struct xdr_stream *xdr, const struct nfs_writeargs *args) | 755 | static void encode_commit(struct xdr_stream *xdr, const struct nfs_writeargs *args, struct compound_hdr *hdr) |
755 | { | 756 | { |
756 | __be32 *p; | 757 | __be32 *p; |
757 | |||
758 | RESERVE_SPACE(16); | ||
759 | WRITE32(OP_COMMIT); | ||
760 | WRITE64(args->offset); | ||
761 | WRITE32(args->count); | ||
762 | 758 | ||
763 | return 0; | 759 | RESERVE_SPACE(16); |
760 | WRITE32(OP_COMMIT); | ||
761 | WRITE64(args->offset); | ||
762 | WRITE32(args->count); | ||
763 | hdr->nops++; | ||
764 | } | 764 | } |
765 | 765 | ||
766 | static int encode_create(struct xdr_stream *xdr, const struct nfs4_create_arg *create) | 766 | static void encode_create(struct xdr_stream *xdr, const struct nfs4_create_arg *create, struct compound_hdr *hdr) |
767 | { | 767 | { |
768 | __be32 *p; | 768 | __be32 *p; |
769 | 769 | ||
770 | RESERVE_SPACE(8); | 770 | RESERVE_SPACE(8); |
771 | WRITE32(OP_CREATE); | 771 | WRITE32(OP_CREATE); |
772 | WRITE32(create->ftype); | 772 | WRITE32(create->ftype); |
@@ -791,64 +791,62 @@ static int encode_create(struct xdr_stream *xdr, const struct nfs4_create_arg *c | |||
791 | RESERVE_SPACE(4 + create->name->len); | 791 | RESERVE_SPACE(4 + create->name->len); |
792 | WRITE32(create->name->len); | 792 | WRITE32(create->name->len); |
793 | WRITEMEM(create->name->name, create->name->len); | 793 | WRITEMEM(create->name->name, create->name->len); |
794 | hdr->nops++; | ||
794 | 795 | ||
795 | return encode_attrs(xdr, create->attrs, create->server); | 796 | encode_attrs(xdr, create->attrs, create->server); |
796 | } | 797 | } |
797 | 798 | ||
798 | static int encode_getattr_one(struct xdr_stream *xdr, uint32_t bitmap) | 799 | static void encode_getattr_one(struct xdr_stream *xdr, uint32_t bitmap, struct compound_hdr *hdr) |
799 | { | 800 | { |
800 | __be32 *p; | 801 | __be32 *p; |
801 | 802 | ||
802 | RESERVE_SPACE(12); | 803 | RESERVE_SPACE(12); |
803 | WRITE32(OP_GETATTR); | 804 | WRITE32(OP_GETATTR); |
804 | WRITE32(1); | 805 | WRITE32(1); |
805 | WRITE32(bitmap); | 806 | WRITE32(bitmap); |
806 | return 0; | 807 | hdr->nops++; |
807 | } | 808 | } |
808 | 809 | ||
809 | static int encode_getattr_two(struct xdr_stream *xdr, uint32_t bm0, uint32_t bm1) | 810 | static void encode_getattr_two(struct xdr_stream *xdr, uint32_t bm0, uint32_t bm1, struct compound_hdr *hdr) |
810 | { | 811 | { |
811 | __be32 *p; | 812 | __be32 *p; |
812 | 813 | ||
813 | RESERVE_SPACE(16); | 814 | RESERVE_SPACE(16); |
814 | WRITE32(OP_GETATTR); | 815 | WRITE32(OP_GETATTR); |
815 | WRITE32(2); | 816 | WRITE32(2); |
816 | WRITE32(bm0); | 817 | WRITE32(bm0); |
817 | WRITE32(bm1); | 818 | WRITE32(bm1); |
818 | return 0; | 819 | hdr->nops++; |
819 | } | 820 | } |
820 | 821 | ||
821 | static int encode_getfattr(struct xdr_stream *xdr, const u32* bitmask) | 822 | static void encode_getfattr(struct xdr_stream *xdr, const u32* bitmask, struct compound_hdr *hdr) |
822 | { | 823 | { |
823 | return encode_getattr_two(xdr, | 824 | encode_getattr_two(xdr, bitmask[0] & nfs4_fattr_bitmap[0], |
824 | bitmask[0] & nfs4_fattr_bitmap[0], | 825 | bitmask[1] & nfs4_fattr_bitmap[1], hdr); |
825 | bitmask[1] & nfs4_fattr_bitmap[1]); | ||
826 | } | 826 | } |
827 | 827 | ||
828 | static int encode_fsinfo(struct xdr_stream *xdr, const u32* bitmask) | 828 | static void encode_fsinfo(struct xdr_stream *xdr, const u32* bitmask, struct compound_hdr *hdr) |
829 | { | 829 | { |
830 | return encode_getattr_two(xdr, bitmask[0] & nfs4_fsinfo_bitmap[0], | 830 | encode_getattr_two(xdr, bitmask[0] & nfs4_fsinfo_bitmap[0], |
831 | bitmask[1] & nfs4_fsinfo_bitmap[1]); | 831 | bitmask[1] & nfs4_fsinfo_bitmap[1], hdr); |
832 | } | 832 | } |
833 | 833 | ||
834 | static int encode_fs_locations(struct xdr_stream *xdr, const u32* bitmask) | 834 | static void encode_fs_locations(struct xdr_stream *xdr, const u32* bitmask, struct compound_hdr *hdr) |
835 | { | 835 | { |
836 | return encode_getattr_two(xdr, | 836 | encode_getattr_two(xdr, bitmask[0] & nfs4_fs_locations_bitmap[0], |
837 | bitmask[0] & nfs4_fs_locations_bitmap[0], | 837 | bitmask[1] & nfs4_fs_locations_bitmap[1], hdr); |
838 | bitmask[1] & nfs4_fs_locations_bitmap[1]); | ||
839 | } | 838 | } |
840 | 839 | ||
841 | static int encode_getfh(struct xdr_stream *xdr) | 840 | static void encode_getfh(struct xdr_stream *xdr, struct compound_hdr *hdr) |
842 | { | 841 | { |
843 | __be32 *p; | 842 | __be32 *p; |
844 | 843 | ||
845 | RESERVE_SPACE(4); | 844 | RESERVE_SPACE(4); |
846 | WRITE32(OP_GETFH); | 845 | WRITE32(OP_GETFH); |
847 | 846 | hdr->nops++; | |
848 | return 0; | ||
849 | } | 847 | } |
850 | 848 | ||
851 | static int encode_link(struct xdr_stream *xdr, const struct qstr *name) | 849 | static void encode_link(struct xdr_stream *xdr, const struct qstr *name, struct compound_hdr *hdr) |
852 | { | 850 | { |
853 | __be32 *p; | 851 | __be32 *p; |
854 | 852 | ||
@@ -856,8 +854,7 @@ static int encode_link(struct xdr_stream *xdr, const struct qstr *name) | |||
856 | WRITE32(OP_LINK); | 854 | WRITE32(OP_LINK); |
857 | WRITE32(name->len); | 855 | WRITE32(name->len); |
858 | WRITEMEM(name->name, name->len); | 856 | WRITEMEM(name->name, name->len); |
859 | 857 | hdr->nops++; | |
860 | return 0; | ||
861 | } | 858 | } |
862 | 859 | ||
863 | static inline int nfs4_lock_type(struct file_lock *fl, int block) | 860 | static inline int nfs4_lock_type(struct file_lock *fl, int block) |
@@ -878,7 +875,7 @@ static inline uint64_t nfs4_lock_length(struct file_lock *fl) | |||
878 | * opcode,type,reclaim,offset,length,new_lock_owner = 32 | 875 | * opcode,type,reclaim,offset,length,new_lock_owner = 32 |
879 | * open_seqid,open_stateid,lock_seqid,lock_owner.clientid, lock_owner.id = 40 | 876 | * open_seqid,open_stateid,lock_seqid,lock_owner.clientid, lock_owner.id = 40 |
880 | */ | 877 | */ |
881 | static int encode_lock(struct xdr_stream *xdr, const struct nfs_lock_args *args) | 878 | static void encode_lock(struct xdr_stream *xdr, const struct nfs_lock_args *args, struct compound_hdr *hdr) |
882 | { | 879 | { |
883 | __be32 *p; | 880 | __be32 *p; |
884 | 881 | ||
@@ -904,11 +901,10 @@ static int encode_lock(struct xdr_stream *xdr, const struct nfs_lock_args *args) | |||
904 | WRITEMEM(args->lock_stateid->data, NFS4_STATEID_SIZE); | 901 | WRITEMEM(args->lock_stateid->data, NFS4_STATEID_SIZE); |
905 | WRITE32(args->lock_seqid->sequence->counter); | 902 | WRITE32(args->lock_seqid->sequence->counter); |
906 | } | 903 | } |
907 | 904 | hdr->nops++; | |
908 | return 0; | ||
909 | } | 905 | } |
910 | 906 | ||
911 | static int encode_lockt(struct xdr_stream *xdr, const struct nfs_lockt_args *args) | 907 | static void encode_lockt(struct xdr_stream *xdr, const struct nfs_lockt_args *args, struct compound_hdr *hdr) |
912 | { | 908 | { |
913 | __be32 *p; | 909 | __be32 *p; |
914 | 910 | ||
@@ -921,11 +917,10 @@ static int encode_lockt(struct xdr_stream *xdr, const struct nfs_lockt_args *arg | |||
921 | WRITE32(16); | 917 | WRITE32(16); |
922 | WRITEMEM("lock id:", 8); | 918 | WRITEMEM("lock id:", 8); |
923 | WRITE64(args->lock_owner.id); | 919 | WRITE64(args->lock_owner.id); |
924 | 920 | hdr->nops++; | |
925 | return 0; | ||
926 | } | 921 | } |
927 | 922 | ||
928 | static int encode_locku(struct xdr_stream *xdr, const struct nfs_locku_args *args) | 923 | static void encode_locku(struct xdr_stream *xdr, const struct nfs_locku_args *args, struct compound_hdr *hdr) |
929 | { | 924 | { |
930 | __be32 *p; | 925 | __be32 *p; |
931 | 926 | ||
@@ -936,11 +931,10 @@ static int encode_locku(struct xdr_stream *xdr, const struct nfs_locku_args *arg | |||
936 | WRITEMEM(args->stateid->data, NFS4_STATEID_SIZE); | 931 | WRITEMEM(args->stateid->data, NFS4_STATEID_SIZE); |
937 | WRITE64(args->fl->fl_start); | 932 | WRITE64(args->fl->fl_start); |
938 | WRITE64(nfs4_lock_length(args->fl)); | 933 | WRITE64(nfs4_lock_length(args->fl)); |
939 | 934 | hdr->nops++; | |
940 | return 0; | ||
941 | } | 935 | } |
942 | 936 | ||
943 | static int encode_lookup(struct xdr_stream *xdr, const struct qstr *name) | 937 | static void encode_lookup(struct xdr_stream *xdr, const struct qstr *name, struct compound_hdr *hdr) |
944 | { | 938 | { |
945 | int len = name->len; | 939 | int len = name->len; |
946 | __be32 *p; | 940 | __be32 *p; |
@@ -949,27 +943,26 @@ static int encode_lookup(struct xdr_stream *xdr, const struct qstr *name) | |||
949 | WRITE32(OP_LOOKUP); | 943 | WRITE32(OP_LOOKUP); |
950 | WRITE32(len); | 944 | WRITE32(len); |
951 | WRITEMEM(name->name, len); | 945 | WRITEMEM(name->name, len); |
952 | 946 | hdr->nops++; | |
953 | return 0; | ||
954 | } | 947 | } |
955 | 948 | ||
956 | static void encode_share_access(struct xdr_stream *xdr, int open_flags) | 949 | static void encode_share_access(struct xdr_stream *xdr, fmode_t fmode) |
957 | { | 950 | { |
958 | __be32 *p; | 951 | __be32 *p; |
959 | 952 | ||
960 | RESERVE_SPACE(8); | 953 | RESERVE_SPACE(8); |
961 | switch (open_flags & (FMODE_READ|FMODE_WRITE)) { | 954 | switch (fmode & (FMODE_READ|FMODE_WRITE)) { |
962 | case FMODE_READ: | 955 | case FMODE_READ: |
963 | WRITE32(NFS4_SHARE_ACCESS_READ); | 956 | WRITE32(NFS4_SHARE_ACCESS_READ); |
964 | break; | 957 | break; |
965 | case FMODE_WRITE: | 958 | case FMODE_WRITE: |
966 | WRITE32(NFS4_SHARE_ACCESS_WRITE); | 959 | WRITE32(NFS4_SHARE_ACCESS_WRITE); |
967 | break; | 960 | break; |
968 | case FMODE_READ|FMODE_WRITE: | 961 | case FMODE_READ|FMODE_WRITE: |
969 | WRITE32(NFS4_SHARE_ACCESS_BOTH); | 962 | WRITE32(NFS4_SHARE_ACCESS_BOTH); |
970 | break; | 963 | break; |
971 | default: | 964 | default: |
972 | BUG(); | 965 | WRITE32(0); |
973 | } | 966 | } |
974 | WRITE32(0); /* for linux, share_deny = 0 always */ | 967 | WRITE32(0); /* for linux, share_deny = 0 always */ |
975 | } | 968 | } |
@@ -984,7 +977,7 @@ static inline void encode_openhdr(struct xdr_stream *xdr, const struct nfs_opena | |||
984 | RESERVE_SPACE(8); | 977 | RESERVE_SPACE(8); |
985 | WRITE32(OP_OPEN); | 978 | WRITE32(OP_OPEN); |
986 | WRITE32(arg->seqid->sequence->counter); | 979 | WRITE32(arg->seqid->sequence->counter); |
987 | encode_share_access(xdr, arg->open_flags); | 980 | encode_share_access(xdr, arg->fmode); |
988 | RESERVE_SPACE(28); | 981 | RESERVE_SPACE(28); |
989 | WRITE64(arg->clientid); | 982 | WRITE64(arg->clientid); |
990 | WRITE32(16); | 983 | WRITE32(16); |
@@ -998,13 +991,13 @@ static inline void encode_createmode(struct xdr_stream *xdr, const struct nfs_op | |||
998 | 991 | ||
999 | RESERVE_SPACE(4); | 992 | RESERVE_SPACE(4); |
1000 | switch(arg->open_flags & O_EXCL) { | 993 | switch(arg->open_flags & O_EXCL) { |
1001 | case 0: | 994 | case 0: |
1002 | WRITE32(NFS4_CREATE_UNCHECKED); | 995 | WRITE32(NFS4_CREATE_UNCHECKED); |
1003 | encode_attrs(xdr, arg->u.attrs, arg->server); | 996 | encode_attrs(xdr, arg->u.attrs, arg->server); |
1004 | break; | 997 | break; |
1005 | default: | 998 | default: |
1006 | WRITE32(NFS4_CREATE_EXCLUSIVE); | 999 | WRITE32(NFS4_CREATE_EXCLUSIVE); |
1007 | encode_nfs4_verifier(xdr, &arg->u.verifier); | 1000 | encode_nfs4_verifier(xdr, &arg->u.verifier); |
1008 | } | 1001 | } |
1009 | } | 1002 | } |
1010 | 1003 | ||
@@ -1014,33 +1007,33 @@ static void encode_opentype(struct xdr_stream *xdr, const struct nfs_openargs *a | |||
1014 | 1007 | ||
1015 | RESERVE_SPACE(4); | 1008 | RESERVE_SPACE(4); |
1016 | switch (arg->open_flags & O_CREAT) { | 1009 | switch (arg->open_flags & O_CREAT) { |
1017 | case 0: | 1010 | case 0: |
1018 | WRITE32(NFS4_OPEN_NOCREATE); | 1011 | WRITE32(NFS4_OPEN_NOCREATE); |
1019 | break; | 1012 | break; |
1020 | default: | 1013 | default: |
1021 | BUG_ON(arg->claim != NFS4_OPEN_CLAIM_NULL); | 1014 | BUG_ON(arg->claim != NFS4_OPEN_CLAIM_NULL); |
1022 | WRITE32(NFS4_OPEN_CREATE); | 1015 | WRITE32(NFS4_OPEN_CREATE); |
1023 | encode_createmode(xdr, arg); | 1016 | encode_createmode(xdr, arg); |
1024 | } | 1017 | } |
1025 | } | 1018 | } |
1026 | 1019 | ||
1027 | static inline void encode_delegation_type(struct xdr_stream *xdr, int delegation_type) | 1020 | static inline void encode_delegation_type(struct xdr_stream *xdr, fmode_t delegation_type) |
1028 | { | 1021 | { |
1029 | __be32 *p; | 1022 | __be32 *p; |
1030 | 1023 | ||
1031 | RESERVE_SPACE(4); | 1024 | RESERVE_SPACE(4); |
1032 | switch (delegation_type) { | 1025 | switch (delegation_type) { |
1033 | case 0: | 1026 | case 0: |
1034 | WRITE32(NFS4_OPEN_DELEGATE_NONE); | 1027 | WRITE32(NFS4_OPEN_DELEGATE_NONE); |
1035 | break; | 1028 | break; |
1036 | case FMODE_READ: | 1029 | case FMODE_READ: |
1037 | WRITE32(NFS4_OPEN_DELEGATE_READ); | 1030 | WRITE32(NFS4_OPEN_DELEGATE_READ); |
1038 | break; | 1031 | break; |
1039 | case FMODE_WRITE|FMODE_READ: | 1032 | case FMODE_WRITE|FMODE_READ: |
1040 | WRITE32(NFS4_OPEN_DELEGATE_WRITE); | 1033 | WRITE32(NFS4_OPEN_DELEGATE_WRITE); |
1041 | break; | 1034 | break; |
1042 | default: | 1035 | default: |
1043 | BUG(); | 1036 | BUG(); |
1044 | } | 1037 | } |
1045 | } | 1038 | } |
1046 | 1039 | ||
@@ -1053,7 +1046,7 @@ static inline void encode_claim_null(struct xdr_stream *xdr, const struct qstr * | |||
1053 | encode_string(xdr, name->len, name->name); | 1046 | encode_string(xdr, name->len, name->name); |
1054 | } | 1047 | } |
1055 | 1048 | ||
1056 | static inline void encode_claim_previous(struct xdr_stream *xdr, int type) | 1049 | static inline void encode_claim_previous(struct xdr_stream *xdr, fmode_t type) |
1057 | { | 1050 | { |
1058 | __be32 *p; | 1051 | __be32 *p; |
1059 | 1052 | ||
@@ -1072,27 +1065,27 @@ static inline void encode_claim_delegate_cur(struct xdr_stream *xdr, const struc | |||
1072 | encode_string(xdr, name->len, name->name); | 1065 | encode_string(xdr, name->len, name->name); |
1073 | } | 1066 | } |
1074 | 1067 | ||
1075 | static int encode_open(struct xdr_stream *xdr, const struct nfs_openargs *arg) | 1068 | static void encode_open(struct xdr_stream *xdr, const struct nfs_openargs *arg, struct compound_hdr *hdr) |
1076 | { | 1069 | { |
1077 | encode_openhdr(xdr, arg); | 1070 | encode_openhdr(xdr, arg); |
1078 | encode_opentype(xdr, arg); | 1071 | encode_opentype(xdr, arg); |
1079 | switch (arg->claim) { | 1072 | switch (arg->claim) { |
1080 | case NFS4_OPEN_CLAIM_NULL: | 1073 | case NFS4_OPEN_CLAIM_NULL: |
1081 | encode_claim_null(xdr, arg->name); | 1074 | encode_claim_null(xdr, arg->name); |
1082 | break; | 1075 | break; |
1083 | case NFS4_OPEN_CLAIM_PREVIOUS: | 1076 | case NFS4_OPEN_CLAIM_PREVIOUS: |
1084 | encode_claim_previous(xdr, arg->u.delegation_type); | 1077 | encode_claim_previous(xdr, arg->u.delegation_type); |
1085 | break; | 1078 | break; |
1086 | case NFS4_OPEN_CLAIM_DELEGATE_CUR: | 1079 | case NFS4_OPEN_CLAIM_DELEGATE_CUR: |
1087 | encode_claim_delegate_cur(xdr, arg->name, &arg->u.delegation); | 1080 | encode_claim_delegate_cur(xdr, arg->name, &arg->u.delegation); |
1088 | break; | 1081 | break; |
1089 | default: | 1082 | default: |
1090 | BUG(); | 1083 | BUG(); |
1091 | } | 1084 | } |
1092 | return 0; | 1085 | hdr->nops++; |
1093 | } | 1086 | } |
1094 | 1087 | ||
1095 | static int encode_open_confirm(struct xdr_stream *xdr, const struct nfs_open_confirmargs *arg) | 1088 | static void encode_open_confirm(struct xdr_stream *xdr, const struct nfs_open_confirmargs *arg, struct compound_hdr *hdr) |
1096 | { | 1089 | { |
1097 | __be32 *p; | 1090 | __be32 *p; |
1098 | 1091 | ||
@@ -1100,11 +1093,10 @@ static int encode_open_confirm(struct xdr_stream *xdr, const struct nfs_open_con | |||
1100 | WRITE32(OP_OPEN_CONFIRM); | 1093 | WRITE32(OP_OPEN_CONFIRM); |
1101 | WRITEMEM(arg->stateid->data, NFS4_STATEID_SIZE); | 1094 | WRITEMEM(arg->stateid->data, NFS4_STATEID_SIZE); |
1102 | WRITE32(arg->seqid->sequence->counter); | 1095 | WRITE32(arg->seqid->sequence->counter); |
1103 | 1096 | hdr->nops++; | |
1104 | return 0; | ||
1105 | } | 1097 | } |
1106 | 1098 | ||
1107 | static int encode_open_downgrade(struct xdr_stream *xdr, const struct nfs_closeargs *arg) | 1099 | static void encode_open_downgrade(struct xdr_stream *xdr, const struct nfs_closeargs *arg, struct compound_hdr *hdr) |
1108 | { | 1100 | { |
1109 | __be32 *p; | 1101 | __be32 *p; |
1110 | 1102 | ||
@@ -1112,12 +1104,12 @@ static int encode_open_downgrade(struct xdr_stream *xdr, const struct nfs_closea | |||
1112 | WRITE32(OP_OPEN_DOWNGRADE); | 1104 | WRITE32(OP_OPEN_DOWNGRADE); |
1113 | WRITEMEM(arg->stateid->data, NFS4_STATEID_SIZE); | 1105 | WRITEMEM(arg->stateid->data, NFS4_STATEID_SIZE); |
1114 | WRITE32(arg->seqid->sequence->counter); | 1106 | WRITE32(arg->seqid->sequence->counter); |
1115 | encode_share_access(xdr, arg->open_flags); | 1107 | encode_share_access(xdr, arg->fmode); |
1116 | return 0; | 1108 | hdr->nops++; |
1117 | } | 1109 | } |
1118 | 1110 | ||
1119 | static int | 1111 | static void |
1120 | encode_putfh(struct xdr_stream *xdr, const struct nfs_fh *fh) | 1112 | encode_putfh(struct xdr_stream *xdr, const struct nfs_fh *fh, struct compound_hdr *hdr) |
1121 | { | 1113 | { |
1122 | int len = fh->size; | 1114 | int len = fh->size; |
1123 | __be32 *p; | 1115 | __be32 *p; |
@@ -1126,18 +1118,16 @@ encode_putfh(struct xdr_stream *xdr, const struct nfs_fh *fh) | |||
1126 | WRITE32(OP_PUTFH); | 1118 | WRITE32(OP_PUTFH); |
1127 | WRITE32(len); | 1119 | WRITE32(len); |
1128 | WRITEMEM(fh->data, len); | 1120 | WRITEMEM(fh->data, len); |
1129 | 1121 | hdr->nops++; | |
1130 | return 0; | ||
1131 | } | 1122 | } |
1132 | 1123 | ||
1133 | static int encode_putrootfh(struct xdr_stream *xdr) | 1124 | static void encode_putrootfh(struct xdr_stream *xdr, struct compound_hdr *hdr) |
1134 | { | 1125 | { |
1135 | __be32 *p; | 1126 | __be32 *p; |
1136 | |||
1137 | RESERVE_SPACE(4); | ||
1138 | WRITE32(OP_PUTROOTFH); | ||
1139 | 1127 | ||
1140 | return 0; | 1128 | RESERVE_SPACE(4); |
1129 | WRITE32(OP_PUTROOTFH); | ||
1130 | hdr->nops++; | ||
1141 | } | 1131 | } |
1142 | 1132 | ||
1143 | static void encode_stateid(struct xdr_stream *xdr, const struct nfs_open_context *ctx) | 1133 | static void encode_stateid(struct xdr_stream *xdr, const struct nfs_open_context *ctx) |
@@ -1153,7 +1143,7 @@ static void encode_stateid(struct xdr_stream *xdr, const struct nfs_open_context | |||
1153 | WRITEMEM(zero_stateid.data, NFS4_STATEID_SIZE); | 1143 | WRITEMEM(zero_stateid.data, NFS4_STATEID_SIZE); |
1154 | } | 1144 | } |
1155 | 1145 | ||
1156 | static int encode_read(struct xdr_stream *xdr, const struct nfs_readargs *args) | 1146 | static void encode_read(struct xdr_stream *xdr, const struct nfs_readargs *args, struct compound_hdr *hdr) |
1157 | { | 1147 | { |
1158 | __be32 *p; | 1148 | __be32 *p; |
1159 | 1149 | ||
@@ -1165,11 +1155,10 @@ static int encode_read(struct xdr_stream *xdr, const struct nfs_readargs *args) | |||
1165 | RESERVE_SPACE(12); | 1155 | RESERVE_SPACE(12); |
1166 | WRITE64(args->offset); | 1156 | WRITE64(args->offset); |
1167 | WRITE32(args->count); | 1157 | WRITE32(args->count); |
1168 | 1158 | hdr->nops++; | |
1169 | return 0; | ||
1170 | } | 1159 | } |
1171 | 1160 | ||
1172 | static int encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg *readdir, struct rpc_rqst *req) | 1161 | static void encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg *readdir, struct rpc_rqst *req, struct compound_hdr *hdr) |
1173 | { | 1162 | { |
1174 | uint32_t attrs[2] = { | 1163 | uint32_t attrs[2] = { |
1175 | FATTR4_WORD0_RDATTR_ERROR|FATTR4_WORD0_FILEID, | 1164 | FATTR4_WORD0_RDATTR_ERROR|FATTR4_WORD0_FILEID, |
@@ -1191,6 +1180,7 @@ static int encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg | |||
1191 | attrs[1] &= ~FATTR4_WORD1_MOUNTED_ON_FILEID; | 1180 | attrs[1] &= ~FATTR4_WORD1_MOUNTED_ON_FILEID; |
1192 | WRITE32(attrs[0] & readdir->bitmask[0]); | 1181 | WRITE32(attrs[0] & readdir->bitmask[0]); |
1193 | WRITE32(attrs[1] & readdir->bitmask[1]); | 1182 | WRITE32(attrs[1] & readdir->bitmask[1]); |
1183 | hdr->nops++; | ||
1194 | dprintk("%s: cookie = %Lu, verifier = %08x:%08x, bitmap = %08x:%08x\n", | 1184 | dprintk("%s: cookie = %Lu, verifier = %08x:%08x, bitmap = %08x:%08x\n", |
1195 | __func__, | 1185 | __func__, |
1196 | (unsigned long long)readdir->cookie, | 1186 | (unsigned long long)readdir->cookie, |
@@ -1198,21 +1188,18 @@ static int encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg | |||
1198 | ((u32 *)readdir->verifier.data)[1], | 1188 | ((u32 *)readdir->verifier.data)[1], |
1199 | attrs[0] & readdir->bitmask[0], | 1189 | attrs[0] & readdir->bitmask[0], |
1200 | attrs[1] & readdir->bitmask[1]); | 1190 | attrs[1] & readdir->bitmask[1]); |
1201 | |||
1202 | return 0; | ||
1203 | } | 1191 | } |
1204 | 1192 | ||
1205 | static int encode_readlink(struct xdr_stream *xdr, const struct nfs4_readlink *readlink, struct rpc_rqst *req) | 1193 | static void encode_readlink(struct xdr_stream *xdr, const struct nfs4_readlink *readlink, struct rpc_rqst *req, struct compound_hdr *hdr) |
1206 | { | 1194 | { |
1207 | __be32 *p; | 1195 | __be32 *p; |
1208 | 1196 | ||
1209 | RESERVE_SPACE(4); | 1197 | RESERVE_SPACE(4); |
1210 | WRITE32(OP_READLINK); | 1198 | WRITE32(OP_READLINK); |
1211 | 1199 | hdr->nops++; | |
1212 | return 0; | ||
1213 | } | 1200 | } |
1214 | 1201 | ||
1215 | static int encode_remove(struct xdr_stream *xdr, const struct qstr *name) | 1202 | static void encode_remove(struct xdr_stream *xdr, const struct qstr *name, struct compound_hdr *hdr) |
1216 | { | 1203 | { |
1217 | __be32 *p; | 1204 | __be32 *p; |
1218 | 1205 | ||
@@ -1220,11 +1207,10 @@ static int encode_remove(struct xdr_stream *xdr, const struct qstr *name) | |||
1220 | WRITE32(OP_REMOVE); | 1207 | WRITE32(OP_REMOVE); |
1221 | WRITE32(name->len); | 1208 | WRITE32(name->len); |
1222 | WRITEMEM(name->name, name->len); | 1209 | WRITEMEM(name->name, name->len); |
1223 | 1210 | hdr->nops++; | |
1224 | return 0; | ||
1225 | } | 1211 | } |
1226 | 1212 | ||
1227 | static int encode_rename(struct xdr_stream *xdr, const struct qstr *oldname, const struct qstr *newname) | 1213 | static void encode_rename(struct xdr_stream *xdr, const struct qstr *oldname, const struct qstr *newname, struct compound_hdr *hdr) |
1228 | { | 1214 | { |
1229 | __be32 *p; | 1215 | __be32 *p; |
1230 | 1216 | ||
@@ -1232,38 +1218,35 @@ static int encode_rename(struct xdr_stream *xdr, const struct qstr *oldname, con | |||
1232 | WRITE32(OP_RENAME); | 1218 | WRITE32(OP_RENAME); |
1233 | WRITE32(oldname->len); | 1219 | WRITE32(oldname->len); |
1234 | WRITEMEM(oldname->name, oldname->len); | 1220 | WRITEMEM(oldname->name, oldname->len); |
1235 | 1221 | ||
1236 | RESERVE_SPACE(4 + newname->len); | 1222 | RESERVE_SPACE(4 + newname->len); |
1237 | WRITE32(newname->len); | 1223 | WRITE32(newname->len); |
1238 | WRITEMEM(newname->name, newname->len); | 1224 | WRITEMEM(newname->name, newname->len); |
1239 | 1225 | hdr->nops++; | |
1240 | return 0; | ||
1241 | } | 1226 | } |
1242 | 1227 | ||
1243 | static int encode_renew(struct xdr_stream *xdr, const struct nfs_client *client_stateid) | 1228 | static void encode_renew(struct xdr_stream *xdr, const struct nfs_client *client_stateid, struct compound_hdr *hdr) |
1244 | { | 1229 | { |
1245 | __be32 *p; | 1230 | __be32 *p; |
1246 | 1231 | ||
1247 | RESERVE_SPACE(12); | 1232 | RESERVE_SPACE(12); |
1248 | WRITE32(OP_RENEW); | 1233 | WRITE32(OP_RENEW); |
1249 | WRITE64(client_stateid->cl_clientid); | 1234 | WRITE64(client_stateid->cl_clientid); |
1250 | 1235 | hdr->nops++; | |
1251 | return 0; | ||
1252 | } | 1236 | } |
1253 | 1237 | ||
1254 | static int | 1238 | static void |
1255 | encode_restorefh(struct xdr_stream *xdr) | 1239 | encode_restorefh(struct xdr_stream *xdr, struct compound_hdr *hdr) |
1256 | { | 1240 | { |
1257 | __be32 *p; | 1241 | __be32 *p; |
1258 | 1242 | ||
1259 | RESERVE_SPACE(4); | 1243 | RESERVE_SPACE(4); |
1260 | WRITE32(OP_RESTOREFH); | 1244 | WRITE32(OP_RESTOREFH); |
1261 | 1245 | hdr->nops++; | |
1262 | return 0; | ||
1263 | } | 1246 | } |
1264 | 1247 | ||
1265 | static int | 1248 | static int |
1266 | encode_setacl(struct xdr_stream *xdr, struct nfs_setaclargs *arg) | 1249 | encode_setacl(struct xdr_stream *xdr, struct nfs_setaclargs *arg, struct compound_hdr *hdr) |
1267 | { | 1250 | { |
1268 | __be32 *p; | 1251 | __be32 *p; |
1269 | 1252 | ||
@@ -1278,36 +1261,32 @@ encode_setacl(struct xdr_stream *xdr, struct nfs_setaclargs *arg) | |||
1278 | RESERVE_SPACE(4); | 1261 | RESERVE_SPACE(4); |
1279 | WRITE32(arg->acl_len); | 1262 | WRITE32(arg->acl_len); |
1280 | xdr_write_pages(xdr, arg->acl_pages, arg->acl_pgbase, arg->acl_len); | 1263 | xdr_write_pages(xdr, arg->acl_pages, arg->acl_pgbase, arg->acl_len); |
1264 | hdr->nops++; | ||
1281 | return 0; | 1265 | return 0; |
1282 | } | 1266 | } |
1283 | 1267 | ||
1284 | static int | 1268 | static void |
1285 | encode_savefh(struct xdr_stream *xdr) | 1269 | encode_savefh(struct xdr_stream *xdr, struct compound_hdr *hdr) |
1286 | { | 1270 | { |
1287 | __be32 *p; | 1271 | __be32 *p; |
1288 | 1272 | ||
1289 | RESERVE_SPACE(4); | 1273 | RESERVE_SPACE(4); |
1290 | WRITE32(OP_SAVEFH); | 1274 | WRITE32(OP_SAVEFH); |
1291 | 1275 | hdr->nops++; | |
1292 | return 0; | ||
1293 | } | 1276 | } |
1294 | 1277 | ||
1295 | static int encode_setattr(struct xdr_stream *xdr, const struct nfs_setattrargs *arg, const struct nfs_server *server) | 1278 | static void encode_setattr(struct xdr_stream *xdr, const struct nfs_setattrargs *arg, const struct nfs_server *server, struct compound_hdr *hdr) |
1296 | { | 1279 | { |
1297 | int status; | ||
1298 | __be32 *p; | 1280 | __be32 *p; |
1299 | |||
1300 | RESERVE_SPACE(4+NFS4_STATEID_SIZE); | ||
1301 | WRITE32(OP_SETATTR); | ||
1302 | WRITEMEM(arg->stateid.data, NFS4_STATEID_SIZE); | ||
1303 | 1281 | ||
1304 | if ((status = encode_attrs(xdr, arg->iap, server))) | 1282 | RESERVE_SPACE(4+NFS4_STATEID_SIZE); |
1305 | return status; | 1283 | WRITE32(OP_SETATTR); |
1306 | 1284 | WRITEMEM(arg->stateid.data, NFS4_STATEID_SIZE); | |
1307 | return 0; | 1285 | hdr->nops++; |
1286 | encode_attrs(xdr, arg->iap, server); | ||
1308 | } | 1287 | } |
1309 | 1288 | ||
1310 | static int encode_setclientid(struct xdr_stream *xdr, const struct nfs4_setclientid *setclientid) | 1289 | static void encode_setclientid(struct xdr_stream *xdr, const struct nfs4_setclientid *setclientid, struct compound_hdr *hdr) |
1311 | { | 1290 | { |
1312 | __be32 *p; | 1291 | __be32 *p; |
1313 | 1292 | ||
@@ -1322,23 +1301,21 @@ static int encode_setclientid(struct xdr_stream *xdr, const struct nfs4_setclien | |||
1322 | encode_string(xdr, setclientid->sc_uaddr_len, setclientid->sc_uaddr); | 1301 | encode_string(xdr, setclientid->sc_uaddr_len, setclientid->sc_uaddr); |
1323 | RESERVE_SPACE(4); | 1302 | RESERVE_SPACE(4); |
1324 | WRITE32(setclientid->sc_cb_ident); | 1303 | WRITE32(setclientid->sc_cb_ident); |
1325 | 1304 | hdr->nops++; | |
1326 | return 0; | ||
1327 | } | 1305 | } |
1328 | 1306 | ||
1329 | static int encode_setclientid_confirm(struct xdr_stream *xdr, const struct nfs_client *client_state) | 1307 | static void encode_setclientid_confirm(struct xdr_stream *xdr, const struct nfs_client *client_state, struct compound_hdr *hdr) |
1330 | { | 1308 | { |
1331 | __be32 *p; | 1309 | __be32 *p; |
1332 | |||
1333 | RESERVE_SPACE(12 + NFS4_VERIFIER_SIZE); | ||
1334 | WRITE32(OP_SETCLIENTID_CONFIRM); | ||
1335 | WRITE64(client_state->cl_clientid); | ||
1336 | WRITEMEM(client_state->cl_confirm.data, NFS4_VERIFIER_SIZE); | ||
1337 | 1310 | ||
1338 | return 0; | 1311 | RESERVE_SPACE(12 + NFS4_VERIFIER_SIZE); |
1312 | WRITE32(OP_SETCLIENTID_CONFIRM); | ||
1313 | WRITE64(client_state->cl_clientid); | ||
1314 | WRITEMEM(client_state->cl_confirm.data, NFS4_VERIFIER_SIZE); | ||
1315 | hdr->nops++; | ||
1339 | } | 1316 | } |
1340 | 1317 | ||
1341 | static int encode_write(struct xdr_stream *xdr, const struct nfs_writeargs *args) | 1318 | static void encode_write(struct xdr_stream *xdr, const struct nfs_writeargs *args, struct compound_hdr *hdr) |
1342 | { | 1319 | { |
1343 | __be32 *p; | 1320 | __be32 *p; |
1344 | 1321 | ||
@@ -1353,11 +1330,10 @@ static int encode_write(struct xdr_stream *xdr, const struct nfs_writeargs *args | |||
1353 | WRITE32(args->count); | 1330 | WRITE32(args->count); |
1354 | 1331 | ||
1355 | xdr_write_pages(xdr, args->pages, args->pgbase, args->count); | 1332 | xdr_write_pages(xdr, args->pages, args->pgbase, args->count); |
1356 | 1333 | hdr->nops++; | |
1357 | return 0; | ||
1358 | } | 1334 | } |
1359 | 1335 | ||
1360 | static int encode_delegreturn(struct xdr_stream *xdr, const nfs4_stateid *stateid) | 1336 | static void encode_delegreturn(struct xdr_stream *xdr, const nfs4_stateid *stateid, struct compound_hdr *hdr) |
1361 | { | 1337 | { |
1362 | __be32 *p; | 1338 | __be32 *p; |
1363 | 1339 | ||
@@ -1365,8 +1341,7 @@ static int encode_delegreturn(struct xdr_stream *xdr, const nfs4_stateid *statei | |||
1365 | 1341 | ||
1366 | WRITE32(OP_DELEGRETURN); | 1342 | WRITE32(OP_DELEGRETURN); |
1367 | WRITEMEM(stateid->data, NFS4_STATEID_SIZE); | 1343 | WRITEMEM(stateid->data, NFS4_STATEID_SIZE); |
1368 | return 0; | 1344 | hdr->nops++; |
1369 | |||
1370 | } | 1345 | } |
1371 | /* | 1346 | /* |
1372 | * END OF "GENERIC" ENCODE ROUTINES. | 1347 | * END OF "GENERIC" ENCODE ROUTINES. |
@@ -1379,21 +1354,16 @@ static int nfs4_xdr_enc_access(struct rpc_rqst *req, __be32 *p, const struct nfs | |||
1379 | { | 1354 | { |
1380 | struct xdr_stream xdr; | 1355 | struct xdr_stream xdr; |
1381 | struct compound_hdr hdr = { | 1356 | struct compound_hdr hdr = { |
1382 | .nops = 3, | 1357 | .nops = 0, |
1383 | }; | 1358 | }; |
1384 | int status; | ||
1385 | 1359 | ||
1386 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1360 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); |
1387 | encode_compound_hdr(&xdr, &hdr); | 1361 | encode_compound_hdr(&xdr, &hdr); |
1388 | status = encode_putfh(&xdr, args->fh); | 1362 | encode_putfh(&xdr, args->fh, &hdr); |
1389 | if (status != 0) | 1363 | encode_access(&xdr, args->access, &hdr); |
1390 | goto out; | 1364 | encode_getfattr(&xdr, args->bitmask, &hdr); |
1391 | status = encode_access(&xdr, args->access); | 1365 | encode_nops(&hdr); |
1392 | if (status != 0) | 1366 | return 0; |
1393 | goto out; | ||
1394 | status = encode_getfattr(&xdr, args->bitmask); | ||
1395 | out: | ||
1396 | return status; | ||
1397 | } | 1367 | } |
1398 | 1368 | ||
1399 | /* | 1369 | /* |
@@ -1403,21 +1373,17 @@ static int nfs4_xdr_enc_lookup(struct rpc_rqst *req, __be32 *p, const struct nfs | |||
1403 | { | 1373 | { |
1404 | struct xdr_stream xdr; | 1374 | struct xdr_stream xdr; |
1405 | struct compound_hdr hdr = { | 1375 | struct compound_hdr hdr = { |
1406 | .nops = 4, | 1376 | .nops = 0, |
1407 | }; | 1377 | }; |
1408 | int status; | ||
1409 | 1378 | ||
1410 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1379 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); |
1411 | encode_compound_hdr(&xdr, &hdr); | 1380 | encode_compound_hdr(&xdr, &hdr); |
1412 | if ((status = encode_putfh(&xdr, args->dir_fh)) != 0) | 1381 | encode_putfh(&xdr, args->dir_fh, &hdr); |
1413 | goto out; | 1382 | encode_lookup(&xdr, args->name, &hdr); |
1414 | if ((status = encode_lookup(&xdr, args->name)) != 0) | 1383 | encode_getfh(&xdr, &hdr); |
1415 | goto out; | 1384 | encode_getfattr(&xdr, args->bitmask, &hdr); |
1416 | if ((status = encode_getfh(&xdr)) != 0) | 1385 | encode_nops(&hdr); |
1417 | goto out; | 1386 | return 0; |
1418 | status = encode_getfattr(&xdr, args->bitmask); | ||
1419 | out: | ||
1420 | return status; | ||
1421 | } | 1387 | } |
1422 | 1388 | ||
1423 | /* | 1389 | /* |
@@ -1427,18 +1393,16 @@ static int nfs4_xdr_enc_lookup_root(struct rpc_rqst *req, __be32 *p, const struc | |||
1427 | { | 1393 | { |
1428 | struct xdr_stream xdr; | 1394 | struct xdr_stream xdr; |
1429 | struct compound_hdr hdr = { | 1395 | struct compound_hdr hdr = { |
1430 | .nops = 3, | 1396 | .nops = 0, |
1431 | }; | 1397 | }; |
1432 | int status; | ||
1433 | 1398 | ||
1434 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1399 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); |
1435 | encode_compound_hdr(&xdr, &hdr); | 1400 | encode_compound_hdr(&xdr, &hdr); |
1436 | if ((status = encode_putrootfh(&xdr)) != 0) | 1401 | encode_putrootfh(&xdr, &hdr); |
1437 | goto out; | 1402 | encode_getfh(&xdr, &hdr); |
1438 | if ((status = encode_getfh(&xdr)) == 0) | 1403 | encode_getfattr(&xdr, args->bitmask, &hdr); |
1439 | status = encode_getfattr(&xdr, args->bitmask); | 1404 | encode_nops(&hdr); |
1440 | out: | 1405 | return 0; |
1441 | return status; | ||
1442 | } | 1406 | } |
1443 | 1407 | ||
1444 | /* | 1408 | /* |
@@ -1448,19 +1412,16 @@ static int nfs4_xdr_enc_remove(struct rpc_rqst *req, __be32 *p, const struct nfs | |||
1448 | { | 1412 | { |
1449 | struct xdr_stream xdr; | 1413 | struct xdr_stream xdr; |
1450 | struct compound_hdr hdr = { | 1414 | struct compound_hdr hdr = { |
1451 | .nops = 3, | 1415 | .nops = 0, |
1452 | }; | 1416 | }; |
1453 | int status; | ||
1454 | 1417 | ||
1455 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1418 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); |
1456 | encode_compound_hdr(&xdr, &hdr); | 1419 | encode_compound_hdr(&xdr, &hdr); |
1457 | if ((status = encode_putfh(&xdr, args->fh)) != 0) | 1420 | encode_putfh(&xdr, args->fh, &hdr); |
1458 | goto out; | 1421 | encode_remove(&xdr, &args->name, &hdr); |
1459 | if ((status = encode_remove(&xdr, &args->name)) != 0) | 1422 | encode_getfattr(&xdr, args->bitmask, &hdr); |
1460 | goto out; | 1423 | encode_nops(&hdr); |
1461 | status = encode_getfattr(&xdr, args->bitmask); | 1424 | return 0; |
1462 | out: | ||
1463 | return status; | ||
1464 | } | 1425 | } |
1465 | 1426 | ||
1466 | /* | 1427 | /* |
@@ -1470,27 +1431,20 @@ static int nfs4_xdr_enc_rename(struct rpc_rqst *req, __be32 *p, const struct nfs | |||
1470 | { | 1431 | { |
1471 | struct xdr_stream xdr; | 1432 | struct xdr_stream xdr; |
1472 | struct compound_hdr hdr = { | 1433 | struct compound_hdr hdr = { |
1473 | .nops = 7, | 1434 | .nops = 0, |
1474 | }; | 1435 | }; |
1475 | int status; | ||
1476 | 1436 | ||
1477 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1437 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); |
1478 | encode_compound_hdr(&xdr, &hdr); | 1438 | encode_compound_hdr(&xdr, &hdr); |
1479 | if ((status = encode_putfh(&xdr, args->old_dir)) != 0) | 1439 | encode_putfh(&xdr, args->old_dir, &hdr); |
1480 | goto out; | 1440 | encode_savefh(&xdr, &hdr); |
1481 | if ((status = encode_savefh(&xdr)) != 0) | 1441 | encode_putfh(&xdr, args->new_dir, &hdr); |
1482 | goto out; | 1442 | encode_rename(&xdr, args->old_name, args->new_name, &hdr); |
1483 | if ((status = encode_putfh(&xdr, args->new_dir)) != 0) | 1443 | encode_getfattr(&xdr, args->bitmask, &hdr); |
1484 | goto out; | 1444 | encode_restorefh(&xdr, &hdr); |
1485 | if ((status = encode_rename(&xdr, args->old_name, args->new_name)) != 0) | 1445 | encode_getfattr(&xdr, args->bitmask, &hdr); |
1486 | goto out; | 1446 | encode_nops(&hdr); |
1487 | if ((status = encode_getfattr(&xdr, args->bitmask)) != 0) | 1447 | return 0; |
1488 | goto out; | ||
1489 | if ((status = encode_restorefh(&xdr)) != 0) | ||
1490 | goto out; | ||
1491 | status = encode_getfattr(&xdr, args->bitmask); | ||
1492 | out: | ||
1493 | return status; | ||
1494 | } | 1448 | } |
1495 | 1449 | ||
1496 | /* | 1450 | /* |
@@ -1500,27 +1454,20 @@ static int nfs4_xdr_enc_link(struct rpc_rqst *req, __be32 *p, const struct nfs4_ | |||
1500 | { | 1454 | { |
1501 | struct xdr_stream xdr; | 1455 | struct xdr_stream xdr; |
1502 | struct compound_hdr hdr = { | 1456 | struct compound_hdr hdr = { |
1503 | .nops = 7, | 1457 | .nops = 0, |
1504 | }; | 1458 | }; |
1505 | int status; | ||
1506 | 1459 | ||
1507 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1460 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); |
1508 | encode_compound_hdr(&xdr, &hdr); | 1461 | encode_compound_hdr(&xdr, &hdr); |
1509 | if ((status = encode_putfh(&xdr, args->fh)) != 0) | 1462 | encode_putfh(&xdr, args->fh, &hdr); |
1510 | goto out; | 1463 | encode_savefh(&xdr, &hdr); |
1511 | if ((status = encode_savefh(&xdr)) != 0) | 1464 | encode_putfh(&xdr, args->dir_fh, &hdr); |
1512 | goto out; | 1465 | encode_link(&xdr, args->name, &hdr); |
1513 | if ((status = encode_putfh(&xdr, args->dir_fh)) != 0) | 1466 | encode_getfattr(&xdr, args->bitmask, &hdr); |
1514 | goto out; | 1467 | encode_restorefh(&xdr, &hdr); |
1515 | if ((status = encode_link(&xdr, args->name)) != 0) | 1468 | encode_getfattr(&xdr, args->bitmask, &hdr); |
1516 | goto out; | 1469 | encode_nops(&hdr); |
1517 | if ((status = encode_getfattr(&xdr, args->bitmask)) != 0) | 1470 | return 0; |
1518 | goto out; | ||
1519 | if ((status = encode_restorefh(&xdr)) != 0) | ||
1520 | goto out; | ||
1521 | status = encode_getfattr(&xdr, args->bitmask); | ||
1522 | out: | ||
1523 | return status; | ||
1524 | } | 1471 | } |
1525 | 1472 | ||
1526 | /* | 1473 | /* |
@@ -1530,27 +1477,20 @@ static int nfs4_xdr_enc_create(struct rpc_rqst *req, __be32 *p, const struct nfs | |||
1530 | { | 1477 | { |
1531 | struct xdr_stream xdr; | 1478 | struct xdr_stream xdr; |
1532 | struct compound_hdr hdr = { | 1479 | struct compound_hdr hdr = { |
1533 | .nops = 7, | 1480 | .nops = 0, |
1534 | }; | 1481 | }; |
1535 | int status; | ||
1536 | 1482 | ||
1537 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1483 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); |
1538 | encode_compound_hdr(&xdr, &hdr); | 1484 | encode_compound_hdr(&xdr, &hdr); |
1539 | if ((status = encode_putfh(&xdr, args->dir_fh)) != 0) | 1485 | encode_putfh(&xdr, args->dir_fh, &hdr); |
1540 | goto out; | 1486 | encode_savefh(&xdr, &hdr); |
1541 | if ((status = encode_savefh(&xdr)) != 0) | 1487 | encode_create(&xdr, args, &hdr); |
1542 | goto out; | 1488 | encode_getfh(&xdr, &hdr); |
1543 | if ((status = encode_create(&xdr, args)) != 0) | 1489 | encode_getfattr(&xdr, args->bitmask, &hdr); |
1544 | goto out; | 1490 | encode_restorefh(&xdr, &hdr); |
1545 | if ((status = encode_getfh(&xdr)) != 0) | 1491 | encode_getfattr(&xdr, args->bitmask, &hdr); |
1546 | goto out; | 1492 | encode_nops(&hdr); |
1547 | if ((status = encode_getfattr(&xdr, args->bitmask)) != 0) | 1493 | return 0; |
1548 | goto out; | ||
1549 | if ((status = encode_restorefh(&xdr)) != 0) | ||
1550 | goto out; | ||
1551 | status = encode_getfattr(&xdr, args->bitmask); | ||
1552 | out: | ||
1553 | return status; | ||
1554 | } | 1494 | } |
1555 | 1495 | ||
1556 | /* | 1496 | /* |
@@ -1568,15 +1508,15 @@ static int nfs4_xdr_enc_getattr(struct rpc_rqst *req, __be32 *p, const struct nf | |||
1568 | { | 1508 | { |
1569 | struct xdr_stream xdr; | 1509 | struct xdr_stream xdr; |
1570 | struct compound_hdr hdr = { | 1510 | struct compound_hdr hdr = { |
1571 | .nops = 2, | 1511 | .nops = 0, |
1572 | }; | 1512 | }; |
1573 | int status; | ||
1574 | 1513 | ||
1575 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1514 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); |
1576 | encode_compound_hdr(&xdr, &hdr); | 1515 | encode_compound_hdr(&xdr, &hdr); |
1577 | if ((status = encode_putfh(&xdr, args->fh)) == 0) | 1516 | encode_putfh(&xdr, args->fh, &hdr); |
1578 | status = encode_getfattr(&xdr, args->bitmask); | 1517 | encode_getfattr(&xdr, args->bitmask, &hdr); |
1579 | return status; | 1518 | encode_nops(&hdr); |
1519 | return 0; | ||
1580 | } | 1520 | } |
1581 | 1521 | ||
1582 | /* | 1522 | /* |
@@ -1584,23 +1524,18 @@ static int nfs4_xdr_enc_getattr(struct rpc_rqst *req, __be32 *p, const struct nf | |||
1584 | */ | 1524 | */ |
1585 | static int nfs4_xdr_enc_close(struct rpc_rqst *req, __be32 *p, struct nfs_closeargs *args) | 1525 | static int nfs4_xdr_enc_close(struct rpc_rqst *req, __be32 *p, struct nfs_closeargs *args) |
1586 | { | 1526 | { |
1587 | struct xdr_stream xdr; | 1527 | struct xdr_stream xdr; |
1588 | struct compound_hdr hdr = { | 1528 | struct compound_hdr hdr = { |
1589 | .nops = 3, | 1529 | .nops = 0, |
1590 | }; | 1530 | }; |
1591 | int status; | 1531 | |
1592 | 1532 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | |
1593 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1533 | encode_compound_hdr(&xdr, &hdr); |
1594 | encode_compound_hdr(&xdr, &hdr); | 1534 | encode_putfh(&xdr, args->fh, &hdr); |
1595 | status = encode_putfh(&xdr, args->fh); | 1535 | encode_close(&xdr, args, &hdr); |
1596 | if(status) | 1536 | encode_getfattr(&xdr, args->bitmask, &hdr); |
1597 | goto out; | 1537 | encode_nops(&hdr); |
1598 | status = encode_close(&xdr, args); | 1538 | return 0; |
1599 | if (status != 0) | ||
1600 | goto out; | ||
1601 | status = encode_getfattr(&xdr, args->bitmask); | ||
1602 | out: | ||
1603 | return status; | ||
1604 | } | 1539 | } |
1605 | 1540 | ||
1606 | /* | 1541 | /* |
@@ -1610,33 +1545,20 @@ static int nfs4_xdr_enc_open(struct rpc_rqst *req, __be32 *p, struct nfs_openarg | |||
1610 | { | 1545 | { |
1611 | struct xdr_stream xdr; | 1546 | struct xdr_stream xdr; |
1612 | struct compound_hdr hdr = { | 1547 | struct compound_hdr hdr = { |
1613 | .nops = 7, | 1548 | .nops = 0, |
1614 | }; | 1549 | }; |
1615 | int status; | ||
1616 | 1550 | ||
1617 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1551 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); |
1618 | encode_compound_hdr(&xdr, &hdr); | 1552 | encode_compound_hdr(&xdr, &hdr); |
1619 | status = encode_putfh(&xdr, args->fh); | 1553 | encode_putfh(&xdr, args->fh, &hdr); |
1620 | if (status) | 1554 | encode_savefh(&xdr, &hdr); |
1621 | goto out; | 1555 | encode_open(&xdr, args, &hdr); |
1622 | status = encode_savefh(&xdr); | 1556 | encode_getfh(&xdr, &hdr); |
1623 | if (status) | 1557 | encode_getfattr(&xdr, args->bitmask, &hdr); |
1624 | goto out; | 1558 | encode_restorefh(&xdr, &hdr); |
1625 | status = encode_open(&xdr, args); | 1559 | encode_getfattr(&xdr, args->bitmask, &hdr); |
1626 | if (status) | 1560 | encode_nops(&hdr); |
1627 | goto out; | 1561 | return 0; |
1628 | status = encode_getfh(&xdr); | ||
1629 | if (status) | ||
1630 | goto out; | ||
1631 | status = encode_getfattr(&xdr, args->bitmask); | ||
1632 | if (status) | ||
1633 | goto out; | ||
1634 | status = encode_restorefh(&xdr); | ||
1635 | if (status) | ||
1636 | goto out; | ||
1637 | status = encode_getfattr(&xdr, args->bitmask); | ||
1638 | out: | ||
1639 | return status; | ||
1640 | } | 1562 | } |
1641 | 1563 | ||
1642 | /* | 1564 | /* |
@@ -1646,18 +1568,15 @@ static int nfs4_xdr_enc_open_confirm(struct rpc_rqst *req, __be32 *p, struct nfs | |||
1646 | { | 1568 | { |
1647 | struct xdr_stream xdr; | 1569 | struct xdr_stream xdr; |
1648 | struct compound_hdr hdr = { | 1570 | struct compound_hdr hdr = { |
1649 | .nops = 2, | 1571 | .nops = 0, |
1650 | }; | 1572 | }; |
1651 | int status; | ||
1652 | 1573 | ||
1653 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1574 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); |
1654 | encode_compound_hdr(&xdr, &hdr); | 1575 | encode_compound_hdr(&xdr, &hdr); |
1655 | status = encode_putfh(&xdr, args->fh); | 1576 | encode_putfh(&xdr, args->fh, &hdr); |
1656 | if(status) | 1577 | encode_open_confirm(&xdr, args, &hdr); |
1657 | goto out; | 1578 | encode_nops(&hdr); |
1658 | status = encode_open_confirm(&xdr, args); | 1579 | return 0; |
1659 | out: | ||
1660 | return status; | ||
1661 | } | 1580 | } |
1662 | 1581 | ||
1663 | /* | 1582 | /* |
@@ -1667,21 +1586,16 @@ static int nfs4_xdr_enc_open_noattr(struct rpc_rqst *req, __be32 *p, struct nfs_ | |||
1667 | { | 1586 | { |
1668 | struct xdr_stream xdr; | 1587 | struct xdr_stream xdr; |
1669 | struct compound_hdr hdr = { | 1588 | struct compound_hdr hdr = { |
1670 | .nops = 3, | 1589 | .nops = 0, |
1671 | }; | 1590 | }; |
1672 | int status; | ||
1673 | 1591 | ||
1674 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1592 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); |
1675 | encode_compound_hdr(&xdr, &hdr); | 1593 | encode_compound_hdr(&xdr, &hdr); |
1676 | status = encode_putfh(&xdr, args->fh); | 1594 | encode_putfh(&xdr, args->fh, &hdr); |
1677 | if (status) | 1595 | encode_open(&xdr, args, &hdr); |
1678 | goto out; | 1596 | encode_getfattr(&xdr, args->bitmask, &hdr); |
1679 | status = encode_open(&xdr, args); | 1597 | encode_nops(&hdr); |
1680 | if (status) | 1598 | return 0; |
1681 | goto out; | ||
1682 | status = encode_getfattr(&xdr, args->bitmask); | ||
1683 | out: | ||
1684 | return status; | ||
1685 | } | 1599 | } |
1686 | 1600 | ||
1687 | /* | 1601 | /* |
@@ -1691,21 +1605,16 @@ static int nfs4_xdr_enc_open_downgrade(struct rpc_rqst *req, __be32 *p, struct n | |||
1691 | { | 1605 | { |
1692 | struct xdr_stream xdr; | 1606 | struct xdr_stream xdr; |
1693 | struct compound_hdr hdr = { | 1607 | struct compound_hdr hdr = { |
1694 | .nops = 3, | 1608 | .nops = 0, |
1695 | }; | 1609 | }; |
1696 | int status; | ||
1697 | 1610 | ||
1698 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1611 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); |
1699 | encode_compound_hdr(&xdr, &hdr); | 1612 | encode_compound_hdr(&xdr, &hdr); |
1700 | status = encode_putfh(&xdr, args->fh); | 1613 | encode_putfh(&xdr, args->fh, &hdr); |
1701 | if (status) | 1614 | encode_open_downgrade(&xdr, args, &hdr); |
1702 | goto out; | 1615 | encode_getfattr(&xdr, args->bitmask, &hdr); |
1703 | status = encode_open_downgrade(&xdr, args); | 1616 | encode_nops(&hdr); |
1704 | if (status != 0) | 1617 | return 0; |
1705 | goto out; | ||
1706 | status = encode_getfattr(&xdr, args->bitmask); | ||
1707 | out: | ||
1708 | return status; | ||
1709 | } | 1618 | } |
1710 | 1619 | ||
1711 | /* | 1620 | /* |
@@ -1715,18 +1624,15 @@ static int nfs4_xdr_enc_lock(struct rpc_rqst *req, __be32 *p, struct nfs_lock_ar | |||
1715 | { | 1624 | { |
1716 | struct xdr_stream xdr; | 1625 | struct xdr_stream xdr; |
1717 | struct compound_hdr hdr = { | 1626 | struct compound_hdr hdr = { |
1718 | .nops = 2, | 1627 | .nops = 0, |
1719 | }; | 1628 | }; |
1720 | int status; | ||
1721 | 1629 | ||
1722 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1630 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); |
1723 | encode_compound_hdr(&xdr, &hdr); | 1631 | encode_compound_hdr(&xdr, &hdr); |
1724 | status = encode_putfh(&xdr, args->fh); | 1632 | encode_putfh(&xdr, args->fh, &hdr); |
1725 | if(status) | 1633 | encode_lock(&xdr, args, &hdr); |
1726 | goto out; | 1634 | encode_nops(&hdr); |
1727 | status = encode_lock(&xdr, args); | 1635 | return 0; |
1728 | out: | ||
1729 | return status; | ||
1730 | } | 1636 | } |
1731 | 1637 | ||
1732 | /* | 1638 | /* |
@@ -1736,18 +1642,15 @@ static int nfs4_xdr_enc_lockt(struct rpc_rqst *req, __be32 *p, struct nfs_lockt_ | |||
1736 | { | 1642 | { |
1737 | struct xdr_stream xdr; | 1643 | struct xdr_stream xdr; |
1738 | struct compound_hdr hdr = { | 1644 | struct compound_hdr hdr = { |
1739 | .nops = 2, | 1645 | .nops = 0, |
1740 | }; | 1646 | }; |
1741 | int status; | ||
1742 | 1647 | ||
1743 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1648 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); |
1744 | encode_compound_hdr(&xdr, &hdr); | 1649 | encode_compound_hdr(&xdr, &hdr); |
1745 | status = encode_putfh(&xdr, args->fh); | 1650 | encode_putfh(&xdr, args->fh, &hdr); |
1746 | if(status) | 1651 | encode_lockt(&xdr, args, &hdr); |
1747 | goto out; | 1652 | encode_nops(&hdr); |
1748 | status = encode_lockt(&xdr, args); | 1653 | return 0; |
1749 | out: | ||
1750 | return status; | ||
1751 | } | 1654 | } |
1752 | 1655 | ||
1753 | /* | 1656 | /* |
@@ -1757,18 +1660,15 @@ static int nfs4_xdr_enc_locku(struct rpc_rqst *req, __be32 *p, struct nfs_locku_ | |||
1757 | { | 1660 | { |
1758 | struct xdr_stream xdr; | 1661 | struct xdr_stream xdr; |
1759 | struct compound_hdr hdr = { | 1662 | struct compound_hdr hdr = { |
1760 | .nops = 2, | 1663 | .nops = 0, |
1761 | }; | 1664 | }; |
1762 | int status; | ||
1763 | 1665 | ||
1764 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1666 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); |
1765 | encode_compound_hdr(&xdr, &hdr); | 1667 | encode_compound_hdr(&xdr, &hdr); |
1766 | status = encode_putfh(&xdr, args->fh); | 1668 | encode_putfh(&xdr, args->fh, &hdr); |
1767 | if(status) | 1669 | encode_locku(&xdr, args, &hdr); |
1768 | goto out; | 1670 | encode_nops(&hdr); |
1769 | status = encode_locku(&xdr, args); | 1671 | return 0; |
1770 | out: | ||
1771 | return status; | ||
1772 | } | 1672 | } |
1773 | 1673 | ||
1774 | /* | 1674 | /* |
@@ -1778,18 +1678,15 @@ static int nfs4_xdr_enc_readlink(struct rpc_rqst *req, __be32 *p, const struct n | |||
1778 | { | 1678 | { |
1779 | struct xdr_stream xdr; | 1679 | struct xdr_stream xdr; |
1780 | struct compound_hdr hdr = { | 1680 | struct compound_hdr hdr = { |
1781 | .nops = 2, | 1681 | .nops = 0, |
1782 | }; | 1682 | }; |
1783 | struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth; | 1683 | struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth; |
1784 | unsigned int replen; | 1684 | unsigned int replen; |
1785 | int status; | ||
1786 | 1685 | ||
1787 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1686 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); |
1788 | encode_compound_hdr(&xdr, &hdr); | 1687 | encode_compound_hdr(&xdr, &hdr); |
1789 | status = encode_putfh(&xdr, args->fh); | 1688 | encode_putfh(&xdr, args->fh, &hdr); |
1790 | if(status) | 1689 | encode_readlink(&xdr, args, req, &hdr); |
1791 | goto out; | ||
1792 | status = encode_readlink(&xdr, args, req); | ||
1793 | 1690 | ||
1794 | /* set up reply kvec | 1691 | /* set up reply kvec |
1795 | * toplevel_status + taglen + rescount + OP_PUTFH + status | 1692 | * toplevel_status + taglen + rescount + OP_PUTFH + status |
@@ -1798,9 +1695,8 @@ static int nfs4_xdr_enc_readlink(struct rpc_rqst *req, __be32 *p, const struct n | |||
1798 | replen = (RPC_REPHDRSIZE + auth->au_rslack + NFS4_dec_readlink_sz) << 2; | 1695 | replen = (RPC_REPHDRSIZE + auth->au_rslack + NFS4_dec_readlink_sz) << 2; |
1799 | xdr_inline_pages(&req->rq_rcv_buf, replen, args->pages, | 1696 | xdr_inline_pages(&req->rq_rcv_buf, replen, args->pages, |
1800 | args->pgbase, args->pglen); | 1697 | args->pgbase, args->pglen); |
1801 | 1698 | encode_nops(&hdr); | |
1802 | out: | 1699 | return 0; |
1803 | return status; | ||
1804 | } | 1700 | } |
1805 | 1701 | ||
1806 | /* | 1702 | /* |
@@ -1810,18 +1706,15 @@ static int nfs4_xdr_enc_readdir(struct rpc_rqst *req, __be32 *p, const struct nf | |||
1810 | { | 1706 | { |
1811 | struct xdr_stream xdr; | 1707 | struct xdr_stream xdr; |
1812 | struct compound_hdr hdr = { | 1708 | struct compound_hdr hdr = { |
1813 | .nops = 2, | 1709 | .nops = 0, |
1814 | }; | 1710 | }; |
1815 | struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth; | 1711 | struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth; |
1816 | int replen; | 1712 | int replen; |
1817 | int status; | ||
1818 | 1713 | ||
1819 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1714 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); |
1820 | encode_compound_hdr(&xdr, &hdr); | 1715 | encode_compound_hdr(&xdr, &hdr); |
1821 | status = encode_putfh(&xdr, args->fh); | 1716 | encode_putfh(&xdr, args->fh, &hdr); |
1822 | if(status) | 1717 | encode_readdir(&xdr, args, req, &hdr); |
1823 | goto out; | ||
1824 | status = encode_readdir(&xdr, args, req); | ||
1825 | 1718 | ||
1826 | /* set up reply kvec | 1719 | /* set up reply kvec |
1827 | * toplevel_status + taglen + rescount + OP_PUTFH + status | 1720 | * toplevel_status + taglen + rescount + OP_PUTFH + status |
@@ -1833,9 +1726,8 @@ static int nfs4_xdr_enc_readdir(struct rpc_rqst *req, __be32 *p, const struct nf | |||
1833 | dprintk("%s: inlined page args = (%u, %p, %u, %u)\n", | 1726 | dprintk("%s: inlined page args = (%u, %p, %u, %u)\n", |
1834 | __func__, replen, args->pages, | 1727 | __func__, replen, args->pages, |
1835 | args->pgbase, args->count); | 1728 | args->pgbase, args->count); |
1836 | 1729 | encode_nops(&hdr); | |
1837 | out: | 1730 | return 0; |
1838 | return status; | ||
1839 | } | 1731 | } |
1840 | 1732 | ||
1841 | /* | 1733 | /* |
@@ -1846,18 +1738,14 @@ static int nfs4_xdr_enc_read(struct rpc_rqst *req, __be32 *p, struct nfs_readarg | |||
1846 | struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth; | 1738 | struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth; |
1847 | struct xdr_stream xdr; | 1739 | struct xdr_stream xdr; |
1848 | struct compound_hdr hdr = { | 1740 | struct compound_hdr hdr = { |
1849 | .nops = 2, | 1741 | .nops = 0, |
1850 | }; | 1742 | }; |
1851 | int replen, status; | 1743 | int replen; |
1852 | 1744 | ||
1853 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1745 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); |
1854 | encode_compound_hdr(&xdr, &hdr); | 1746 | encode_compound_hdr(&xdr, &hdr); |
1855 | status = encode_putfh(&xdr, args->fh); | 1747 | encode_putfh(&xdr, args->fh, &hdr); |
1856 | if (status) | 1748 | encode_read(&xdr, args, &hdr); |
1857 | goto out; | ||
1858 | status = encode_read(&xdr, args); | ||
1859 | if (status) | ||
1860 | goto out; | ||
1861 | 1749 | ||
1862 | /* set up reply kvec | 1750 | /* set up reply kvec |
1863 | * toplevel status + taglen=0 + rescount + OP_PUTFH + status | 1751 | * toplevel status + taglen=0 + rescount + OP_PUTFH + status |
@@ -1867,33 +1755,27 @@ static int nfs4_xdr_enc_read(struct rpc_rqst *req, __be32 *p, struct nfs_readarg | |||
1867 | xdr_inline_pages(&req->rq_rcv_buf, replen, | 1755 | xdr_inline_pages(&req->rq_rcv_buf, replen, |
1868 | args->pages, args->pgbase, args->count); | 1756 | args->pages, args->pgbase, args->count); |
1869 | req->rq_rcv_buf.flags |= XDRBUF_READ; | 1757 | req->rq_rcv_buf.flags |= XDRBUF_READ; |
1870 | out: | 1758 | encode_nops(&hdr); |
1871 | return status; | 1759 | return 0; |
1872 | } | 1760 | } |
1873 | 1761 | ||
1874 | /* | 1762 | /* |
1875 | * Encode an SETATTR request | 1763 | * Encode an SETATTR request |
1876 | */ | 1764 | */ |
1877 | static int nfs4_xdr_enc_setattr(struct rpc_rqst *req, __be32 *p, struct nfs_setattrargs *args) | 1765 | static int nfs4_xdr_enc_setattr(struct rpc_rqst *req, __be32 *p, struct nfs_setattrargs *args) |
1878 | |||
1879 | { | 1766 | { |
1880 | struct xdr_stream xdr; | 1767 | struct xdr_stream xdr; |
1881 | struct compound_hdr hdr = { | 1768 | struct compound_hdr hdr = { |
1882 | .nops = 3, | 1769 | .nops = 0, |
1883 | }; | 1770 | }; |
1884 | int status; | 1771 | |
1885 | 1772 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | |
1886 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1773 | encode_compound_hdr(&xdr, &hdr); |
1887 | encode_compound_hdr(&xdr, &hdr); | 1774 | encode_putfh(&xdr, args->fh, &hdr); |
1888 | status = encode_putfh(&xdr, args->fh); | 1775 | encode_setattr(&xdr, args, args->server, &hdr); |
1889 | if(status) | 1776 | encode_getfattr(&xdr, args->bitmask, &hdr); |
1890 | goto out; | 1777 | encode_nops(&hdr); |
1891 | status = encode_setattr(&xdr, args, args->server); | 1778 | return 0; |
1892 | if(status) | ||
1893 | goto out; | ||
1894 | status = encode_getfattr(&xdr, args->bitmask); | ||
1895 | out: | ||
1896 | return status; | ||
1897 | } | 1779 | } |
1898 | 1780 | ||
1899 | /* | 1781 | /* |
@@ -1906,22 +1788,21 @@ nfs4_xdr_enc_getacl(struct rpc_rqst *req, __be32 *p, | |||
1906 | struct xdr_stream xdr; | 1788 | struct xdr_stream xdr; |
1907 | struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth; | 1789 | struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth; |
1908 | struct compound_hdr hdr = { | 1790 | struct compound_hdr hdr = { |
1909 | .nops = 2, | 1791 | .nops = 0, |
1910 | }; | 1792 | }; |
1911 | int replen, status; | 1793 | int replen; |
1912 | 1794 | ||
1913 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1795 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); |
1914 | encode_compound_hdr(&xdr, &hdr); | 1796 | encode_compound_hdr(&xdr, &hdr); |
1915 | status = encode_putfh(&xdr, args->fh); | 1797 | encode_putfh(&xdr, args->fh, &hdr); |
1916 | if (status) | 1798 | encode_getattr_two(&xdr, FATTR4_WORD0_ACL, 0, &hdr); |
1917 | goto out; | 1799 | |
1918 | status = encode_getattr_two(&xdr, FATTR4_WORD0_ACL, 0); | ||
1919 | /* set up reply buffer: */ | 1800 | /* set up reply buffer: */ |
1920 | replen = (RPC_REPHDRSIZE + auth->au_rslack + NFS4_dec_getacl_sz) << 2; | 1801 | replen = (RPC_REPHDRSIZE + auth->au_rslack + NFS4_dec_getacl_sz) << 2; |
1921 | xdr_inline_pages(&req->rq_rcv_buf, replen, | 1802 | xdr_inline_pages(&req->rq_rcv_buf, replen, |
1922 | args->acl_pages, args->acl_pgbase, args->acl_len); | 1803 | args->acl_pages, args->acl_pgbase, args->acl_len); |
1923 | out: | 1804 | encode_nops(&hdr); |
1924 | return status; | 1805 | return 0; |
1925 | } | 1806 | } |
1926 | 1807 | ||
1927 | /* | 1808 | /* |
@@ -1931,22 +1812,17 @@ static int nfs4_xdr_enc_write(struct rpc_rqst *req, __be32 *p, struct nfs_writea | |||
1931 | { | 1812 | { |
1932 | struct xdr_stream xdr; | 1813 | struct xdr_stream xdr; |
1933 | struct compound_hdr hdr = { | 1814 | struct compound_hdr hdr = { |
1934 | .nops = 3, | 1815 | .nops = 0, |
1935 | }; | 1816 | }; |
1936 | int status; | ||
1937 | 1817 | ||
1938 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1818 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); |
1939 | encode_compound_hdr(&xdr, &hdr); | 1819 | encode_compound_hdr(&xdr, &hdr); |
1940 | status = encode_putfh(&xdr, args->fh); | 1820 | encode_putfh(&xdr, args->fh, &hdr); |
1941 | if (status) | 1821 | encode_write(&xdr, args, &hdr); |
1942 | goto out; | ||
1943 | status = encode_write(&xdr, args); | ||
1944 | if (status) | ||
1945 | goto out; | ||
1946 | req->rq_snd_buf.flags |= XDRBUF_WRITE; | 1822 | req->rq_snd_buf.flags |= XDRBUF_WRITE; |
1947 | status = encode_getfattr(&xdr, args->bitmask); | 1823 | encode_getfattr(&xdr, args->bitmask, &hdr); |
1948 | out: | 1824 | encode_nops(&hdr); |
1949 | return status; | 1825 | return 0; |
1950 | } | 1826 | } |
1951 | 1827 | ||
1952 | /* | 1828 | /* |
@@ -1956,21 +1832,16 @@ static int nfs4_xdr_enc_commit(struct rpc_rqst *req, __be32 *p, struct nfs_write | |||
1956 | { | 1832 | { |
1957 | struct xdr_stream xdr; | 1833 | struct xdr_stream xdr; |
1958 | struct compound_hdr hdr = { | 1834 | struct compound_hdr hdr = { |
1959 | .nops = 3, | 1835 | .nops = 0, |
1960 | }; | 1836 | }; |
1961 | int status; | ||
1962 | 1837 | ||
1963 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1838 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); |
1964 | encode_compound_hdr(&xdr, &hdr); | 1839 | encode_compound_hdr(&xdr, &hdr); |
1965 | status = encode_putfh(&xdr, args->fh); | 1840 | encode_putfh(&xdr, args->fh, &hdr); |
1966 | if (status) | 1841 | encode_commit(&xdr, args, &hdr); |
1967 | goto out; | 1842 | encode_getfattr(&xdr, args->bitmask, &hdr); |
1968 | status = encode_commit(&xdr, args); | 1843 | encode_nops(&hdr); |
1969 | if (status) | 1844 | return 0; |
1970 | goto out; | ||
1971 | status = encode_getfattr(&xdr, args->bitmask); | ||
1972 | out: | ||
1973 | return status; | ||
1974 | } | 1845 | } |
1975 | 1846 | ||
1976 | /* | 1847 | /* |
@@ -1980,16 +1851,15 @@ static int nfs4_xdr_enc_fsinfo(struct rpc_rqst *req, __be32 *p, struct nfs4_fsin | |||
1980 | { | 1851 | { |
1981 | struct xdr_stream xdr; | 1852 | struct xdr_stream xdr; |
1982 | struct compound_hdr hdr = { | 1853 | struct compound_hdr hdr = { |
1983 | .nops = 2, | 1854 | .nops = 0, |
1984 | }; | 1855 | }; |
1985 | int status; | ||
1986 | 1856 | ||
1987 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1857 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); |
1988 | encode_compound_hdr(&xdr, &hdr); | 1858 | encode_compound_hdr(&xdr, &hdr); |
1989 | status = encode_putfh(&xdr, args->fh); | 1859 | encode_putfh(&xdr, args->fh, &hdr); |
1990 | if (!status) | 1860 | encode_fsinfo(&xdr, args->bitmask, &hdr); |
1991 | status = encode_fsinfo(&xdr, args->bitmask); | 1861 | encode_nops(&hdr); |
1992 | return status; | 1862 | return 0; |
1993 | } | 1863 | } |
1994 | 1864 | ||
1995 | /* | 1865 | /* |
@@ -1999,17 +1869,16 @@ static int nfs4_xdr_enc_pathconf(struct rpc_rqst *req, __be32 *p, const struct n | |||
1999 | { | 1869 | { |
2000 | struct xdr_stream xdr; | 1870 | struct xdr_stream xdr; |
2001 | struct compound_hdr hdr = { | 1871 | struct compound_hdr hdr = { |
2002 | .nops = 2, | 1872 | .nops = 0, |
2003 | }; | 1873 | }; |
2004 | int status; | ||
2005 | 1874 | ||
2006 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1875 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); |
2007 | encode_compound_hdr(&xdr, &hdr); | 1876 | encode_compound_hdr(&xdr, &hdr); |
2008 | status = encode_putfh(&xdr, args->fh); | 1877 | encode_putfh(&xdr, args->fh, &hdr); |
2009 | if (!status) | 1878 | encode_getattr_one(&xdr, args->bitmask[0] & nfs4_pathconf_bitmap[0], |
2010 | status = encode_getattr_one(&xdr, | 1879 | &hdr); |
2011 | args->bitmask[0] & nfs4_pathconf_bitmap[0]); | 1880 | encode_nops(&hdr); |
2012 | return status; | 1881 | return 0; |
2013 | } | 1882 | } |
2014 | 1883 | ||
2015 | /* | 1884 | /* |
@@ -2019,18 +1888,16 @@ static int nfs4_xdr_enc_statfs(struct rpc_rqst *req, __be32 *p, const struct nfs | |||
2019 | { | 1888 | { |
2020 | struct xdr_stream xdr; | 1889 | struct xdr_stream xdr; |
2021 | struct compound_hdr hdr = { | 1890 | struct compound_hdr hdr = { |
2022 | .nops = 2, | 1891 | .nops = 0, |
2023 | }; | 1892 | }; |
2024 | int status; | ||
2025 | 1893 | ||
2026 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1894 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); |
2027 | encode_compound_hdr(&xdr, &hdr); | 1895 | encode_compound_hdr(&xdr, &hdr); |
2028 | status = encode_putfh(&xdr, args->fh); | 1896 | encode_putfh(&xdr, args->fh, &hdr); |
2029 | if (status == 0) | 1897 | encode_getattr_two(&xdr, args->bitmask[0] & nfs4_statfs_bitmap[0], |
2030 | status = encode_getattr_two(&xdr, | 1898 | args->bitmask[1] & nfs4_statfs_bitmap[1], &hdr); |
2031 | args->bitmask[0] & nfs4_statfs_bitmap[0], | 1899 | encode_nops(&hdr); |
2032 | args->bitmask[1] & nfs4_statfs_bitmap[1]); | 1900 | return 0; |
2033 | return status; | ||
2034 | } | 1901 | } |
2035 | 1902 | ||
2036 | /* | 1903 | /* |
@@ -2040,19 +1907,18 @@ static int nfs4_xdr_enc_server_caps(struct rpc_rqst *req, __be32 *p, const struc | |||
2040 | { | 1907 | { |
2041 | struct xdr_stream xdr; | 1908 | struct xdr_stream xdr; |
2042 | struct compound_hdr hdr = { | 1909 | struct compound_hdr hdr = { |
2043 | .nops = 2, | 1910 | .nops = 0, |
2044 | }; | 1911 | }; |
2045 | int status; | ||
2046 | 1912 | ||
2047 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1913 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); |
2048 | encode_compound_hdr(&xdr, &hdr); | 1914 | encode_compound_hdr(&xdr, &hdr); |
2049 | status = encode_putfh(&xdr, fhandle); | 1915 | encode_putfh(&xdr, fhandle, &hdr); |
2050 | if (status == 0) | 1916 | encode_getattr_one(&xdr, FATTR4_WORD0_SUPPORTED_ATTRS| |
2051 | status = encode_getattr_one(&xdr, FATTR4_WORD0_SUPPORTED_ATTRS| | 1917 | FATTR4_WORD0_LINK_SUPPORT| |
2052 | FATTR4_WORD0_LINK_SUPPORT| | 1918 | FATTR4_WORD0_SYMLINK_SUPPORT| |
2053 | FATTR4_WORD0_SYMLINK_SUPPORT| | 1919 | FATTR4_WORD0_ACLSUPPORT, &hdr); |
2054 | FATTR4_WORD0_ACLSUPPORT); | 1920 | encode_nops(&hdr); |
2055 | return status; | 1921 | return 0; |
2056 | } | 1922 | } |
2057 | 1923 | ||
2058 | /* | 1924 | /* |
@@ -2062,12 +1928,14 @@ static int nfs4_xdr_enc_renew(struct rpc_rqst *req, __be32 *p, struct nfs_client | |||
2062 | { | 1928 | { |
2063 | struct xdr_stream xdr; | 1929 | struct xdr_stream xdr; |
2064 | struct compound_hdr hdr = { | 1930 | struct compound_hdr hdr = { |
2065 | .nops = 1, | 1931 | .nops = 0, |
2066 | }; | 1932 | }; |
2067 | 1933 | ||
2068 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1934 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); |
2069 | encode_compound_hdr(&xdr, &hdr); | 1935 | encode_compound_hdr(&xdr, &hdr); |
2070 | return encode_renew(&xdr, clp); | 1936 | encode_renew(&xdr, clp, &hdr); |
1937 | encode_nops(&hdr); | ||
1938 | return 0; | ||
2071 | } | 1939 | } |
2072 | 1940 | ||
2073 | /* | 1941 | /* |
@@ -2077,12 +1945,14 @@ static int nfs4_xdr_enc_setclientid(struct rpc_rqst *req, __be32 *p, struct nfs4 | |||
2077 | { | 1945 | { |
2078 | struct xdr_stream xdr; | 1946 | struct xdr_stream xdr; |
2079 | struct compound_hdr hdr = { | 1947 | struct compound_hdr hdr = { |
2080 | .nops = 1, | 1948 | .nops = 0, |
2081 | }; | 1949 | }; |
2082 | 1950 | ||
2083 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1951 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); |
2084 | encode_compound_hdr(&xdr, &hdr); | 1952 | encode_compound_hdr(&xdr, &hdr); |
2085 | return encode_setclientid(&xdr, sc); | 1953 | encode_setclientid(&xdr, sc, &hdr); |
1954 | encode_nops(&hdr); | ||
1955 | return 0; | ||
2086 | } | 1956 | } |
2087 | 1957 | ||
2088 | /* | 1958 | /* |
@@ -2092,19 +1962,17 @@ static int nfs4_xdr_enc_setclientid_confirm(struct rpc_rqst *req, __be32 *p, str | |||
2092 | { | 1962 | { |
2093 | struct xdr_stream xdr; | 1963 | struct xdr_stream xdr; |
2094 | struct compound_hdr hdr = { | 1964 | struct compound_hdr hdr = { |
2095 | .nops = 3, | 1965 | .nops = 0, |
2096 | }; | 1966 | }; |
2097 | const u32 lease_bitmap[2] = { FATTR4_WORD0_LEASE_TIME, 0 }; | 1967 | const u32 lease_bitmap[2] = { FATTR4_WORD0_LEASE_TIME, 0 }; |
2098 | int status; | ||
2099 | 1968 | ||
2100 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1969 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); |
2101 | encode_compound_hdr(&xdr, &hdr); | 1970 | encode_compound_hdr(&xdr, &hdr); |
2102 | status = encode_setclientid_confirm(&xdr, clp); | 1971 | encode_setclientid_confirm(&xdr, clp, &hdr); |
2103 | if (!status) | 1972 | encode_putrootfh(&xdr, &hdr); |
2104 | status = encode_putrootfh(&xdr); | 1973 | encode_fsinfo(&xdr, lease_bitmap, &hdr); |
2105 | if (!status) | 1974 | encode_nops(&hdr); |
2106 | status = encode_fsinfo(&xdr, lease_bitmap); | 1975 | return 0; |
2107 | return status; | ||
2108 | } | 1976 | } |
2109 | 1977 | ||
2110 | /* | 1978 | /* |
@@ -2114,21 +1982,16 @@ static int nfs4_xdr_enc_delegreturn(struct rpc_rqst *req, __be32 *p, const struc | |||
2114 | { | 1982 | { |
2115 | struct xdr_stream xdr; | 1983 | struct xdr_stream xdr; |
2116 | struct compound_hdr hdr = { | 1984 | struct compound_hdr hdr = { |
2117 | .nops = 3, | 1985 | .nops = 0, |
2118 | }; | 1986 | }; |
2119 | int status; | ||
2120 | 1987 | ||
2121 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1988 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); |
2122 | encode_compound_hdr(&xdr, &hdr); | 1989 | encode_compound_hdr(&xdr, &hdr); |
2123 | status = encode_putfh(&xdr, args->fhandle); | 1990 | encode_putfh(&xdr, args->fhandle, &hdr); |
2124 | if (status != 0) | 1991 | encode_delegreturn(&xdr, args->stateid, &hdr); |
2125 | goto out; | 1992 | encode_getfattr(&xdr, args->bitmask, &hdr); |
2126 | status = encode_delegreturn(&xdr, args->stateid); | 1993 | encode_nops(&hdr); |
2127 | if (status != 0) | 1994 | return 0; |
2128 | goto out; | ||
2129 | status = encode_getfattr(&xdr, args->bitmask); | ||
2130 | out: | ||
2131 | return status; | ||
2132 | } | 1995 | } |
2133 | 1996 | ||
2134 | /* | 1997 | /* |
@@ -2138,20 +2001,17 @@ static int nfs4_xdr_enc_fs_locations(struct rpc_rqst *req, __be32 *p, struct nfs | |||
2138 | { | 2001 | { |
2139 | struct xdr_stream xdr; | 2002 | struct xdr_stream xdr; |
2140 | struct compound_hdr hdr = { | 2003 | struct compound_hdr hdr = { |
2141 | .nops = 3, | 2004 | .nops = 0, |
2142 | }; | 2005 | }; |
2143 | struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth; | 2006 | struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth; |
2144 | int replen; | 2007 | int replen; |
2145 | int status; | ||
2146 | 2008 | ||
2147 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 2009 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); |
2148 | encode_compound_hdr(&xdr, &hdr); | 2010 | encode_compound_hdr(&xdr, &hdr); |
2149 | if ((status = encode_putfh(&xdr, args->dir_fh)) != 0) | 2011 | encode_putfh(&xdr, args->dir_fh, &hdr); |
2150 | goto out; | 2012 | encode_lookup(&xdr, args->name, &hdr); |
2151 | if ((status = encode_lookup(&xdr, args->name)) != 0) | 2013 | encode_fs_locations(&xdr, args->bitmask, &hdr); |
2152 | goto out; | 2014 | |
2153 | if ((status = encode_fs_locations(&xdr, args->bitmask)) != 0) | ||
2154 | goto out; | ||
2155 | /* set up reply | 2015 | /* set up reply |
2156 | * toplevel_status + OP_PUTFH + status | 2016 | * toplevel_status + OP_PUTFH + status |
2157 | * + OP_LOOKUP + status + OP_GETATTR + status = 7 | 2017 | * + OP_LOOKUP + status + OP_GETATTR + status = 7 |
@@ -2159,8 +2019,8 @@ static int nfs4_xdr_enc_fs_locations(struct rpc_rqst *req, __be32 *p, struct nfs | |||
2159 | replen = (RPC_REPHDRSIZE + auth->au_rslack + 7) << 2; | 2019 | replen = (RPC_REPHDRSIZE + auth->au_rslack + 7) << 2; |
2160 | xdr_inline_pages(&req->rq_rcv_buf, replen, &args->page, | 2020 | xdr_inline_pages(&req->rq_rcv_buf, replen, &args->page, |
2161 | 0, PAGE_SIZE); | 2021 | 0, PAGE_SIZE); |
2162 | out: | 2022 | encode_nops(&hdr); |
2163 | return status; | 2023 | return 0; |
2164 | } | 2024 | } |
2165 | 2025 | ||
2166 | /* | 2026 | /* |
@@ -2217,11 +2077,13 @@ static int decode_compound_hdr(struct xdr_stream *xdr, struct compound_hdr *hdr) | |||
2217 | READ_BUF(8); | 2077 | READ_BUF(8); |
2218 | READ32(hdr->status); | 2078 | READ32(hdr->status); |
2219 | READ32(hdr->taglen); | 2079 | READ32(hdr->taglen); |
2220 | 2080 | ||
2221 | READ_BUF(hdr->taglen + 4); | 2081 | READ_BUF(hdr->taglen + 4); |
2222 | hdr->tag = (char *)p; | 2082 | hdr->tag = (char *)p; |
2223 | p += XDR_QUADLEN(hdr->taglen); | 2083 | p += XDR_QUADLEN(hdr->taglen); |
2224 | READ32(hdr->nops); | 2084 | READ32(hdr->nops); |
2085 | if (unlikely(hdr->nops < 1)) | ||
2086 | return nfs4_stat_to_errno(hdr->status); | ||
2225 | return 0; | 2087 | return 0; |
2226 | } | 2088 | } |
2227 | 2089 | ||
@@ -3047,8 +2909,7 @@ static int decode_create(struct xdr_stream *xdr, struct nfs4_change_info *cinfo) | |||
3047 | static int decode_server_caps(struct xdr_stream *xdr, struct nfs4_server_caps_res *res) | 2909 | static int decode_server_caps(struct xdr_stream *xdr, struct nfs4_server_caps_res *res) |
3048 | { | 2910 | { |
3049 | __be32 *savep; | 2911 | __be32 *savep; |
3050 | uint32_t attrlen, | 2912 | uint32_t attrlen, bitmap[2] = {0}; |
3051 | bitmap[2] = {0}; | ||
3052 | int status; | 2913 | int status; |
3053 | 2914 | ||
3054 | if ((status = decode_op_hdr(xdr, OP_GETATTR)) != 0) | 2915 | if ((status = decode_op_hdr(xdr, OP_GETATTR)) != 0) |
@@ -3070,14 +2931,13 @@ xdr_error: | |||
3070 | dprintk("%s: xdr returned %d!\n", __func__, -status); | 2931 | dprintk("%s: xdr returned %d!\n", __func__, -status); |
3071 | return status; | 2932 | return status; |
3072 | } | 2933 | } |
3073 | 2934 | ||
3074 | static int decode_statfs(struct xdr_stream *xdr, struct nfs_fsstat *fsstat) | 2935 | static int decode_statfs(struct xdr_stream *xdr, struct nfs_fsstat *fsstat) |
3075 | { | 2936 | { |
3076 | __be32 *savep; | 2937 | __be32 *savep; |
3077 | uint32_t attrlen, | 2938 | uint32_t attrlen, bitmap[2] = {0}; |
3078 | bitmap[2] = {0}; | ||
3079 | int status; | 2939 | int status; |
3080 | 2940 | ||
3081 | if ((status = decode_op_hdr(xdr, OP_GETATTR)) != 0) | 2941 | if ((status = decode_op_hdr(xdr, OP_GETATTR)) != 0) |
3082 | goto xdr_error; | 2942 | goto xdr_error; |
3083 | if ((status = decode_attr_bitmap(xdr, bitmap)) != 0) | 2943 | if ((status = decode_attr_bitmap(xdr, bitmap)) != 0) |
@@ -3107,10 +2967,9 @@ xdr_error: | |||
3107 | static int decode_pathconf(struct xdr_stream *xdr, struct nfs_pathconf *pathconf) | 2967 | static int decode_pathconf(struct xdr_stream *xdr, struct nfs_pathconf *pathconf) |
3108 | { | 2968 | { |
3109 | __be32 *savep; | 2969 | __be32 *savep; |
3110 | uint32_t attrlen, | 2970 | uint32_t attrlen, bitmap[2] = {0}; |
3111 | bitmap[2] = {0}; | ||
3112 | int status; | 2971 | int status; |
3113 | 2972 | ||
3114 | if ((status = decode_op_hdr(xdr, OP_GETATTR)) != 0) | 2973 | if ((status = decode_op_hdr(xdr, OP_GETATTR)) != 0) |
3115 | goto xdr_error; | 2974 | goto xdr_error; |
3116 | if ((status = decode_attr_bitmap(xdr, bitmap)) != 0) | 2975 | if ((status = decode_attr_bitmap(xdr, bitmap)) != 0) |
@@ -3256,7 +3115,7 @@ static int decode_getfh(struct xdr_stream *xdr, struct nfs_fh *fh) | |||
3256 | static int decode_link(struct xdr_stream *xdr, struct nfs4_change_info *cinfo) | 3115 | static int decode_link(struct xdr_stream *xdr, struct nfs4_change_info *cinfo) |
3257 | { | 3116 | { |
3258 | int status; | 3117 | int status; |
3259 | 3118 | ||
3260 | status = decode_op_hdr(xdr, OP_LINK); | 3119 | status = decode_op_hdr(xdr, OP_LINK); |
3261 | if (status) | 3120 | if (status) |
3262 | return status; | 3121 | return status; |
@@ -3344,27 +3203,27 @@ static int decode_lookup(struct xdr_stream *xdr) | |||
3344 | /* This is too sick! */ | 3203 | /* This is too sick! */ |
3345 | static int decode_space_limit(struct xdr_stream *xdr, u64 *maxsize) | 3204 | static int decode_space_limit(struct xdr_stream *xdr, u64 *maxsize) |
3346 | { | 3205 | { |
3347 | __be32 *p; | 3206 | __be32 *p; |
3348 | uint32_t limit_type, nblocks, blocksize; | 3207 | uint32_t limit_type, nblocks, blocksize; |
3349 | 3208 | ||
3350 | READ_BUF(12); | 3209 | READ_BUF(12); |
3351 | READ32(limit_type); | 3210 | READ32(limit_type); |
3352 | switch (limit_type) { | 3211 | switch (limit_type) { |
3353 | case 1: | 3212 | case 1: |
3354 | READ64(*maxsize); | 3213 | READ64(*maxsize); |
3355 | break; | 3214 | break; |
3356 | case 2: | 3215 | case 2: |
3357 | READ32(nblocks); | 3216 | READ32(nblocks); |
3358 | READ32(blocksize); | 3217 | READ32(blocksize); |
3359 | *maxsize = (uint64_t)nblocks * (uint64_t)blocksize; | 3218 | *maxsize = (uint64_t)nblocks * (uint64_t)blocksize; |
3360 | } | 3219 | } |
3361 | return 0; | 3220 | return 0; |
3362 | } | 3221 | } |
3363 | 3222 | ||
3364 | static int decode_delegation(struct xdr_stream *xdr, struct nfs_openres *res) | 3223 | static int decode_delegation(struct xdr_stream *xdr, struct nfs_openres *res) |
3365 | { | 3224 | { |
3366 | __be32 *p; | 3225 | __be32 *p; |
3367 | uint32_t delegation_type; | 3226 | uint32_t delegation_type; |
3368 | 3227 | ||
3369 | READ_BUF(4); | 3228 | READ_BUF(4); |
3370 | READ32(delegation_type); | 3229 | READ32(delegation_type); |
@@ -3375,13 +3234,14 @@ static int decode_delegation(struct xdr_stream *xdr, struct nfs_openres *res) | |||
3375 | READ_BUF(NFS4_STATEID_SIZE+4); | 3234 | READ_BUF(NFS4_STATEID_SIZE+4); |
3376 | COPYMEM(res->delegation.data, NFS4_STATEID_SIZE); | 3235 | COPYMEM(res->delegation.data, NFS4_STATEID_SIZE); |
3377 | READ32(res->do_recall); | 3236 | READ32(res->do_recall); |
3237 | |||
3378 | switch (delegation_type) { | 3238 | switch (delegation_type) { |
3379 | case NFS4_OPEN_DELEGATE_READ: | 3239 | case NFS4_OPEN_DELEGATE_READ: |
3380 | res->delegation_type = FMODE_READ; | 3240 | res->delegation_type = FMODE_READ; |
3381 | break; | 3241 | break; |
3382 | case NFS4_OPEN_DELEGATE_WRITE: | 3242 | case NFS4_OPEN_DELEGATE_WRITE: |
3383 | res->delegation_type = FMODE_WRITE|FMODE_READ; | 3243 | res->delegation_type = FMODE_WRITE|FMODE_READ; |
3384 | if (decode_space_limit(xdr, &res->maxsize) < 0) | 3244 | if (decode_space_limit(xdr, &res->maxsize) < 0) |
3385 | return -EIO; | 3245 | return -EIO; |
3386 | } | 3246 | } |
3387 | return decode_ace(xdr, NULL, res->server->nfs_client); | 3247 | return decode_ace(xdr, NULL, res->server->nfs_client); |
@@ -3389,27 +3249,27 @@ static int decode_delegation(struct xdr_stream *xdr, struct nfs_openres *res) | |||
3389 | 3249 | ||
3390 | static int decode_open(struct xdr_stream *xdr, struct nfs_openres *res) | 3250 | static int decode_open(struct xdr_stream *xdr, struct nfs_openres *res) |
3391 | { | 3251 | { |
3392 | __be32 *p; | 3252 | __be32 *p; |
3393 | uint32_t savewords, bmlen, i; | 3253 | uint32_t savewords, bmlen, i; |
3394 | int status; | 3254 | int status; |
3395 | 3255 | ||
3396 | status = decode_op_hdr(xdr, OP_OPEN); | 3256 | status = decode_op_hdr(xdr, OP_OPEN); |
3397 | if (status != -EIO) | 3257 | if (status != -EIO) |
3398 | nfs_increment_open_seqid(status, res->seqid); | 3258 | nfs_increment_open_seqid(status, res->seqid); |
3399 | if (status) | 3259 | if (status) |
3400 | return status; | 3260 | return status; |
3401 | READ_BUF(NFS4_STATEID_SIZE); | 3261 | READ_BUF(NFS4_STATEID_SIZE); |
3402 | COPYMEM(res->stateid.data, NFS4_STATEID_SIZE); | 3262 | COPYMEM(res->stateid.data, NFS4_STATEID_SIZE); |
3403 | 3263 | ||
3404 | decode_change_info(xdr, &res->cinfo); | 3264 | decode_change_info(xdr, &res->cinfo); |
3405 | 3265 | ||
3406 | READ_BUF(8); | 3266 | READ_BUF(8); |
3407 | READ32(res->rflags); | 3267 | READ32(res->rflags); |
3408 | READ32(bmlen); | 3268 | READ32(bmlen); |
3409 | if (bmlen > 10) | 3269 | if (bmlen > 10) |
3410 | goto xdr_error; | 3270 | goto xdr_error; |
3411 | 3271 | ||
3412 | READ_BUF(bmlen << 2); | 3272 | READ_BUF(bmlen << 2); |
3413 | savewords = min_t(uint32_t, bmlen, NFS4_BITMAP_SIZE); | 3273 | savewords = min_t(uint32_t, bmlen, NFS4_BITMAP_SIZE); |
3414 | for (i = 0; i < savewords; ++i) | 3274 | for (i = 0; i < savewords; ++i) |
3415 | READ32(res->attrset[i]); | 3275 | READ32(res->attrset[i]); |
@@ -3424,17 +3284,17 @@ xdr_error: | |||
3424 | 3284 | ||
3425 | static int decode_open_confirm(struct xdr_stream *xdr, struct nfs_open_confirmres *res) | 3285 | static int decode_open_confirm(struct xdr_stream *xdr, struct nfs_open_confirmres *res) |
3426 | { | 3286 | { |
3427 | __be32 *p; | 3287 | __be32 *p; |
3428 | int status; | 3288 | int status; |
3429 | 3289 | ||
3430 | status = decode_op_hdr(xdr, OP_OPEN_CONFIRM); | 3290 | status = decode_op_hdr(xdr, OP_OPEN_CONFIRM); |
3431 | if (status != -EIO) | 3291 | if (status != -EIO) |
3432 | nfs_increment_open_seqid(status, res->seqid); | 3292 | nfs_increment_open_seqid(status, res->seqid); |
3433 | if (status) | 3293 | if (status) |
3434 | return status; | 3294 | return status; |
3435 | READ_BUF(NFS4_STATEID_SIZE); | 3295 | READ_BUF(NFS4_STATEID_SIZE); |
3436 | COPYMEM(res->stateid.data, NFS4_STATEID_SIZE); | 3296 | COPYMEM(res->stateid.data, NFS4_STATEID_SIZE); |
3437 | return 0; | 3297 | return 0; |
3438 | } | 3298 | } |
3439 | 3299 | ||
3440 | static int decode_open_downgrade(struct xdr_stream *xdr, struct nfs_closeres *res) | 3300 | static int decode_open_downgrade(struct xdr_stream *xdr, struct nfs_closeres *res) |
@@ -3562,7 +3422,7 @@ static int decode_readdir(struct xdr_stream *xdr, struct rpc_rqst *req, struct n | |||
3562 | dprintk("NFS: readdir reply truncated!\n"); | 3422 | dprintk("NFS: readdir reply truncated!\n"); |
3563 | entry[1] = 1; | 3423 | entry[1] = 1; |
3564 | } | 3424 | } |
3565 | out: | 3425 | out: |
3566 | kunmap_atomic(kaddr, KM_USER0); | 3426 | kunmap_atomic(kaddr, KM_USER0); |
3567 | return 0; | 3427 | return 0; |
3568 | short_pkt: | 3428 | short_pkt: |
@@ -3718,7 +3578,6 @@ static int decode_setattr(struct xdr_stream *xdr, struct nfs_setattrres *res) | |||
3718 | uint32_t bmlen; | 3578 | uint32_t bmlen; |
3719 | int status; | 3579 | int status; |
3720 | 3580 | ||
3721 | |||
3722 | status = decode_op_hdr(xdr, OP_SETATTR); | 3581 | status = decode_op_hdr(xdr, OP_SETATTR); |
3723 | if (status) | 3582 | if (status) |
3724 | return status; | 3583 | return status; |
@@ -3738,7 +3597,7 @@ static int decode_setclientid(struct xdr_stream *xdr, struct nfs_client *clp) | |||
3738 | READ32(opnum); | 3597 | READ32(opnum); |
3739 | if (opnum != OP_SETCLIENTID) { | 3598 | if (opnum != OP_SETCLIENTID) { |
3740 | dprintk("nfs: decode_setclientid: Server returned operation" | 3599 | dprintk("nfs: decode_setclientid: Server returned operation" |
3741 | " %d\n", opnum); | 3600 | " %d\n", opnum); |
3742 | return -EIO; | 3601 | return -EIO; |
3743 | } | 3602 | } |
3744 | READ32(nfserr); | 3603 | READ32(nfserr); |
@@ -3792,34 +3651,34 @@ static int decode_delegreturn(struct xdr_stream *xdr) | |||
3792 | } | 3651 | } |
3793 | 3652 | ||
3794 | /* | 3653 | /* |
3654 | * END OF "GENERIC" DECODE ROUTINES. | ||
3655 | */ | ||
3656 | |||
3657 | /* | ||
3795 | * Decode OPEN_DOWNGRADE response | 3658 | * Decode OPEN_DOWNGRADE response |
3796 | */ | 3659 | */ |
3797 | static int nfs4_xdr_dec_open_downgrade(struct rpc_rqst *rqstp, __be32 *p, struct nfs_closeres *res) | 3660 | static int nfs4_xdr_dec_open_downgrade(struct rpc_rqst *rqstp, __be32 *p, struct nfs_closeres *res) |
3798 | { | 3661 | { |
3799 | struct xdr_stream xdr; | 3662 | struct xdr_stream xdr; |
3800 | struct compound_hdr hdr; | 3663 | struct compound_hdr hdr; |
3801 | int status; | 3664 | int status; |
3802 | 3665 | ||
3803 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); | 3666 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); |
3804 | status = decode_compound_hdr(&xdr, &hdr); | 3667 | status = decode_compound_hdr(&xdr, &hdr); |
3805 | if (status) | 3668 | if (status) |
3806 | goto out; | 3669 | goto out; |
3807 | status = decode_putfh(&xdr); | 3670 | status = decode_putfh(&xdr); |
3808 | if (status) | 3671 | if (status) |
3809 | goto out; | 3672 | goto out; |
3810 | status = decode_open_downgrade(&xdr, res); | 3673 | status = decode_open_downgrade(&xdr, res); |
3811 | if (status != 0) | 3674 | if (status != 0) |
3812 | goto out; | 3675 | goto out; |
3813 | decode_getfattr(&xdr, res->fattr, res->server); | 3676 | decode_getfattr(&xdr, res->fattr, res->server); |
3814 | out: | 3677 | out: |
3815 | return status; | 3678 | return status; |
3816 | } | 3679 | } |
3817 | 3680 | ||
3818 | /* | 3681 | /* |
3819 | * END OF "GENERIC" DECODE ROUTINES. | ||
3820 | */ | ||
3821 | |||
3822 | /* | ||
3823 | * Decode ACCESS response | 3682 | * Decode ACCESS response |
3824 | */ | 3683 | */ |
3825 | static int nfs4_xdr_dec_access(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_accessres *res) | 3684 | static int nfs4_xdr_dec_access(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_accessres *res) |
@@ -3827,7 +3686,7 @@ static int nfs4_xdr_dec_access(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_ac | |||
3827 | struct xdr_stream xdr; | 3686 | struct xdr_stream xdr; |
3828 | struct compound_hdr hdr; | 3687 | struct compound_hdr hdr; |
3829 | int status; | 3688 | int status; |
3830 | 3689 | ||
3831 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); | 3690 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); |
3832 | if ((status = decode_compound_hdr(&xdr, &hdr)) != 0) | 3691 | if ((status = decode_compound_hdr(&xdr, &hdr)) != 0) |
3833 | goto out; | 3692 | goto out; |
@@ -3850,7 +3709,7 @@ static int nfs4_xdr_dec_lookup(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_lo | |||
3850 | struct xdr_stream xdr; | 3709 | struct xdr_stream xdr; |
3851 | struct compound_hdr hdr; | 3710 | struct compound_hdr hdr; |
3852 | int status; | 3711 | int status; |
3853 | 3712 | ||
3854 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); | 3713 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); |
3855 | if ((status = decode_compound_hdr(&xdr, &hdr)) != 0) | 3714 | if ((status = decode_compound_hdr(&xdr, &hdr)) != 0) |
3856 | goto out; | 3715 | goto out; |
@@ -3873,7 +3732,7 @@ static int nfs4_xdr_dec_lookup_root(struct rpc_rqst *rqstp, __be32 *p, struct nf | |||
3873 | struct xdr_stream xdr; | 3732 | struct xdr_stream xdr; |
3874 | struct compound_hdr hdr; | 3733 | struct compound_hdr hdr; |
3875 | int status; | 3734 | int status; |
3876 | 3735 | ||
3877 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); | 3736 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); |
3878 | if ((status = decode_compound_hdr(&xdr, &hdr)) != 0) | 3737 | if ((status = decode_compound_hdr(&xdr, &hdr)) != 0) |
3879 | goto out; | 3738 | goto out; |
@@ -3893,7 +3752,7 @@ static int nfs4_xdr_dec_remove(struct rpc_rqst *rqstp, __be32 *p, struct nfs_rem | |||
3893 | struct xdr_stream xdr; | 3752 | struct xdr_stream xdr; |
3894 | struct compound_hdr hdr; | 3753 | struct compound_hdr hdr; |
3895 | int status; | 3754 | int status; |
3896 | 3755 | ||
3897 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); | 3756 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); |
3898 | if ((status = decode_compound_hdr(&xdr, &hdr)) != 0) | 3757 | if ((status = decode_compound_hdr(&xdr, &hdr)) != 0) |
3899 | goto out; | 3758 | goto out; |
@@ -3914,7 +3773,7 @@ static int nfs4_xdr_dec_rename(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_re | |||
3914 | struct xdr_stream xdr; | 3773 | struct xdr_stream xdr; |
3915 | struct compound_hdr hdr; | 3774 | struct compound_hdr hdr; |
3916 | int status; | 3775 | int status; |
3917 | 3776 | ||
3918 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); | 3777 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); |
3919 | if ((status = decode_compound_hdr(&xdr, &hdr)) != 0) | 3778 | if ((status = decode_compound_hdr(&xdr, &hdr)) != 0) |
3920 | goto out; | 3779 | goto out; |
@@ -3944,7 +3803,7 @@ static int nfs4_xdr_dec_link(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_link | |||
3944 | struct xdr_stream xdr; | 3803 | struct xdr_stream xdr; |
3945 | struct compound_hdr hdr; | 3804 | struct compound_hdr hdr; |
3946 | int status; | 3805 | int status; |
3947 | 3806 | ||
3948 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); | 3807 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); |
3949 | if ((status = decode_compound_hdr(&xdr, &hdr)) != 0) | 3808 | if ((status = decode_compound_hdr(&xdr, &hdr)) != 0) |
3950 | goto out; | 3809 | goto out; |
@@ -3977,7 +3836,7 @@ static int nfs4_xdr_dec_create(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_cr | |||
3977 | struct xdr_stream xdr; | 3836 | struct xdr_stream xdr; |
3978 | struct compound_hdr hdr; | 3837 | struct compound_hdr hdr; |
3979 | int status; | 3838 | int status; |
3980 | 3839 | ||
3981 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); | 3840 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); |
3982 | if ((status = decode_compound_hdr(&xdr, &hdr)) != 0) | 3841 | if ((status = decode_compound_hdr(&xdr, &hdr)) != 0) |
3983 | goto out; | 3842 | goto out; |
@@ -4014,7 +3873,7 @@ static int nfs4_xdr_dec_getattr(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_g | |||
4014 | struct xdr_stream xdr; | 3873 | struct xdr_stream xdr; |
4015 | struct compound_hdr hdr; | 3874 | struct compound_hdr hdr; |
4016 | int status; | 3875 | int status; |
4017 | 3876 | ||
4018 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); | 3877 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); |
4019 | status = decode_compound_hdr(&xdr, &hdr); | 3878 | status = decode_compound_hdr(&xdr, &hdr); |
4020 | if (status) | 3879 | if (status) |
@@ -4025,7 +3884,6 @@ static int nfs4_xdr_dec_getattr(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_g | |||
4025 | status = decode_getfattr(&xdr, res->fattr, res->server); | 3884 | status = decode_getfattr(&xdr, res->fattr, res->server); |
4026 | out: | 3885 | out: |
4027 | return status; | 3886 | return status; |
4028 | |||
4029 | } | 3887 | } |
4030 | 3888 | ||
4031 | /* | 3889 | /* |
@@ -4034,21 +3892,20 @@ out: | |||
4034 | static int | 3892 | static int |
4035 | nfs4_xdr_enc_setacl(struct rpc_rqst *req, __be32 *p, struct nfs_setaclargs *args) | 3893 | nfs4_xdr_enc_setacl(struct rpc_rqst *req, __be32 *p, struct nfs_setaclargs *args) |
4036 | { | 3894 | { |
4037 | struct xdr_stream xdr; | 3895 | struct xdr_stream xdr; |
4038 | struct compound_hdr hdr = { | 3896 | struct compound_hdr hdr = { |
4039 | .nops = 2, | 3897 | .nops = 0, |
4040 | }; | 3898 | }; |
4041 | int status; | 3899 | int status; |
4042 | 3900 | ||
4043 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 3901 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); |
4044 | encode_compound_hdr(&xdr, &hdr); | 3902 | encode_compound_hdr(&xdr, &hdr); |
4045 | status = encode_putfh(&xdr, args->fh); | 3903 | encode_putfh(&xdr, args->fh, &hdr); |
4046 | if (status) | 3904 | status = encode_setacl(&xdr, args, &hdr); |
4047 | goto out; | 3905 | encode_nops(&hdr); |
4048 | status = encode_setacl(&xdr, args); | 3906 | return status; |
4049 | out: | ||
4050 | return status; | ||
4051 | } | 3907 | } |
3908 | |||
4052 | /* | 3909 | /* |
4053 | * Decode SETACL response | 3910 | * Decode SETACL response |
4054 | */ | 3911 | */ |
@@ -4099,18 +3956,18 @@ out: | |||
4099 | */ | 3956 | */ |
4100 | static int nfs4_xdr_dec_close(struct rpc_rqst *rqstp, __be32 *p, struct nfs_closeres *res) | 3957 | static int nfs4_xdr_dec_close(struct rpc_rqst *rqstp, __be32 *p, struct nfs_closeres *res) |
4101 | { | 3958 | { |
4102 | struct xdr_stream xdr; | 3959 | struct xdr_stream xdr; |
4103 | struct compound_hdr hdr; | 3960 | struct compound_hdr hdr; |
4104 | int status; | 3961 | int status; |
4105 | 3962 | ||
4106 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); | 3963 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); |
4107 | status = decode_compound_hdr(&xdr, &hdr); | 3964 | status = decode_compound_hdr(&xdr, &hdr); |
4108 | if (status) | 3965 | if (status) |
4109 | goto out; | 3966 | goto out; |
4110 | status = decode_putfh(&xdr); | 3967 | status = decode_putfh(&xdr); |
4111 | if (status) | 3968 | if (status) |
4112 | goto out; | 3969 | goto out; |
4113 | status = decode_close(&xdr, res); | 3970 | status = decode_close(&xdr, res); |
4114 | if (status != 0) | 3971 | if (status != 0) |
4115 | goto out; | 3972 | goto out; |
4116 | /* | 3973 | /* |
@@ -4121,7 +3978,7 @@ static int nfs4_xdr_dec_close(struct rpc_rqst *rqstp, __be32 *p, struct nfs_clos | |||
4121 | */ | 3978 | */ |
4122 | decode_getfattr(&xdr, res->fattr, res->server); | 3979 | decode_getfattr(&xdr, res->fattr, res->server); |
4123 | out: | 3980 | out: |
4124 | return status; | 3981 | return status; |
4125 | } | 3982 | } |
4126 | 3983 | ||
4127 | /* | 3984 | /* |
@@ -4129,23 +3986,23 @@ out: | |||
4129 | */ | 3986 | */ |
4130 | static int nfs4_xdr_dec_open(struct rpc_rqst *rqstp, __be32 *p, struct nfs_openres *res) | 3987 | static int nfs4_xdr_dec_open(struct rpc_rqst *rqstp, __be32 *p, struct nfs_openres *res) |
4131 | { | 3988 | { |
4132 | struct xdr_stream xdr; | 3989 | struct xdr_stream xdr; |
4133 | struct compound_hdr hdr; | 3990 | struct compound_hdr hdr; |
4134 | int status; | 3991 | int status; |
4135 | 3992 | ||
4136 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); | 3993 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); |
4137 | status = decode_compound_hdr(&xdr, &hdr); | 3994 | status = decode_compound_hdr(&xdr, &hdr); |
4138 | if (status) | 3995 | if (status) |
4139 | goto out; | 3996 | goto out; |
4140 | status = decode_putfh(&xdr); | 3997 | status = decode_putfh(&xdr); |
4141 | if (status) | 3998 | if (status) |
4142 | goto out; | 3999 | goto out; |
4143 | status = decode_savefh(&xdr); | 4000 | status = decode_savefh(&xdr); |
4001 | if (status) | ||
4002 | goto out; | ||
4003 | status = decode_open(&xdr, res); | ||
4144 | if (status) | 4004 | if (status) |
4145 | goto out; | 4005 | goto out; |
4146 | status = decode_open(&xdr, res); | ||
4147 | if (status) | ||
4148 | goto out; | ||
4149 | if (decode_getfh(&xdr, &res->fh) != 0) | 4006 | if (decode_getfh(&xdr, &res->fh) != 0) |
4150 | goto out; | 4007 | goto out; |
4151 | if (decode_getfattr(&xdr, res->f_attr, res->server) != 0) | 4008 | if (decode_getfattr(&xdr, res->f_attr, res->server) != 0) |
@@ -4154,7 +4011,7 @@ static int nfs4_xdr_dec_open(struct rpc_rqst *rqstp, __be32 *p, struct nfs_openr | |||
4154 | goto out; | 4011 | goto out; |
4155 | decode_getfattr(&xdr, res->dir_attr, res->server); | 4012 | decode_getfattr(&xdr, res->dir_attr, res->server); |
4156 | out: | 4013 | out: |
4157 | return status; | 4014 | return status; |
4158 | } | 4015 | } |
4159 | 4016 | ||
4160 | /* | 4017 | /* |
@@ -4162,20 +4019,20 @@ out: | |||
4162 | */ | 4019 | */ |
4163 | static int nfs4_xdr_dec_open_confirm(struct rpc_rqst *rqstp, __be32 *p, struct nfs_open_confirmres *res) | 4020 | static int nfs4_xdr_dec_open_confirm(struct rpc_rqst *rqstp, __be32 *p, struct nfs_open_confirmres *res) |
4164 | { | 4021 | { |
4165 | struct xdr_stream xdr; | 4022 | struct xdr_stream xdr; |
4166 | struct compound_hdr hdr; | 4023 | struct compound_hdr hdr; |
4167 | int status; | 4024 | int status; |
4168 | 4025 | ||
4169 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); | 4026 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); |
4170 | status = decode_compound_hdr(&xdr, &hdr); | 4027 | status = decode_compound_hdr(&xdr, &hdr); |
4171 | if (status) | 4028 | if (status) |
4172 | goto out; | 4029 | goto out; |
4173 | status = decode_putfh(&xdr); | 4030 | status = decode_putfh(&xdr); |
4174 | if (status) | 4031 | if (status) |
4175 | goto out; | 4032 | goto out; |
4176 | status = decode_open_confirm(&xdr, res); | 4033 | status = decode_open_confirm(&xdr, res); |
4177 | out: | 4034 | out: |
4178 | return status; | 4035 | return status; |
4179 | } | 4036 | } |
4180 | 4037 | ||
4181 | /* | 4038 | /* |
@@ -4183,23 +4040,23 @@ out: | |||
4183 | */ | 4040 | */ |
4184 | static int nfs4_xdr_dec_open_noattr(struct rpc_rqst *rqstp, __be32 *p, struct nfs_openres *res) | 4041 | static int nfs4_xdr_dec_open_noattr(struct rpc_rqst *rqstp, __be32 *p, struct nfs_openres *res) |
4185 | { | 4042 | { |
4186 | struct xdr_stream xdr; | 4043 | struct xdr_stream xdr; |
4187 | struct compound_hdr hdr; | 4044 | struct compound_hdr hdr; |
4188 | int status; | 4045 | int status; |
4189 | 4046 | ||
4190 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); | 4047 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); |
4191 | status = decode_compound_hdr(&xdr, &hdr); | 4048 | status = decode_compound_hdr(&xdr, &hdr); |
4192 | if (status) | 4049 | if (status) |
4193 | goto out; | 4050 | goto out; |
4194 | status = decode_putfh(&xdr); | 4051 | status = decode_putfh(&xdr); |
4195 | if (status) | 4052 | if (status) |
4196 | goto out; | 4053 | goto out; |
4197 | status = decode_open(&xdr, res); | 4054 | status = decode_open(&xdr, res); |
4198 | if (status) | 4055 | if (status) |
4199 | goto out; | 4056 | goto out; |
4200 | decode_getfattr(&xdr, res->f_attr, res->server); | 4057 | decode_getfattr(&xdr, res->f_attr, res->server); |
4201 | out: | 4058 | out: |
4202 | return status; | 4059 | return status; |
4203 | } | 4060 | } |
4204 | 4061 | ||
4205 | /* | 4062 | /* |
@@ -4207,25 +4064,25 @@ out: | |||
4207 | */ | 4064 | */ |
4208 | static int nfs4_xdr_dec_setattr(struct rpc_rqst *rqstp, __be32 *p, struct nfs_setattrres *res) | 4065 | static int nfs4_xdr_dec_setattr(struct rpc_rqst *rqstp, __be32 *p, struct nfs_setattrres *res) |
4209 | { | 4066 | { |
4210 | struct xdr_stream xdr; | 4067 | struct xdr_stream xdr; |
4211 | struct compound_hdr hdr; | 4068 | struct compound_hdr hdr; |
4212 | int status; | 4069 | int status; |
4213 | 4070 | ||
4214 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); | 4071 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); |
4215 | status = decode_compound_hdr(&xdr, &hdr); | 4072 | status = decode_compound_hdr(&xdr, &hdr); |
4216 | if (status) | 4073 | if (status) |
4217 | goto out; | 4074 | goto out; |
4218 | status = decode_putfh(&xdr); | 4075 | status = decode_putfh(&xdr); |
4219 | if (status) | 4076 | if (status) |
4220 | goto out; | 4077 | goto out; |
4221 | status = decode_setattr(&xdr, res); | 4078 | status = decode_setattr(&xdr, res); |
4222 | if (status) | 4079 | if (status) |
4223 | goto out; | 4080 | goto out; |
4224 | status = decode_getfattr(&xdr, res->fattr, res->server); | 4081 | status = decode_getfattr(&xdr, res->fattr, res->server); |
4225 | if (status == NFS4ERR_DELAY) | 4082 | if (status == NFS4ERR_DELAY) |
4226 | status = 0; | 4083 | status = 0; |
4227 | out: | 4084 | out: |
4228 | return status; | 4085 | return status; |
4229 | } | 4086 | } |
4230 | 4087 | ||
4231 | /* | 4088 | /* |
@@ -4421,8 +4278,6 @@ static int nfs4_xdr_dec_fsinfo(struct rpc_rqst *req, __be32 *p, struct nfs_fsinf | |||
4421 | status = decode_putfh(&xdr); | 4278 | status = decode_putfh(&xdr); |
4422 | if (!status) | 4279 | if (!status) |
4423 | status = decode_fsinfo(&xdr, fsinfo); | 4280 | status = decode_fsinfo(&xdr, fsinfo); |
4424 | if (!status) | ||
4425 | status = nfs4_stat_to_errno(hdr.status); | ||
4426 | return status; | 4281 | return status; |
4427 | } | 4282 | } |
4428 | 4283 | ||
@@ -4511,8 +4366,6 @@ static int nfs4_xdr_dec_setclientid(struct rpc_rqst *req, __be32 *p, | |||
4511 | status = decode_compound_hdr(&xdr, &hdr); | 4366 | status = decode_compound_hdr(&xdr, &hdr); |
4512 | if (!status) | 4367 | if (!status) |
4513 | status = decode_setclientid(&xdr, clp); | 4368 | status = decode_setclientid(&xdr, clp); |
4514 | if (!status) | ||
4515 | status = nfs4_stat_to_errno(hdr.status); | ||
4516 | return status; | 4369 | return status; |
4517 | } | 4370 | } |
4518 | 4371 | ||
@@ -4533,8 +4386,6 @@ static int nfs4_xdr_dec_setclientid_confirm(struct rpc_rqst *req, __be32 *p, str | |||
4533 | status = decode_putrootfh(&xdr); | 4386 | status = decode_putrootfh(&xdr); |
4534 | if (!status) | 4387 | if (!status) |
4535 | status = decode_fsinfo(&xdr, fsinfo); | 4388 | status = decode_fsinfo(&xdr, fsinfo); |
4536 | if (!status) | ||
4537 | status = nfs4_stat_to_errno(hdr.status); | ||
4538 | return status; | 4389 | return status; |
4539 | } | 4390 | } |
4540 | 4391 | ||
@@ -4715,7 +4566,7 @@ nfs4_stat_to_errno(int stat) | |||
4715 | .p_replen = NFS4_##restype##_sz, \ | 4566 | .p_replen = NFS4_##restype##_sz, \ |
4716 | .p_statidx = NFSPROC4_CLNT_##proc, \ | 4567 | .p_statidx = NFSPROC4_CLNT_##proc, \ |
4717 | .p_name = #proc, \ | 4568 | .p_name = #proc, \ |
4718 | } | 4569 | } |
4719 | 4570 | ||
4720 | struct rpc_procinfo nfs4_procedures[] = { | 4571 | struct rpc_procinfo nfs4_procedures[] = { |
4721 | PROC(READ, enc_read, dec_read), | 4572 | PROC(READ, enc_read, dec_read), |