diff options
author | Bryan Schumaker <bjschuma@netapp.com> | 2013-06-05 11:15:01 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2013-06-08 16:20:18 -0400 |
commit | 459de2edb9105a5d091f8215650e12c0812d59f3 (patch) | |
tree | e6a67386ede1617344d1e887b42a8967444995b4 /fs/nfs/callback_xdr.c | |
parent | f58eda9bc2f0793da4c5c1098d55df2b31e0d682 (diff) |
NFS: Make callbacks minor version generic
I found a few places that hardcode the minor version number rather than
making it dependent on the protocol the callback came in over. This
patch makes it easier to add new minor versions in the future.
Signed-off-by: Bryan Schumaker <bjschuma@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/callback_xdr.c')
-rw-r--r-- | fs/nfs/callback_xdr.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c index e7ee62929811..77c0b881520f 100644 --- a/fs/nfs/callback_xdr.c +++ b/fs/nfs/callback_xdr.c | |||
@@ -166,8 +166,8 @@ static __be32 decode_compound_hdr_arg(struct xdr_stream *xdr, struct cb_compound | |||
166 | if (unlikely(p == NULL)) | 166 | if (unlikely(p == NULL)) |
167 | return htonl(NFS4ERR_RESOURCE); | 167 | return htonl(NFS4ERR_RESOURCE); |
168 | hdr->minorversion = ntohl(*p++); | 168 | hdr->minorversion = ntohl(*p++); |
169 | /* Check minor version is zero or one or two. */ | 169 | /* Check for minor version support */ |
170 | if (hdr->minorversion <= 2) { | 170 | if (hdr->minorversion <= NFS4_MAX_MINOR_VERSION) { |
171 | hdr->cb_ident = ntohl(*p++); /* ignored by v4.1 and v4.2 */ | 171 | hdr->cb_ident = ntohl(*p++); /* ignored by v4.1 and v4.2 */ |
172 | } else { | 172 | } else { |
173 | pr_warn_ratelimited("NFS: %s: NFSv4 server callback with " | 173 | pr_warn_ratelimited("NFS: %s: NFSv4 server callback with " |
@@ -801,8 +801,7 @@ preprocess_nfs4_op(unsigned int op_nr, struct callback_op **op) | |||
801 | return htonl(NFS_OK); | 801 | return htonl(NFS_OK); |
802 | } | 802 | } |
803 | 803 | ||
804 | static __be32 process_op(uint32_t minorversion, int nop, | 804 | static __be32 process_op(int nop, struct svc_rqst *rqstp, |
805 | struct svc_rqst *rqstp, | ||
806 | struct xdr_stream *xdr_in, void *argp, | 805 | struct xdr_stream *xdr_in, void *argp, |
807 | struct xdr_stream *xdr_out, void *resp, | 806 | struct xdr_stream *xdr_out, void *resp, |
808 | struct cb_process_state *cps) | 807 | struct cb_process_state *cps) |
@@ -819,9 +818,9 @@ static __be32 process_op(uint32_t minorversion, int nop, | |||
819 | return status; | 818 | return status; |
820 | 819 | ||
821 | dprintk("%s: minorversion=%d nop=%d op_nr=%u\n", | 820 | dprintk("%s: minorversion=%d nop=%d op_nr=%u\n", |
822 | __func__, minorversion, nop, op_nr); | 821 | __func__, cps->minorversion, nop, op_nr); |
823 | 822 | ||
824 | status = minorversion ? preprocess_nfs41_op(nop, op_nr, &op) : | 823 | status = cps->minorversion ? preprocess_nfs41_op(nop, op_nr, &op) : |
825 | preprocess_nfs4_op(op_nr, &op); | 824 | preprocess_nfs4_op(op_nr, &op); |
826 | if (status == htonl(NFS4ERR_OP_ILLEGAL)) | 825 | if (status == htonl(NFS4ERR_OP_ILLEGAL)) |
827 | op_nr = OP_CB_ILLEGAL; | 826 | op_nr = OP_CB_ILLEGAL; |
@@ -885,14 +884,15 @@ static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *r | |||
885 | return rpc_drop_reply; | 884 | return rpc_drop_reply; |
886 | } | 885 | } |
887 | 886 | ||
887 | cps.minorversion = hdr_arg.minorversion; | ||
888 | hdr_res.taglen = hdr_arg.taglen; | 888 | hdr_res.taglen = hdr_arg.taglen; |
889 | hdr_res.tag = hdr_arg.tag; | 889 | hdr_res.tag = hdr_arg.tag; |
890 | if (encode_compound_hdr_res(&xdr_out, &hdr_res) != 0) | 890 | if (encode_compound_hdr_res(&xdr_out, &hdr_res) != 0) |
891 | return rpc_system_err; | 891 | return rpc_system_err; |
892 | 892 | ||
893 | while (status == 0 && nops != hdr_arg.nops) { | 893 | while (status == 0 && nops != hdr_arg.nops) { |
894 | status = process_op(hdr_arg.minorversion, nops, rqstp, | 894 | status = process_op(nops, rqstp, &xdr_in, |
895 | &xdr_in, argp, &xdr_out, resp, &cps); | 895 | argp, &xdr_out, resp, &cps); |
896 | nops++; | 896 | nops++; |
897 | } | 897 | } |
898 | 898 | ||