aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfsd/nfs4xdr.c40
1 files changed, 0 insertions, 40 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 5064cb5a0b8e..e9abf5f66e8b 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -1750,7 +1750,6 @@ static void write_cinfo(__be32 **p, struct nfsd4_change_info *c)
1750 p = xdr_reserve_space(&resp->xdr, nbytes); \ 1750 p = xdr_reserve_space(&resp->xdr, nbytes); \
1751 BUG_ON(!p); \ 1751 BUG_ON(!p); \
1752} while (0) 1752} while (0)
1753#define ADJUST_ARGS() WARN_ON_ONCE(p != resp->xdr.p) \
1754 1753
1755/* Encode as an array of strings the string given with components 1754/* Encode as an array of strings the string given with components
1756 * separated @sep, escaped with esc_enter and esc_exit. 1755 * separated @sep, escaped with esc_enter and esc_exit.
@@ -2744,7 +2743,6 @@ nfsd4_encode_stateid(struct nfsd4_compoundres *resp, stateid_t *sid)
2744 RESERVE_SPACE(sizeof(stateid_t)); 2743 RESERVE_SPACE(sizeof(stateid_t));
2745 WRITE32(sid->si_generation); 2744 WRITE32(sid->si_generation);
2746 WRITEMEM(&sid->si_opaque, sizeof(stateid_opaque_t)); 2745 WRITEMEM(&sid->si_opaque, sizeof(stateid_opaque_t));
2747 ADJUST_ARGS();
2748} 2746}
2749 2747
2750static __be32 2748static __be32
@@ -2756,7 +2754,6 @@ nfsd4_encode_access(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_
2756 RESERVE_SPACE(8); 2754 RESERVE_SPACE(8);
2757 WRITE32(access->ac_supported); 2755 WRITE32(access->ac_supported);
2758 WRITE32(access->ac_resp_access); 2756 WRITE32(access->ac_resp_access);
2759 ADJUST_ARGS();
2760 } 2757 }
2761 return nfserr; 2758 return nfserr;
2762} 2759}
@@ -2771,7 +2768,6 @@ static __be32 nfsd4_encode_bind_conn_to_session(struct nfsd4_compoundres *resp,
2771 WRITE32(bcts->dir); 2768 WRITE32(bcts->dir);
2772 /* Sorry, we do not yet support RDMA over 4.1: */ 2769 /* Sorry, we do not yet support RDMA over 4.1: */
2773 WRITE32(0); 2770 WRITE32(0);
2774 ADJUST_ARGS();
2775 } 2771 }
2776 return nfserr; 2772 return nfserr;
2777} 2773}
@@ -2794,7 +2790,6 @@ nfsd4_encode_commit(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_
2794 if (!nfserr) { 2790 if (!nfserr) {
2795 RESERVE_SPACE(NFS4_VERIFIER_SIZE); 2791 RESERVE_SPACE(NFS4_VERIFIER_SIZE);
2796 WRITEMEM(commit->co_verf.data, NFS4_VERIFIER_SIZE); 2792 WRITEMEM(commit->co_verf.data, NFS4_VERIFIER_SIZE);
2797 ADJUST_ARGS();
2798 } 2793 }
2799 return nfserr; 2794 return nfserr;
2800} 2795}
@@ -2810,7 +2805,6 @@ nfsd4_encode_create(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_
2810 WRITE32(2); 2805 WRITE32(2);
2811 WRITE32(create->cr_bmval[0]); 2806 WRITE32(create->cr_bmval[0]);
2812 WRITE32(create->cr_bmval[1]); 2807 WRITE32(create->cr_bmval[1]);
2813 ADJUST_ARGS();
2814 } 2808 }
2815 return nfserr; 2809 return nfserr;
2816} 2810}
@@ -2842,7 +2836,6 @@ nfsd4_encode_getfh(struct nfsd4_compoundres *resp, __be32 nfserr, struct svc_fh
2842 RESERVE_SPACE(len + 4); 2836 RESERVE_SPACE(len + 4);
2843 WRITE32(len); 2837 WRITE32(len);
2844 WRITEMEM(&fhp->fh_handle.fh_base, len); 2838 WRITEMEM(&fhp->fh_handle.fh_base, len);
2845 ADJUST_ARGS();
2846 } 2839 }
2847 return nfserr; 2840 return nfserr;
2848} 2841}
@@ -2870,7 +2863,6 @@ nfsd4_encode_lock_denied(struct nfsd4_compoundres *resp, struct nfsd4_lock_denie
2870 WRITE64((u64)0); /* clientid */ 2863 WRITE64((u64)0); /* clientid */
2871 WRITE32(0); /* length of owner name */ 2864 WRITE32(0); /* length of owner name */
2872 } 2865 }
2873 ADJUST_ARGS();
2874} 2866}
2875 2867
2876static __be32 2868static __be32
@@ -2910,7 +2902,6 @@ nfsd4_encode_link(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_li
2910 if (!nfserr) { 2902 if (!nfserr) {
2911 RESERVE_SPACE(20); 2903 RESERVE_SPACE(20);
2912 write_cinfo(&p, &link->li_cinfo); 2904 write_cinfo(&p, &link->li_cinfo);
2913 ADJUST_ARGS();
2914 } 2905 }
2915 return nfserr; 2906 return nfserr;
2916} 2907}
@@ -2932,7 +2923,6 @@ nfsd4_encode_open(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_op
2932 WRITE32(open->op_bmval[0]); 2923 WRITE32(open->op_bmval[0]);
2933 WRITE32(open->op_bmval[1]); 2924 WRITE32(open->op_bmval[1]);
2934 WRITE32(open->op_delegate_type); 2925 WRITE32(open->op_delegate_type);
2935 ADJUST_ARGS();
2936 2926
2937 switch (open->op_delegate_type) { 2927 switch (open->op_delegate_type) {
2938 case NFS4_OPEN_DELEGATE_NONE: 2928 case NFS4_OPEN_DELEGATE_NONE:
@@ -2949,7 +2939,6 @@ nfsd4_encode_open(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_op
2949 WRITE32(0); 2939 WRITE32(0);
2950 WRITE32(0); 2940 WRITE32(0);
2951 WRITE32(0); /* XXX: is NULL principal ok? */ 2941 WRITE32(0); /* XXX: is NULL principal ok? */
2952 ADJUST_ARGS();
2953 break; 2942 break;
2954 case NFS4_OPEN_DELEGATE_WRITE: 2943 case NFS4_OPEN_DELEGATE_WRITE:
2955 nfsd4_encode_stateid(resp, &open->op_delegate_stateid); 2944 nfsd4_encode_stateid(resp, &open->op_delegate_stateid);
@@ -2970,7 +2959,6 @@ nfsd4_encode_open(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_op
2970 WRITE32(0); 2959 WRITE32(0);
2971 WRITE32(0); 2960 WRITE32(0);
2972 WRITE32(0); /* XXX: is NULL principal ok? */ 2961 WRITE32(0); /* XXX: is NULL principal ok? */
2973 ADJUST_ARGS();
2974 break; 2962 break;
2975 case NFS4_OPEN_DELEGATE_NONE_EXT: /* 4.1 */ 2963 case NFS4_OPEN_DELEGATE_NONE_EXT: /* 4.1 */
2976 switch (open->op_why_no_deleg) { 2964 switch (open->op_why_no_deleg) {
@@ -2984,7 +2972,6 @@ nfsd4_encode_open(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_op
2984 RESERVE_SPACE(4); 2972 RESERVE_SPACE(4);
2985 WRITE32(open->op_why_no_deleg); 2973 WRITE32(open->op_why_no_deleg);
2986 } 2974 }
2987 ADJUST_ARGS();
2988 break; 2975 break;
2989 default: 2976 default:
2990 BUG(); 2977 BUG();
@@ -3066,7 +3053,6 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr,
3066 3053
3067 WRITE32(eof); 3054 WRITE32(eof);
3068 WRITE32(maxcount); 3055 WRITE32(maxcount);
3069 ADJUST_ARGS();
3070 resp->xdr.buf->head[0].iov_len = (char *)p 3056 resp->xdr.buf->head[0].iov_len = (char *)p
3071 - (char *)resp->xdr.buf->head[0].iov_base; 3057 - (char *)resp->xdr.buf->head[0].iov_base;
3072 resp->xdr.buf->page_len = maxcount; 3058 resp->xdr.buf->page_len = maxcount;
@@ -3080,7 +3066,6 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr,
3080 WRITE32(0); 3066 WRITE32(0);
3081 resp->xdr.buf->tail[0].iov_base += maxcount&3; 3067 resp->xdr.buf->tail[0].iov_base += maxcount&3;
3082 resp->xdr.buf->tail[0].iov_len = 4 - (maxcount&3); 3068 resp->xdr.buf->tail[0].iov_len = 4 - (maxcount&3);
3083 ADJUST_ARGS();
3084 } 3069 }
3085 return 0; 3070 return 0;
3086} 3071}
@@ -3121,7 +3106,6 @@ nfsd4_encode_readlink(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd
3121 } 3106 }
3122 3107
3123 WRITE32(maxcount); 3108 WRITE32(maxcount);
3124 ADJUST_ARGS();
3125 resp->xdr.buf->head[0].iov_len = (char *)p 3109 resp->xdr.buf->head[0].iov_len = (char *)p
3126 - (char *)resp->xdr.buf->head[0].iov_base; 3110 - (char *)resp->xdr.buf->head[0].iov_base;
3127 resp->xdr.buf->page_len = maxcount; 3111 resp->xdr.buf->page_len = maxcount;
@@ -3135,7 +3119,6 @@ nfsd4_encode_readlink(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd
3135 WRITE32(0); 3119 WRITE32(0);
3136 resp->xdr.buf->tail[0].iov_base += maxcount&3; 3120 resp->xdr.buf->tail[0].iov_base += maxcount&3;
3137 resp->xdr.buf->tail[0].iov_len = 4 - (maxcount&3); 3121 resp->xdr.buf->tail[0].iov_len = 4 - (maxcount&3);
3138 ADJUST_ARGS();
3139 } 3122 }
3140 return 0; 3123 return 0;
3141} 3124}
@@ -3162,7 +3145,6 @@ nfsd4_encode_readdir(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4
3162 /* XXX: Following NFSv3, we ignore the READDIR verifier for now. */ 3145 /* XXX: Following NFSv3, we ignore the READDIR verifier for now. */
3163 WRITE32(0); 3146 WRITE32(0);
3164 WRITE32(0); 3147 WRITE32(0);
3165 ADJUST_ARGS();
3166 resp->xdr.buf->head[0].iov_len = ((char *)resp->xdr.p) 3148 resp->xdr.buf->head[0].iov_len = ((char *)resp->xdr.p)
3167 - (char *)resp->xdr.buf->head[0].iov_base; 3149 - (char *)resp->xdr.buf->head[0].iov_base;
3168 tailbase = p; 3150 tailbase = p;
@@ -3233,7 +3215,6 @@ nfsd4_encode_remove(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_
3233 if (!nfserr) { 3215 if (!nfserr) {
3234 RESERVE_SPACE(20); 3216 RESERVE_SPACE(20);
3235 write_cinfo(&p, &remove->rm_cinfo); 3217 write_cinfo(&p, &remove->rm_cinfo);
3236 ADJUST_ARGS();
3237 } 3218 }
3238 return nfserr; 3219 return nfserr;
3239} 3220}
@@ -3247,7 +3228,6 @@ nfsd4_encode_rename(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_
3247 RESERVE_SPACE(40); 3228 RESERVE_SPACE(40);
3248 write_cinfo(&p, &rename->rn_sinfo); 3229 write_cinfo(&p, &rename->rn_sinfo);
3249 write_cinfo(&p, &rename->rn_tinfo); 3230 write_cinfo(&p, &rename->rn_tinfo);
3250 ADJUST_ARGS();
3251 } 3231 }
3252 return nfserr; 3232 return nfserr;
3253} 3233}
@@ -3287,7 +3267,6 @@ nfsd4_do_encode_secinfo(struct nfsd4_compoundres *resp,
3287 supported = 0; 3267 supported = 0;
3288 RESERVE_SPACE(4); 3268 RESERVE_SPACE(4);
3289 flavorsp = p++; /* to be backfilled later */ 3269 flavorsp = p++; /* to be backfilled later */
3290 ADJUST_ARGS();
3291 3270
3292 for (i = 0; i < nflavs; i++) { 3271 for (i = 0; i < nflavs; i++) {
3293 rpc_authflavor_t pf = flavs[i].pseudoflavor; 3272 rpc_authflavor_t pf = flavs[i].pseudoflavor;
@@ -3301,12 +3280,10 @@ nfsd4_do_encode_secinfo(struct nfsd4_compoundres *resp,
3301 WRITEMEM(info.oid.data, info.oid.len); 3280 WRITEMEM(info.oid.data, info.oid.len);
3302 WRITE32(info.qop); 3281 WRITE32(info.qop);
3303 WRITE32(info.service); 3282 WRITE32(info.service);
3304 ADJUST_ARGS();
3305 } else if (pf < RPC_AUTH_MAXFLAVOR) { 3283 } else if (pf < RPC_AUTH_MAXFLAVOR) {
3306 supported++; 3284 supported++;
3307 RESERVE_SPACE(4); 3285 RESERVE_SPACE(4);
3308 WRITE32(pf); 3286 WRITE32(pf);
3309 ADJUST_ARGS();
3310 } else { 3287 } else {
3311 if (report) 3288 if (report)
3312 pr_warn("NFS: SECINFO: security flavor %u " 3289 pr_warn("NFS: SECINFO: security flavor %u "
@@ -3360,7 +3337,6 @@ nfsd4_encode_setattr(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4
3360 WRITE32(setattr->sa_bmval[1]); 3337 WRITE32(setattr->sa_bmval[1]);
3361 WRITE32(setattr->sa_bmval[2]); 3338 WRITE32(setattr->sa_bmval[2]);
3362 } 3339 }
3363 ADJUST_ARGS();
3364 return nfserr; 3340 return nfserr;
3365} 3341}
3366 3342
@@ -3373,13 +3349,11 @@ nfsd4_encode_setclientid(struct nfsd4_compoundres *resp, __be32 nfserr, struct n
3373 RESERVE_SPACE(8 + NFS4_VERIFIER_SIZE); 3349 RESERVE_SPACE(8 + NFS4_VERIFIER_SIZE);
3374 WRITEMEM(&scd->se_clientid, 8); 3350 WRITEMEM(&scd->se_clientid, 8);
3375 WRITEMEM(&scd->se_confirm, NFS4_VERIFIER_SIZE); 3351 WRITEMEM(&scd->se_confirm, NFS4_VERIFIER_SIZE);
3376 ADJUST_ARGS();
3377 } 3352 }
3378 else if (nfserr == nfserr_clid_inuse) { 3353 else if (nfserr == nfserr_clid_inuse) {
3379 RESERVE_SPACE(8); 3354 RESERVE_SPACE(8);
3380 WRITE32(0); 3355 WRITE32(0);
3381 WRITE32(0); 3356 WRITE32(0);
3382 ADJUST_ARGS();
3383 } 3357 }
3384 return nfserr; 3358 return nfserr;
3385} 3359}
@@ -3394,7 +3368,6 @@ nfsd4_encode_write(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_w
3394 WRITE32(write->wr_bytes_written); 3368 WRITE32(write->wr_bytes_written);
3395 WRITE32(write->wr_how_written); 3369 WRITE32(write->wr_how_written);
3396 WRITEMEM(write->wr_verifier.data, NFS4_VERIFIER_SIZE); 3370 WRITEMEM(write->wr_verifier.data, NFS4_VERIFIER_SIZE);
3397 ADJUST_ARGS();
3398 } 3371 }
3399 return nfserr; 3372 return nfserr;
3400} 3373}
@@ -3437,7 +3410,6 @@ nfsd4_encode_exchange_id(struct nfsd4_compoundres *resp, __be32 nfserr,
3437 WRITE32(exid->flags); 3410 WRITE32(exid->flags);
3438 3411
3439 WRITE32(exid->spa_how); 3412 WRITE32(exid->spa_how);
3440 ADJUST_ARGS();
3441 3413
3442 switch (exid->spa_how) { 3414 switch (exid->spa_how) {
3443 case SP4_NONE: 3415 case SP4_NONE:
@@ -3453,7 +3425,6 @@ nfsd4_encode_exchange_id(struct nfsd4_compoundres *resp, __be32 nfserr,
3453 /* empty spo_must_allow bitmap: */ 3425 /* empty spo_must_allow bitmap: */
3454 WRITE32(0); 3426 WRITE32(0);
3455 3427
3456 ADJUST_ARGS();
3457 break; 3428 break;
3458 default: 3429 default:
3459 WARN_ON_ONCE(1); 3430 WARN_ON_ONCE(1);
@@ -3479,7 +3450,6 @@ nfsd4_encode_exchange_id(struct nfsd4_compoundres *resp, __be32 nfserr,
3479 3450
3480 /* Implementation id */ 3451 /* Implementation id */
3481 WRITE32(0); /* zero length nfs_impl_id4 array */ 3452 WRITE32(0); /* zero length nfs_impl_id4 array */
3482 ADJUST_ARGS();
3483 return 0; 3453 return 0;
3484} 3454}
3485 3455
@@ -3496,7 +3466,6 @@ nfsd4_encode_create_session(struct nfsd4_compoundres *resp, __be32 nfserr,
3496 WRITEMEM(sess->sessionid.data, NFS4_MAX_SESSIONID_LEN); 3466 WRITEMEM(sess->sessionid.data, NFS4_MAX_SESSIONID_LEN);
3497 WRITE32(sess->seqid); 3467 WRITE32(sess->seqid);
3498 WRITE32(sess->flags); 3468 WRITE32(sess->flags);
3499 ADJUST_ARGS();
3500 3469
3501 RESERVE_SPACE(28); 3470 RESERVE_SPACE(28);
3502 WRITE32(0); /* headerpadsz */ 3471 WRITE32(0); /* headerpadsz */
@@ -3506,12 +3475,10 @@ nfsd4_encode_create_session(struct nfsd4_compoundres *resp, __be32 nfserr,
3506 WRITE32(sess->fore_channel.maxops); 3475 WRITE32(sess->fore_channel.maxops);
3507 WRITE32(sess->fore_channel.maxreqs); 3476 WRITE32(sess->fore_channel.maxreqs);
3508 WRITE32(sess->fore_channel.nr_rdma_attrs); 3477 WRITE32(sess->fore_channel.nr_rdma_attrs);
3509 ADJUST_ARGS();
3510 3478
3511 if (sess->fore_channel.nr_rdma_attrs) { 3479 if (sess->fore_channel.nr_rdma_attrs) {
3512 RESERVE_SPACE(4); 3480 RESERVE_SPACE(4);
3513 WRITE32(sess->fore_channel.rdma_attrs); 3481 WRITE32(sess->fore_channel.rdma_attrs);
3514 ADJUST_ARGS();
3515 } 3482 }
3516 3483
3517 RESERVE_SPACE(28); 3484 RESERVE_SPACE(28);
@@ -3522,12 +3489,10 @@ nfsd4_encode_create_session(struct nfsd4_compoundres *resp, __be32 nfserr,
3522 WRITE32(sess->back_channel.maxops); 3489 WRITE32(sess->back_channel.maxops);
3523 WRITE32(sess->back_channel.maxreqs); 3490 WRITE32(sess->back_channel.maxreqs);
3524 WRITE32(sess->back_channel.nr_rdma_attrs); 3491 WRITE32(sess->back_channel.nr_rdma_attrs);
3525 ADJUST_ARGS();
3526 3492
3527 if (sess->back_channel.nr_rdma_attrs) { 3493 if (sess->back_channel.nr_rdma_attrs) {
3528 RESERVE_SPACE(4); 3494 RESERVE_SPACE(4);
3529 WRITE32(sess->back_channel.rdma_attrs); 3495 WRITE32(sess->back_channel.rdma_attrs);
3530 ADJUST_ARGS();
3531 } 3496 }
3532 return 0; 3497 return 0;
3533} 3498}
@@ -3550,7 +3515,6 @@ nfsd4_encode_sequence(struct nfsd4_compoundres *resp, __be32 nfserr,
3550 WRITE32(seq->maxslots - 1); /* sr_target_highest_slotid */ 3515 WRITE32(seq->maxslots - 1); /* sr_target_highest_slotid */
3551 WRITE32(seq->status_flags); 3516 WRITE32(seq->status_flags);
3552 3517
3553 ADJUST_ARGS();
3554 resp->cstate.datap = p; /* DRC cache data pointer */ 3518 resp->cstate.datap = p; /* DRC cache data pointer */
3555 return 0; 3519 return 0;
3556} 3520}
@@ -3572,7 +3536,6 @@ nfsd4_encode_test_stateid(struct nfsd4_compoundres *resp, __be32 nfserr,
3572 *p++ = stateid->ts_id_status; 3536 *p++ = stateid->ts_id_status;
3573 } 3537 }
3574 3538
3575 ADJUST_ARGS();
3576 return nfserr; 3539 return nfserr;
3577} 3540}
3578 3541
@@ -3707,7 +3670,6 @@ nfsd4_encode_operation(struct nfsd4_compoundres *resp, struct nfsd4_op *op)
3707 RESERVE_SPACE(8); 3670 RESERVE_SPACE(8);
3708 WRITE32(op->opnum); 3671 WRITE32(op->opnum);
3709 statp = p++; /* to be backfilled at the end */ 3672 statp = p++; /* to be backfilled at the end */
3710 ADJUST_ARGS();
3711 3673
3712 if (op->opnum == OP_ILLEGAL) 3674 if (op->opnum == OP_ILLEGAL)
3713 goto status; 3675 goto status;
@@ -3768,11 +3730,9 @@ nfsd4_encode_replay(struct nfsd4_compoundres *resp, struct nfsd4_op *op)
3768 RESERVE_SPACE(8); 3730 RESERVE_SPACE(8);
3769 WRITE32(op->opnum); 3731 WRITE32(op->opnum);
3770 *p++ = rp->rp_status; /* already xdr'ed */ 3732 *p++ = rp->rp_status; /* already xdr'ed */
3771 ADJUST_ARGS();
3772 3733
3773 RESERVE_SPACE(rp->rp_buflen); 3734 RESERVE_SPACE(rp->rp_buflen);
3774 WRITEMEM(rp->rp_buf, rp->rp_buflen); 3735 WRITEMEM(rp->rp_buf, rp->rp_buflen);
3775 ADJUST_ARGS();
3776} 3736}
3777 3737
3778int 3738int