diff options
author | Benny Halevy <bhalevy@panasas.com> | 2009-08-14 10:20:19 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2009-08-14 14:02:26 -0400 |
commit | cccddf4f5580131c9b963900e1d3400655e633cc (patch) | |
tree | 656eec24843a3c3ae28ee5d227e8ade80aa31c1f /fs/nfs | |
parent | c0eae66ece40bdb8cd88c5106834b71a1c9f421c (diff) |
nfs: nfs4xdr: optimize low level decoding
do not increment decoding ptr if not needed.
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/nfs4xdr.c | 118 |
1 files changed, 59 insertions, 59 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index b0d690c3a24c..14b6f513648f 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -2437,7 +2437,7 @@ static int decode_opaque_inline(struct xdr_stream *xdr, unsigned int *len, char | |||
2437 | p = xdr_inline_decode(xdr, 4); | 2437 | p = xdr_inline_decode(xdr, 4); |
2438 | if (unlikely(!p)) | 2438 | if (unlikely(!p)) |
2439 | goto out_overflow; | 2439 | goto out_overflow; |
2440 | *len = be32_to_cpup(p++); | 2440 | *len = be32_to_cpup(p); |
2441 | p = xdr_inline_decode(xdr, *len); | 2441 | p = xdr_inline_decode(xdr, *len); |
2442 | if (unlikely(!p)) | 2442 | if (unlikely(!p)) |
2443 | goto out_overflow; | 2443 | goto out_overflow; |
@@ -2456,14 +2456,14 @@ static int decode_compound_hdr(struct xdr_stream *xdr, struct compound_hdr *hdr) | |||
2456 | if (unlikely(!p)) | 2456 | if (unlikely(!p)) |
2457 | goto out_overflow; | 2457 | goto out_overflow; |
2458 | hdr->status = be32_to_cpup(p++); | 2458 | hdr->status = be32_to_cpup(p++); |
2459 | hdr->taglen = be32_to_cpup(p++); | 2459 | hdr->taglen = be32_to_cpup(p); |
2460 | 2460 | ||
2461 | p = xdr_inline_decode(xdr, hdr->taglen + 4); | 2461 | p = xdr_inline_decode(xdr, hdr->taglen + 4); |
2462 | if (unlikely(!p)) | 2462 | if (unlikely(!p)) |
2463 | goto out_overflow; | 2463 | goto out_overflow; |
2464 | hdr->tag = (char *)p; | 2464 | hdr->tag = (char *)p; |
2465 | p += XDR_QUADLEN(hdr->taglen); | 2465 | p += XDR_QUADLEN(hdr->taglen); |
2466 | hdr->nops = be32_to_cpup(p++); | 2466 | hdr->nops = be32_to_cpup(p); |
2467 | if (unlikely(hdr->nops < 1)) | 2467 | if (unlikely(hdr->nops < 1)) |
2468 | return nfs4_stat_to_errno(hdr->status); | 2468 | return nfs4_stat_to_errno(hdr->status); |
2469 | return 0; | 2469 | return 0; |
@@ -2488,7 +2488,7 @@ static int decode_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected) | |||
2488 | opnum, expected); | 2488 | opnum, expected); |
2489 | return -EIO; | 2489 | return -EIO; |
2490 | } | 2490 | } |
2491 | nfserr = be32_to_cpup(p++); | 2491 | nfserr = be32_to_cpup(p); |
2492 | if (nfserr != NFS_OK) | 2492 | if (nfserr != NFS_OK) |
2493 | return nfs4_stat_to_errno(nfserr); | 2493 | return nfs4_stat_to_errno(nfserr); |
2494 | return 0; | 2494 | return 0; |
@@ -2519,7 +2519,7 @@ static int decode_attr_bitmap(struct xdr_stream *xdr, uint32_t *bitmap) | |||
2519 | p = xdr_inline_decode(xdr, 4); | 2519 | p = xdr_inline_decode(xdr, 4); |
2520 | if (unlikely(!p)) | 2520 | if (unlikely(!p)) |
2521 | goto out_overflow; | 2521 | goto out_overflow; |
2522 | bmlen = be32_to_cpup(p++); | 2522 | bmlen = be32_to_cpup(p); |
2523 | 2523 | ||
2524 | bitmap[0] = bitmap[1] = 0; | 2524 | bitmap[0] = bitmap[1] = 0; |
2525 | p = xdr_inline_decode(xdr, (bmlen << 2)); | 2525 | p = xdr_inline_decode(xdr, (bmlen << 2)); |
@@ -2528,7 +2528,7 @@ static int decode_attr_bitmap(struct xdr_stream *xdr, uint32_t *bitmap) | |||
2528 | if (bmlen > 0) { | 2528 | if (bmlen > 0) { |
2529 | bitmap[0] = be32_to_cpup(p++); | 2529 | bitmap[0] = be32_to_cpup(p++); |
2530 | if (bmlen > 1) | 2530 | if (bmlen > 1) |
2531 | bitmap[1] = be32_to_cpup(p++); | 2531 | bitmap[1] = be32_to_cpup(p); |
2532 | } | 2532 | } |
2533 | return 0; | 2533 | return 0; |
2534 | out_overflow: | 2534 | out_overflow: |
@@ -2543,7 +2543,7 @@ static inline int decode_attr_length(struct xdr_stream *xdr, uint32_t *attrlen, | |||
2543 | p = xdr_inline_decode(xdr, 4); | 2543 | p = xdr_inline_decode(xdr, 4); |
2544 | if (unlikely(!p)) | 2544 | if (unlikely(!p)) |
2545 | goto out_overflow; | 2545 | goto out_overflow; |
2546 | *attrlen = be32_to_cpup(p++); | 2546 | *attrlen = be32_to_cpup(p); |
2547 | *savep = xdr->p; | 2547 | *savep = xdr->p; |
2548 | return 0; | 2548 | return 0; |
2549 | out_overflow: | 2549 | out_overflow: |
@@ -2574,7 +2574,7 @@ static int decode_attr_type(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t * | |||
2574 | p = xdr_inline_decode(xdr, 4); | 2574 | p = xdr_inline_decode(xdr, 4); |
2575 | if (unlikely(!p)) | 2575 | if (unlikely(!p)) |
2576 | goto out_overflow; | 2576 | goto out_overflow; |
2577 | *type = be32_to_cpup(p++); | 2577 | *type = be32_to_cpup(p); |
2578 | if (*type < NF4REG || *type > NF4NAMEDATTR) { | 2578 | if (*type < NF4REG || *type > NF4NAMEDATTR) { |
2579 | dprintk("%s: bad type %d\n", __func__, *type); | 2579 | dprintk("%s: bad type %d\n", __func__, *type); |
2580 | return -EIO; | 2580 | return -EIO; |
@@ -2601,7 +2601,7 @@ static int decode_attr_change(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t | |||
2601 | p = xdr_inline_decode(xdr, 8); | 2601 | p = xdr_inline_decode(xdr, 8); |
2602 | if (unlikely(!p)) | 2602 | if (unlikely(!p)) |
2603 | goto out_overflow; | 2603 | goto out_overflow; |
2604 | p = xdr_decode_hyper(p, change); | 2604 | xdr_decode_hyper(p, change); |
2605 | bitmap[0] &= ~FATTR4_WORD0_CHANGE; | 2605 | bitmap[0] &= ~FATTR4_WORD0_CHANGE; |
2606 | ret = NFS_ATTR_FATTR_CHANGE; | 2606 | ret = NFS_ATTR_FATTR_CHANGE; |
2607 | } | 2607 | } |
@@ -2625,7 +2625,7 @@ static int decode_attr_size(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t * | |||
2625 | p = xdr_inline_decode(xdr, 8); | 2625 | p = xdr_inline_decode(xdr, 8); |
2626 | if (unlikely(!p)) | 2626 | if (unlikely(!p)) |
2627 | goto out_overflow; | 2627 | goto out_overflow; |
2628 | p = xdr_decode_hyper(p, size); | 2628 | xdr_decode_hyper(p, size); |
2629 | bitmap[0] &= ~FATTR4_WORD0_SIZE; | 2629 | bitmap[0] &= ~FATTR4_WORD0_SIZE; |
2630 | ret = NFS_ATTR_FATTR_SIZE; | 2630 | ret = NFS_ATTR_FATTR_SIZE; |
2631 | } | 2631 | } |
@@ -2647,7 +2647,7 @@ static int decode_attr_link_support(struct xdr_stream *xdr, uint32_t *bitmap, ui | |||
2647 | p = xdr_inline_decode(xdr, 4); | 2647 | p = xdr_inline_decode(xdr, 4); |
2648 | if (unlikely(!p)) | 2648 | if (unlikely(!p)) |
2649 | goto out_overflow; | 2649 | goto out_overflow; |
2650 | *res = be32_to_cpup(p++); | 2650 | *res = be32_to_cpup(p); |
2651 | bitmap[0] &= ~FATTR4_WORD0_LINK_SUPPORT; | 2651 | bitmap[0] &= ~FATTR4_WORD0_LINK_SUPPORT; |
2652 | } | 2652 | } |
2653 | dprintk("%s: link support=%s\n", __func__, *res == 0 ? "false" : "true"); | 2653 | dprintk("%s: link support=%s\n", __func__, *res == 0 ? "false" : "true"); |
@@ -2668,7 +2668,7 @@ static int decode_attr_symlink_support(struct xdr_stream *xdr, uint32_t *bitmap, | |||
2668 | p = xdr_inline_decode(xdr, 4); | 2668 | p = xdr_inline_decode(xdr, 4); |
2669 | if (unlikely(!p)) | 2669 | if (unlikely(!p)) |
2670 | goto out_overflow; | 2670 | goto out_overflow; |
2671 | *res = be32_to_cpup(p++); | 2671 | *res = be32_to_cpup(p); |
2672 | bitmap[0] &= ~FATTR4_WORD0_SYMLINK_SUPPORT; | 2672 | bitmap[0] &= ~FATTR4_WORD0_SYMLINK_SUPPORT; |
2673 | } | 2673 | } |
2674 | dprintk("%s: symlink support=%s\n", __func__, *res == 0 ? "false" : "true"); | 2674 | dprintk("%s: symlink support=%s\n", __func__, *res == 0 ? "false" : "true"); |
@@ -2692,7 +2692,7 @@ static int decode_attr_fsid(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs | |||
2692 | if (unlikely(!p)) | 2692 | if (unlikely(!p)) |
2693 | goto out_overflow; | 2693 | goto out_overflow; |
2694 | p = xdr_decode_hyper(p, &fsid->major); | 2694 | p = xdr_decode_hyper(p, &fsid->major); |
2695 | p = xdr_decode_hyper(p, &fsid->minor); | 2695 | xdr_decode_hyper(p, &fsid->minor); |
2696 | bitmap[0] &= ~FATTR4_WORD0_FSID; | 2696 | bitmap[0] &= ~FATTR4_WORD0_FSID; |
2697 | ret = NFS_ATTR_FATTR_FSID; | 2697 | ret = NFS_ATTR_FATTR_FSID; |
2698 | } | 2698 | } |
@@ -2716,7 +2716,7 @@ static int decode_attr_lease_time(struct xdr_stream *xdr, uint32_t *bitmap, uint | |||
2716 | p = xdr_inline_decode(xdr, 4); | 2716 | p = xdr_inline_decode(xdr, 4); |
2717 | if (unlikely(!p)) | 2717 | if (unlikely(!p)) |
2718 | goto out_overflow; | 2718 | goto out_overflow; |
2719 | *res = be32_to_cpup(p++); | 2719 | *res = be32_to_cpup(p); |
2720 | bitmap[0] &= ~FATTR4_WORD0_LEASE_TIME; | 2720 | bitmap[0] &= ~FATTR4_WORD0_LEASE_TIME; |
2721 | } | 2721 | } |
2722 | dprintk("%s: file size=%u\n", __func__, (unsigned int)*res); | 2722 | dprintk("%s: file size=%u\n", __func__, (unsigned int)*res); |
@@ -2737,7 +2737,7 @@ static int decode_attr_aclsupport(struct xdr_stream *xdr, uint32_t *bitmap, uint | |||
2737 | p = xdr_inline_decode(xdr, 4); | 2737 | p = xdr_inline_decode(xdr, 4); |
2738 | if (unlikely(!p)) | 2738 | if (unlikely(!p)) |
2739 | goto out_overflow; | 2739 | goto out_overflow; |
2740 | *res = be32_to_cpup(p++); | 2740 | *res = be32_to_cpup(p); |
2741 | bitmap[0] &= ~FATTR4_WORD0_ACLSUPPORT; | 2741 | bitmap[0] &= ~FATTR4_WORD0_ACLSUPPORT; |
2742 | } | 2742 | } |
2743 | dprintk("%s: ACLs supported=%u\n", __func__, (unsigned int)*res); | 2743 | dprintk("%s: ACLs supported=%u\n", __func__, (unsigned int)*res); |
@@ -2759,7 +2759,7 @@ static int decode_attr_fileid(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t | |||
2759 | p = xdr_inline_decode(xdr, 8); | 2759 | p = xdr_inline_decode(xdr, 8); |
2760 | if (unlikely(!p)) | 2760 | if (unlikely(!p)) |
2761 | goto out_overflow; | 2761 | goto out_overflow; |
2762 | p = xdr_decode_hyper(p, fileid); | 2762 | xdr_decode_hyper(p, fileid); |
2763 | bitmap[0] &= ~FATTR4_WORD0_FILEID; | 2763 | bitmap[0] &= ~FATTR4_WORD0_FILEID; |
2764 | ret = NFS_ATTR_FATTR_FILEID; | 2764 | ret = NFS_ATTR_FATTR_FILEID; |
2765 | } | 2765 | } |
@@ -2782,7 +2782,7 @@ static int decode_attr_mounted_on_fileid(struct xdr_stream *xdr, uint32_t *bitma | |||
2782 | p = xdr_inline_decode(xdr, 8); | 2782 | p = xdr_inline_decode(xdr, 8); |
2783 | if (unlikely(!p)) | 2783 | if (unlikely(!p)) |
2784 | goto out_overflow; | 2784 | goto out_overflow; |
2785 | p = xdr_decode_hyper(p, fileid); | 2785 | xdr_decode_hyper(p, fileid); |
2786 | bitmap[1] &= ~FATTR4_WORD1_MOUNTED_ON_FILEID; | 2786 | bitmap[1] &= ~FATTR4_WORD1_MOUNTED_ON_FILEID; |
2787 | ret = NFS_ATTR_FATTR_FILEID; | 2787 | ret = NFS_ATTR_FATTR_FILEID; |
2788 | } | 2788 | } |
@@ -2805,7 +2805,7 @@ static int decode_attr_files_avail(struct xdr_stream *xdr, uint32_t *bitmap, uin | |||
2805 | p = xdr_inline_decode(xdr, 8); | 2805 | p = xdr_inline_decode(xdr, 8); |
2806 | if (unlikely(!p)) | 2806 | if (unlikely(!p)) |
2807 | goto out_overflow; | 2807 | goto out_overflow; |
2808 | p = xdr_decode_hyper(p, res); | 2808 | xdr_decode_hyper(p, res); |
2809 | bitmap[0] &= ~FATTR4_WORD0_FILES_AVAIL; | 2809 | bitmap[0] &= ~FATTR4_WORD0_FILES_AVAIL; |
2810 | } | 2810 | } |
2811 | dprintk("%s: files avail=%Lu\n", __func__, (unsigned long long)*res); | 2811 | dprintk("%s: files avail=%Lu\n", __func__, (unsigned long long)*res); |
@@ -2827,7 +2827,7 @@ static int decode_attr_files_free(struct xdr_stream *xdr, uint32_t *bitmap, uint | |||
2827 | p = xdr_inline_decode(xdr, 8); | 2827 | p = xdr_inline_decode(xdr, 8); |
2828 | if (unlikely(!p)) | 2828 | if (unlikely(!p)) |
2829 | goto out_overflow; | 2829 | goto out_overflow; |
2830 | p = xdr_decode_hyper(p, res); | 2830 | xdr_decode_hyper(p, res); |
2831 | bitmap[0] &= ~FATTR4_WORD0_FILES_FREE; | 2831 | bitmap[0] &= ~FATTR4_WORD0_FILES_FREE; |
2832 | } | 2832 | } |
2833 | dprintk("%s: files free=%Lu\n", __func__, (unsigned long long)*res); | 2833 | dprintk("%s: files free=%Lu\n", __func__, (unsigned long long)*res); |
@@ -2849,7 +2849,7 @@ static int decode_attr_files_total(struct xdr_stream *xdr, uint32_t *bitmap, uin | |||
2849 | p = xdr_inline_decode(xdr, 8); | 2849 | p = xdr_inline_decode(xdr, 8); |
2850 | if (unlikely(!p)) | 2850 | if (unlikely(!p)) |
2851 | goto out_overflow; | 2851 | goto out_overflow; |
2852 | p = xdr_decode_hyper(p, res); | 2852 | xdr_decode_hyper(p, res); |
2853 | bitmap[0] &= ~FATTR4_WORD0_FILES_TOTAL; | 2853 | bitmap[0] &= ~FATTR4_WORD0_FILES_TOTAL; |
2854 | } | 2854 | } |
2855 | dprintk("%s: files total=%Lu\n", __func__, (unsigned long long)*res); | 2855 | dprintk("%s: files total=%Lu\n", __func__, (unsigned long long)*res); |
@@ -2868,7 +2868,7 @@ static int decode_pathname(struct xdr_stream *xdr, struct nfs4_pathname *path) | |||
2868 | p = xdr_inline_decode(xdr, 4); | 2868 | p = xdr_inline_decode(xdr, 4); |
2869 | if (unlikely(!p)) | 2869 | if (unlikely(!p)) |
2870 | goto out_overflow; | 2870 | goto out_overflow; |
2871 | n = be32_to_cpup(p++); | 2871 | n = be32_to_cpup(p); |
2872 | if (n == 0) | 2872 | if (n == 0) |
2873 | goto root_path; | 2873 | goto root_path; |
2874 | dprintk("path "); | 2874 | dprintk("path "); |
@@ -2925,7 +2925,7 @@ static int decode_attr_fs_locations(struct xdr_stream *xdr, uint32_t *bitmap, st | |||
2925 | p = xdr_inline_decode(xdr, 4); | 2925 | p = xdr_inline_decode(xdr, 4); |
2926 | if (unlikely(!p)) | 2926 | if (unlikely(!p)) |
2927 | goto out_overflow; | 2927 | goto out_overflow; |
2928 | n = be32_to_cpup(p++); | 2928 | n = be32_to_cpup(p); |
2929 | if (n <= 0) | 2929 | if (n <= 0) |
2930 | goto out_eio; | 2930 | goto out_eio; |
2931 | res->nlocations = 0; | 2931 | res->nlocations = 0; |
@@ -2936,7 +2936,7 @@ static int decode_attr_fs_locations(struct xdr_stream *xdr, uint32_t *bitmap, st | |||
2936 | p = xdr_inline_decode(xdr, 4); | 2936 | p = xdr_inline_decode(xdr, 4); |
2937 | if (unlikely(!p)) | 2937 | if (unlikely(!p)) |
2938 | goto out_overflow; | 2938 | goto out_overflow; |
2939 | m = be32_to_cpup(p++); | 2939 | m = be32_to_cpup(p); |
2940 | 2940 | ||
2941 | loc->nservers = 0; | 2941 | loc->nservers = 0; |
2942 | dprintk("%s: servers ", __func__); | 2942 | dprintk("%s: servers ", __func__); |
@@ -2994,7 +2994,7 @@ static int decode_attr_maxfilesize(struct xdr_stream *xdr, uint32_t *bitmap, uin | |||
2994 | p = xdr_inline_decode(xdr, 8); | 2994 | p = xdr_inline_decode(xdr, 8); |
2995 | if (unlikely(!p)) | 2995 | if (unlikely(!p)) |
2996 | goto out_overflow; | 2996 | goto out_overflow; |
2997 | p = xdr_decode_hyper(p, res); | 2997 | xdr_decode_hyper(p, res); |
2998 | bitmap[0] &= ~FATTR4_WORD0_MAXFILESIZE; | 2998 | bitmap[0] &= ~FATTR4_WORD0_MAXFILESIZE; |
2999 | } | 2999 | } |
3000 | dprintk("%s: maxfilesize=%Lu\n", __func__, (unsigned long long)*res); | 3000 | dprintk("%s: maxfilesize=%Lu\n", __func__, (unsigned long long)*res); |
@@ -3016,7 +3016,7 @@ static int decode_attr_maxlink(struct xdr_stream *xdr, uint32_t *bitmap, uint32_ | |||
3016 | p = xdr_inline_decode(xdr, 4); | 3016 | p = xdr_inline_decode(xdr, 4); |
3017 | if (unlikely(!p)) | 3017 | if (unlikely(!p)) |
3018 | goto out_overflow; | 3018 | goto out_overflow; |
3019 | *maxlink = be32_to_cpup(p++); | 3019 | *maxlink = be32_to_cpup(p); |
3020 | bitmap[0] &= ~FATTR4_WORD0_MAXLINK; | 3020 | bitmap[0] &= ~FATTR4_WORD0_MAXLINK; |
3021 | } | 3021 | } |
3022 | dprintk("%s: maxlink=%u\n", __func__, *maxlink); | 3022 | dprintk("%s: maxlink=%u\n", __func__, *maxlink); |
@@ -3038,7 +3038,7 @@ static int decode_attr_maxname(struct xdr_stream *xdr, uint32_t *bitmap, uint32_ | |||
3038 | p = xdr_inline_decode(xdr, 4); | 3038 | p = xdr_inline_decode(xdr, 4); |
3039 | if (unlikely(!p)) | 3039 | if (unlikely(!p)) |
3040 | goto out_overflow; | 3040 | goto out_overflow; |
3041 | *maxname = be32_to_cpup(p++); | 3041 | *maxname = be32_to_cpup(p); |
3042 | bitmap[0] &= ~FATTR4_WORD0_MAXNAME; | 3042 | bitmap[0] &= ~FATTR4_WORD0_MAXNAME; |
3043 | } | 3043 | } |
3044 | dprintk("%s: maxname=%u\n", __func__, *maxname); | 3044 | dprintk("%s: maxname=%u\n", __func__, *maxname); |
@@ -3061,7 +3061,7 @@ static int decode_attr_maxread(struct xdr_stream *xdr, uint32_t *bitmap, uint32_ | |||
3061 | p = xdr_inline_decode(xdr, 8); | 3061 | p = xdr_inline_decode(xdr, 8); |
3062 | if (unlikely(!p)) | 3062 | if (unlikely(!p)) |
3063 | goto out_overflow; | 3063 | goto out_overflow; |
3064 | p = xdr_decode_hyper(p, &maxread); | 3064 | xdr_decode_hyper(p, &maxread); |
3065 | if (maxread > 0x7FFFFFFF) | 3065 | if (maxread > 0x7FFFFFFF) |
3066 | maxread = 0x7FFFFFFF; | 3066 | maxread = 0x7FFFFFFF; |
3067 | *res = (uint32_t)maxread; | 3067 | *res = (uint32_t)maxread; |
@@ -3087,7 +3087,7 @@ static int decode_attr_maxwrite(struct xdr_stream *xdr, uint32_t *bitmap, uint32 | |||
3087 | p = xdr_inline_decode(xdr, 8); | 3087 | p = xdr_inline_decode(xdr, 8); |
3088 | if (unlikely(!p)) | 3088 | if (unlikely(!p)) |
3089 | goto out_overflow; | 3089 | goto out_overflow; |
3090 | p = xdr_decode_hyper(p, &maxwrite); | 3090 | xdr_decode_hyper(p, &maxwrite); |
3091 | if (maxwrite > 0x7FFFFFFF) | 3091 | if (maxwrite > 0x7FFFFFFF) |
3092 | maxwrite = 0x7FFFFFFF; | 3092 | maxwrite = 0x7FFFFFFF; |
3093 | *res = (uint32_t)maxwrite; | 3093 | *res = (uint32_t)maxwrite; |
@@ -3113,7 +3113,7 @@ static int decode_attr_mode(struct xdr_stream *xdr, uint32_t *bitmap, umode_t *m | |||
3113 | p = xdr_inline_decode(xdr, 4); | 3113 | p = xdr_inline_decode(xdr, 4); |
3114 | if (unlikely(!p)) | 3114 | if (unlikely(!p)) |
3115 | goto out_overflow; | 3115 | goto out_overflow; |
3116 | tmp = be32_to_cpup(p++); | 3116 | tmp = be32_to_cpup(p); |
3117 | *mode = tmp & ~S_IFMT; | 3117 | *mode = tmp & ~S_IFMT; |
3118 | bitmap[1] &= ~FATTR4_WORD1_MODE; | 3118 | bitmap[1] &= ~FATTR4_WORD1_MODE; |
3119 | ret = NFS_ATTR_FATTR_MODE; | 3119 | ret = NFS_ATTR_FATTR_MODE; |
@@ -3137,7 +3137,7 @@ static int decode_attr_nlink(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t | |||
3137 | p = xdr_inline_decode(xdr, 4); | 3137 | p = xdr_inline_decode(xdr, 4); |
3138 | if (unlikely(!p)) | 3138 | if (unlikely(!p)) |
3139 | goto out_overflow; | 3139 | goto out_overflow; |
3140 | *nlink = be32_to_cpup(p++); | 3140 | *nlink = be32_to_cpup(p); |
3141 | bitmap[1] &= ~FATTR4_WORD1_NUMLINKS; | 3141 | bitmap[1] &= ~FATTR4_WORD1_NUMLINKS; |
3142 | ret = NFS_ATTR_FATTR_NLINK; | 3142 | ret = NFS_ATTR_FATTR_NLINK; |
3143 | } | 3143 | } |
@@ -3161,7 +3161,7 @@ static int decode_attr_owner(struct xdr_stream *xdr, uint32_t *bitmap, struct nf | |||
3161 | p = xdr_inline_decode(xdr, 4); | 3161 | p = xdr_inline_decode(xdr, 4); |
3162 | if (unlikely(!p)) | 3162 | if (unlikely(!p)) |
3163 | goto out_overflow; | 3163 | goto out_overflow; |
3164 | len = be32_to_cpup(p++); | 3164 | len = be32_to_cpup(p); |
3165 | p = xdr_inline_decode(xdr, len); | 3165 | p = xdr_inline_decode(xdr, len); |
3166 | if (unlikely(!p)) | 3166 | if (unlikely(!p)) |
3167 | goto out_overflow; | 3167 | goto out_overflow; |
@@ -3196,7 +3196,7 @@ static int decode_attr_group(struct xdr_stream *xdr, uint32_t *bitmap, struct nf | |||
3196 | p = xdr_inline_decode(xdr, 4); | 3196 | p = xdr_inline_decode(xdr, 4); |
3197 | if (unlikely(!p)) | 3197 | if (unlikely(!p)) |
3198 | goto out_overflow; | 3198 | goto out_overflow; |
3199 | len = be32_to_cpup(p++); | 3199 | len = be32_to_cpup(p); |
3200 | p = xdr_inline_decode(xdr, len); | 3200 | p = xdr_inline_decode(xdr, len); |
3201 | if (unlikely(!p)) | 3201 | if (unlikely(!p)) |
3202 | goto out_overflow; | 3202 | goto out_overflow; |
@@ -3234,7 +3234,7 @@ static int decode_attr_rdev(struct xdr_stream *xdr, uint32_t *bitmap, dev_t *rde | |||
3234 | if (unlikely(!p)) | 3234 | if (unlikely(!p)) |
3235 | goto out_overflow; | 3235 | goto out_overflow; |
3236 | major = be32_to_cpup(p++); | 3236 | major = be32_to_cpup(p++); |
3237 | minor = be32_to_cpup(p++); | 3237 | minor = be32_to_cpup(p); |
3238 | tmp = MKDEV(major, minor); | 3238 | tmp = MKDEV(major, minor); |
3239 | if (MAJOR(tmp) == major && MINOR(tmp) == minor) | 3239 | if (MAJOR(tmp) == major && MINOR(tmp) == minor) |
3240 | *rdev = tmp; | 3240 | *rdev = tmp; |
@@ -3260,7 +3260,7 @@ static int decode_attr_space_avail(struct xdr_stream *xdr, uint32_t *bitmap, uin | |||
3260 | p = xdr_inline_decode(xdr, 8); | 3260 | p = xdr_inline_decode(xdr, 8); |
3261 | if (unlikely(!p)) | 3261 | if (unlikely(!p)) |
3262 | goto out_overflow; | 3262 | goto out_overflow; |
3263 | p = xdr_decode_hyper(p, res); | 3263 | xdr_decode_hyper(p, res); |
3264 | bitmap[1] &= ~FATTR4_WORD1_SPACE_AVAIL; | 3264 | bitmap[1] &= ~FATTR4_WORD1_SPACE_AVAIL; |
3265 | } | 3265 | } |
3266 | dprintk("%s: space avail=%Lu\n", __func__, (unsigned long long)*res); | 3266 | dprintk("%s: space avail=%Lu\n", __func__, (unsigned long long)*res); |
@@ -3282,7 +3282,7 @@ static int decode_attr_space_free(struct xdr_stream *xdr, uint32_t *bitmap, uint | |||
3282 | p = xdr_inline_decode(xdr, 8); | 3282 | p = xdr_inline_decode(xdr, 8); |
3283 | if (unlikely(!p)) | 3283 | if (unlikely(!p)) |
3284 | goto out_overflow; | 3284 | goto out_overflow; |
3285 | p = xdr_decode_hyper(p, res); | 3285 | xdr_decode_hyper(p, res); |
3286 | bitmap[1] &= ~FATTR4_WORD1_SPACE_FREE; | 3286 | bitmap[1] &= ~FATTR4_WORD1_SPACE_FREE; |
3287 | } | 3287 | } |
3288 | dprintk("%s: space free=%Lu\n", __func__, (unsigned long long)*res); | 3288 | dprintk("%s: space free=%Lu\n", __func__, (unsigned long long)*res); |
@@ -3304,7 +3304,7 @@ static int decode_attr_space_total(struct xdr_stream *xdr, uint32_t *bitmap, uin | |||
3304 | p = xdr_inline_decode(xdr, 8); | 3304 | p = xdr_inline_decode(xdr, 8); |
3305 | if (unlikely(!p)) | 3305 | if (unlikely(!p)) |
3306 | goto out_overflow; | 3306 | goto out_overflow; |
3307 | p = xdr_decode_hyper(p, res); | 3307 | xdr_decode_hyper(p, res); |
3308 | bitmap[1] &= ~FATTR4_WORD1_SPACE_TOTAL; | 3308 | bitmap[1] &= ~FATTR4_WORD1_SPACE_TOTAL; |
3309 | } | 3309 | } |
3310 | dprintk("%s: space total=%Lu\n", __func__, (unsigned long long)*res); | 3310 | dprintk("%s: space total=%Lu\n", __func__, (unsigned long long)*res); |
@@ -3326,7 +3326,7 @@ static int decode_attr_space_used(struct xdr_stream *xdr, uint32_t *bitmap, uint | |||
3326 | p = xdr_inline_decode(xdr, 8); | 3326 | p = xdr_inline_decode(xdr, 8); |
3327 | if (unlikely(!p)) | 3327 | if (unlikely(!p)) |
3328 | goto out_overflow; | 3328 | goto out_overflow; |
3329 | p = xdr_decode_hyper(p, used); | 3329 | xdr_decode_hyper(p, used); |
3330 | bitmap[1] &= ~FATTR4_WORD1_SPACE_USED; | 3330 | bitmap[1] &= ~FATTR4_WORD1_SPACE_USED; |
3331 | ret = NFS_ATTR_FATTR_SPACE_USED; | 3331 | ret = NFS_ATTR_FATTR_SPACE_USED; |
3332 | } | 3332 | } |
@@ -3348,7 +3348,7 @@ static int decode_attr_time(struct xdr_stream *xdr, struct timespec *time) | |||
3348 | if (unlikely(!p)) | 3348 | if (unlikely(!p)) |
3349 | goto out_overflow; | 3349 | goto out_overflow; |
3350 | p = xdr_decode_hyper(p, &sec); | 3350 | p = xdr_decode_hyper(p, &sec); |
3351 | nsec = be32_to_cpup(p++); | 3351 | nsec = be32_to_cpup(p); |
3352 | time->tv_sec = (time_t)sec; | 3352 | time->tv_sec = (time_t)sec; |
3353 | time->tv_nsec = (long)nsec; | 3353 | time->tv_nsec = (long)nsec; |
3354 | return 0; | 3354 | return 0; |
@@ -3437,7 +3437,7 @@ static int decode_change_info(struct xdr_stream *xdr, struct nfs4_change_info *c | |||
3437 | goto out_overflow; | 3437 | goto out_overflow; |
3438 | cinfo->atomic = be32_to_cpup(p++); | 3438 | cinfo->atomic = be32_to_cpup(p++); |
3439 | p = xdr_decode_hyper(p, &cinfo->before); | 3439 | p = xdr_decode_hyper(p, &cinfo->before); |
3440 | p = xdr_decode_hyper(p, &cinfo->after); | 3440 | xdr_decode_hyper(p, &cinfo->after); |
3441 | return 0; | 3441 | return 0; |
3442 | out_overflow: | 3442 | out_overflow: |
3443 | print_overflow_msg(__func__, xdr); | 3443 | print_overflow_msg(__func__, xdr); |
@@ -3457,7 +3457,7 @@ static int decode_access(struct xdr_stream *xdr, struct nfs4_accessres *access) | |||
3457 | if (unlikely(!p)) | 3457 | if (unlikely(!p)) |
3458 | goto out_overflow; | 3458 | goto out_overflow; |
3459 | supp = be32_to_cpup(p++); | 3459 | supp = be32_to_cpup(p++); |
3460 | acc = be32_to_cpup(p++); | 3460 | acc = be32_to_cpup(p); |
3461 | access->supported = supp; | 3461 | access->supported = supp; |
3462 | access->access = acc; | 3462 | access->access = acc; |
3463 | return 0; | 3463 | return 0; |
@@ -3525,7 +3525,7 @@ static int decode_create(struct xdr_stream *xdr, struct nfs4_change_info *cinfo) | |||
3525 | p = xdr_inline_decode(xdr, 4); | 3525 | p = xdr_inline_decode(xdr, 4); |
3526 | if (unlikely(!p)) | 3526 | if (unlikely(!p)) |
3527 | goto out_overflow; | 3527 | goto out_overflow; |
3528 | bmlen = be32_to_cpup(p++); | 3528 | bmlen = be32_to_cpup(p); |
3529 | p = xdr_inline_decode(xdr, bmlen << 2); | 3529 | p = xdr_inline_decode(xdr, bmlen << 2); |
3530 | if (likely(p)) | 3530 | if (likely(p)) |
3531 | return 0; | 3531 | return 0; |
@@ -3786,7 +3786,7 @@ static int decode_getfh(struct xdr_stream *xdr, struct nfs_fh *fh) | |||
3786 | p = xdr_inline_decode(xdr, 4); | 3786 | p = xdr_inline_decode(xdr, 4); |
3787 | if (unlikely(!p)) | 3787 | if (unlikely(!p)) |
3788 | goto out_overflow; | 3788 | goto out_overflow; |
3789 | len = be32_to_cpup(p++); | 3789 | len = be32_to_cpup(p); |
3790 | if (len > NFS4_FHSIZE) | 3790 | if (len > NFS4_FHSIZE) |
3791 | return -EIO; | 3791 | return -EIO; |
3792 | fh->size = len; | 3792 | fh->size = len; |
@@ -3836,7 +3836,7 @@ static int decode_lock_denied (struct xdr_stream *xdr, struct file_lock *fl) | |||
3836 | fl->fl_pid = 0; | 3836 | fl->fl_pid = 0; |
3837 | } | 3837 | } |
3838 | p = xdr_decode_hyper(p, &clientid); | 3838 | p = xdr_decode_hyper(p, &clientid); |
3839 | namelen = be32_to_cpup(p++); | 3839 | namelen = be32_to_cpup(p); |
3840 | p = xdr_inline_decode(xdr, namelen); | 3840 | p = xdr_inline_decode(xdr, namelen); |
3841 | if (likely(p)) | 3841 | if (likely(p)) |
3842 | return -NFS4ERR_DENIED; | 3842 | return -NFS4ERR_DENIED; |
@@ -3903,11 +3903,11 @@ static int decode_space_limit(struct xdr_stream *xdr, u64 *maxsize) | |||
3903 | limit_type = be32_to_cpup(p++); | 3903 | limit_type = be32_to_cpup(p++); |
3904 | switch (limit_type) { | 3904 | switch (limit_type) { |
3905 | case 1: | 3905 | case 1: |
3906 | p = xdr_decode_hyper(p, maxsize); | 3906 | xdr_decode_hyper(p, maxsize); |
3907 | break; | 3907 | break; |
3908 | case 2: | 3908 | case 2: |
3909 | nblocks = be32_to_cpup(p++); | 3909 | nblocks = be32_to_cpup(p++); |
3910 | blocksize = be32_to_cpup(p++); | 3910 | blocksize = be32_to_cpup(p); |
3911 | *maxsize = (uint64_t)nblocks * (uint64_t)blocksize; | 3911 | *maxsize = (uint64_t)nblocks * (uint64_t)blocksize; |
3912 | } | 3912 | } |
3913 | return 0; | 3913 | return 0; |
@@ -3925,7 +3925,7 @@ static int decode_delegation(struct xdr_stream *xdr, struct nfs_openres *res) | |||
3925 | p = xdr_inline_decode(xdr, 4); | 3925 | p = xdr_inline_decode(xdr, 4); |
3926 | if (unlikely(!p)) | 3926 | if (unlikely(!p)) |
3927 | goto out_overflow; | 3927 | goto out_overflow; |
3928 | delegation_type = be32_to_cpup(p++); | 3928 | delegation_type = be32_to_cpup(p); |
3929 | if (delegation_type == NFS4_OPEN_DELEGATE_NONE) { | 3929 | if (delegation_type == NFS4_OPEN_DELEGATE_NONE) { |
3930 | res->delegation_type = 0; | 3930 | res->delegation_type = 0; |
3931 | return 0; | 3931 | return 0; |
@@ -3936,7 +3936,7 @@ static int decode_delegation(struct xdr_stream *xdr, struct nfs_openres *res) | |||
3936 | p = xdr_inline_decode(xdr, 4); | 3936 | p = xdr_inline_decode(xdr, 4); |
3937 | if (unlikely(!p)) | 3937 | if (unlikely(!p)) |
3938 | goto out_overflow; | 3938 | goto out_overflow; |
3939 | res->do_recall = be32_to_cpup(p++); | 3939 | res->do_recall = be32_to_cpup(p); |
3940 | 3940 | ||
3941 | switch (delegation_type) { | 3941 | switch (delegation_type) { |
3942 | case NFS4_OPEN_DELEGATE_READ: | 3942 | case NFS4_OPEN_DELEGATE_READ: |
@@ -3973,7 +3973,7 @@ static int decode_open(struct xdr_stream *xdr, struct nfs_openres *res) | |||
3973 | if (unlikely(!p)) | 3973 | if (unlikely(!p)) |
3974 | goto out_overflow; | 3974 | goto out_overflow; |
3975 | res->rflags = be32_to_cpup(p++); | 3975 | res->rflags = be32_to_cpup(p++); |
3976 | bmlen = be32_to_cpup(p++); | 3976 | bmlen = be32_to_cpup(p); |
3977 | if (bmlen > 10) | 3977 | if (bmlen > 10) |
3978 | goto xdr_error; | 3978 | goto xdr_error; |
3979 | 3979 | ||
@@ -4043,7 +4043,7 @@ static int decode_read(struct xdr_stream *xdr, struct rpc_rqst *req, struct nfs_ | |||
4043 | if (unlikely(!p)) | 4043 | if (unlikely(!p)) |
4044 | goto out_overflow; | 4044 | goto out_overflow; |
4045 | eof = be32_to_cpup(p++); | 4045 | eof = be32_to_cpup(p++); |
4046 | count = be32_to_cpup(p++); | 4046 | count = be32_to_cpup(p); |
4047 | hdrlen = (u8 *) p - (u8 *) iov->iov_base; | 4047 | hdrlen = (u8 *) p - (u8 *) iov->iov_base; |
4048 | recvd = req->rq_rcv_buf.len - hdrlen; | 4048 | recvd = req->rq_rcv_buf.len - hdrlen; |
4049 | if (count > recvd) { | 4049 | if (count > recvd) { |
@@ -4174,7 +4174,7 @@ static int decode_readlink(struct xdr_stream *xdr, struct rpc_rqst *req) | |||
4174 | p = xdr_inline_decode(xdr, 4); | 4174 | p = xdr_inline_decode(xdr, 4); |
4175 | if (unlikely(!p)) | 4175 | if (unlikely(!p)) |
4176 | goto out_overflow; | 4176 | goto out_overflow; |
4177 | len = be32_to_cpup(p++); | 4177 | len = be32_to_cpup(p); |
4178 | if (len >= rcvbuf->page_len || len <= 0) { | 4178 | if (len >= rcvbuf->page_len || len <= 0) { |
4179 | dprintk("nfs: server returned giant symlink!\n"); | 4179 | dprintk("nfs: server returned giant symlink!\n"); |
4180 | return -ENAMETOOLONG; | 4180 | return -ENAMETOOLONG; |
@@ -4301,7 +4301,7 @@ static int decode_setattr(struct xdr_stream *xdr) | |||
4301 | p = xdr_inline_decode(xdr, 4); | 4301 | p = xdr_inline_decode(xdr, 4); |
4302 | if (unlikely(!p)) | 4302 | if (unlikely(!p)) |
4303 | goto out_overflow; | 4303 | goto out_overflow; |
4304 | bmlen = be32_to_cpup(p++); | 4304 | bmlen = be32_to_cpup(p); |
4305 | p = xdr_inline_decode(xdr, bmlen << 2); | 4305 | p = xdr_inline_decode(xdr, bmlen << 2); |
4306 | if (likely(p)) | 4306 | if (likely(p)) |
4307 | return 0; | 4307 | return 0; |
@@ -4325,7 +4325,7 @@ static int decode_setclientid(struct xdr_stream *xdr, struct nfs_client *clp) | |||
4325 | " %d\n", opnum); | 4325 | " %d\n", opnum); |
4326 | return -EIO; | 4326 | return -EIO; |
4327 | } | 4327 | } |
4328 | nfserr = be32_to_cpup(p++); | 4328 | nfserr = be32_to_cpup(p); |
4329 | if (nfserr == NFS_OK) { | 4329 | if (nfserr == NFS_OK) { |
4330 | p = xdr_inline_decode(xdr, 8 + NFS4_VERIFIER_SIZE); | 4330 | p = xdr_inline_decode(xdr, 8 + NFS4_VERIFIER_SIZE); |
4331 | if (unlikely(!p)) | 4331 | if (unlikely(!p)) |
@@ -4339,7 +4339,7 @@ static int decode_setclientid(struct xdr_stream *xdr, struct nfs_client *clp) | |||
4339 | p = xdr_inline_decode(xdr, 4); | 4339 | p = xdr_inline_decode(xdr, 4); |
4340 | if (unlikely(!p)) | 4340 | if (unlikely(!p)) |
4341 | goto out_overflow; | 4341 | goto out_overflow; |
4342 | len = be32_to_cpup(p++); | 4342 | len = be32_to_cpup(p); |
4343 | p = xdr_inline_decode(xdr, len); | 4343 | p = xdr_inline_decode(xdr, len); |
4344 | if (unlikely(!p)) | 4344 | if (unlikely(!p)) |
4345 | goto out_overflow; | 4345 | goto out_overflow; |
@@ -4348,7 +4348,7 @@ static int decode_setclientid(struct xdr_stream *xdr, struct nfs_client *clp) | |||
4348 | p = xdr_inline_decode(xdr, 4); | 4348 | p = xdr_inline_decode(xdr, 4); |
4349 | if (unlikely(!p)) | 4349 | if (unlikely(!p)) |
4350 | goto out_overflow; | 4350 | goto out_overflow; |
4351 | len = be32_to_cpup(p++); | 4351 | len = be32_to_cpup(p); |
4352 | p = xdr_inline_decode(xdr, len); | 4352 | p = xdr_inline_decode(xdr, len); |
4353 | if (unlikely(!p)) | 4353 | if (unlikely(!p)) |
4354 | goto out_overflow; | 4354 | goto out_overflow; |
@@ -4410,7 +4410,7 @@ static int decode_exchange_id(struct xdr_stream *xdr, | |||
4410 | p = xdr_inline_decode(xdr, 8); | 4410 | p = xdr_inline_decode(xdr, 8); |
4411 | if (unlikely(!p)) | 4411 | if (unlikely(!p)) |
4412 | goto out_overflow; | 4412 | goto out_overflow; |
4413 | p = xdr_decode_hyper(p, &clp->cl_ex_clid); | 4413 | xdr_decode_hyper(p, &clp->cl_ex_clid); |
4414 | p = xdr_inline_decode(xdr, 12); | 4414 | p = xdr_inline_decode(xdr, 12); |
4415 | if (unlikely(!p)) | 4415 | if (unlikely(!p)) |
4416 | goto out_overflow; | 4416 | goto out_overflow; |
@@ -4418,7 +4418,7 @@ static int decode_exchange_id(struct xdr_stream *xdr, | |||
4418 | clp->cl_exchange_flags = be32_to_cpup(p++); | 4418 | clp->cl_exchange_flags = be32_to_cpup(p++); |
4419 | 4419 | ||
4420 | /* We ask for SP4_NONE */ | 4420 | /* We ask for SP4_NONE */ |
4421 | dummy = be32_to_cpup(p++); | 4421 | dummy = be32_to_cpup(p); |
4422 | if (dummy != SP4_NONE) | 4422 | if (dummy != SP4_NONE) |
4423 | return -EIO; | 4423 | return -EIO; |
4424 | 4424 | ||
@@ -4463,7 +4463,7 @@ static int decode_chan_attrs(struct xdr_stream *xdr, | |||
4463 | attrs->max_resp_sz_cached = be32_to_cpup(p++); | 4463 | attrs->max_resp_sz_cached = be32_to_cpup(p++); |
4464 | attrs->max_ops = be32_to_cpup(p++); | 4464 | attrs->max_ops = be32_to_cpup(p++); |
4465 | attrs->max_reqs = be32_to_cpup(p++); | 4465 | attrs->max_reqs = be32_to_cpup(p++); |
4466 | nr_attrs = be32_to_cpup(p++); | 4466 | nr_attrs = be32_to_cpup(p); |
4467 | if (unlikely(nr_attrs > 1)) { | 4467 | if (unlikely(nr_attrs > 1)) { |
4468 | printk(KERN_WARNING "%s: Invalid rdma channel attrs count %u\n", | 4468 | printk(KERN_WARNING "%s: Invalid rdma channel attrs count %u\n", |
4469 | __func__, nr_attrs); | 4469 | __func__, nr_attrs); |
@@ -4504,7 +4504,7 @@ static int decode_create_session(struct xdr_stream *xdr, | |||
4504 | if (unlikely(!p)) | 4504 | if (unlikely(!p)) |
4505 | goto out_overflow; | 4505 | goto out_overflow; |
4506 | clp->cl_seqid = be32_to_cpup(p++); | 4506 | clp->cl_seqid = be32_to_cpup(p++); |
4507 | session->flags = be32_to_cpup(p++); | 4507 | session->flags = be32_to_cpup(p); |
4508 | 4508 | ||
4509 | /* Channel attributes */ | 4509 | /* Channel attributes */ |
4510 | status = decode_chan_attrs(xdr, &session->fc_attrs); | 4510 | status = decode_chan_attrs(xdr, &session->fc_attrs); |
@@ -4576,7 +4576,7 @@ static int decode_sequence(struct xdr_stream *xdr, | |||
4576 | /* target highest slot id - currently not processed */ | 4576 | /* target highest slot id - currently not processed */ |
4577 | dummy = be32_to_cpup(p++); | 4577 | dummy = be32_to_cpup(p++); |
4578 | /* result flags - currently not processed */ | 4578 | /* result flags - currently not processed */ |
4579 | dummy = be32_to_cpup(p++); | 4579 | dummy = be32_to_cpup(p); |
4580 | status = 0; | 4580 | status = 0; |
4581 | out_err: | 4581 | out_err: |
4582 | res->sr_status = status; | 4582 | res->sr_status = status; |