aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4xdr.c
diff options
context:
space:
mode:
authorBryan Schumaker <bjschuma@netapp.com>2011-06-02 14:59:07 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2011-07-12 13:40:27 -0400
commitfca78d6d2c77f87d7dbee89bbe4836a44da881e2 (patch)
tree5378bd6ad0917cf11ad7f7b739b71794df230c85 /fs/nfs/nfs4xdr.c
parent6382a44138e7aa40bf52170e7afc014443a24806 (diff)
NFS: Add SECINFO_NO_NAME procedure
If the client is using NFS v4.1, then we can use SECINFO_NO_NAME to find the secflavor for the initial mount. If the server doesn't support SECINFO_NO_NAME then I fall back on the "guess and check" method used for v4.0 mounts. Signed-off-by: Bryan Schumaker <bjschuma@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4xdr.c')
-rw-r--r--fs/nfs/nfs4xdr.c68
1 files changed, 68 insertions, 0 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 1555c74dd336..c8c069a6319b 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -343,6 +343,8 @@ static int nfs4_stat_to_errno(int);
343 1 /* FIXME: opaque lrf_body always empty at the moment */) 343 1 /* FIXME: opaque lrf_body always empty at the moment */)
344#define decode_layoutreturn_maxsz (op_decode_hdr_maxsz + \ 344#define decode_layoutreturn_maxsz (op_decode_hdr_maxsz + \
345 1 + decode_stateid_maxsz) 345 1 + decode_stateid_maxsz)
346#define encode_secinfo_no_name_maxsz (op_encode_hdr_maxsz + 1)
347#define decode_secinfo_no_name_maxsz decode_secinfo_maxsz
346#else /* CONFIG_NFS_V4_1 */ 348#else /* CONFIG_NFS_V4_1 */
347#define encode_sequence_maxsz 0 349#define encode_sequence_maxsz 0
348#define decode_sequence_maxsz 0 350#define decode_sequence_maxsz 0
@@ -772,6 +774,14 @@ static int nfs4_stat_to_errno(int);
772 decode_sequence_maxsz + \ 774 decode_sequence_maxsz + \
773 decode_putfh_maxsz + \ 775 decode_putfh_maxsz + \
774 decode_layoutreturn_maxsz) 776 decode_layoutreturn_maxsz)
777#define NFS4_enc_secinfo_no_name_sz (compound_encode_hdr_maxsz + \
778 encode_sequence_maxsz + \
779 encode_putrootfh_maxsz +\
780 encode_secinfo_no_name_maxsz)
781#define NFS4_dec_secinfo_no_name_sz (compound_decode_hdr_maxsz + \
782 decode_sequence_maxsz + \
783 decode_putrootfh_maxsz + \
784 decode_secinfo_no_name_maxsz)
775 785
776const u32 nfs41_maxwrite_overhead = ((RPC_MAX_HEADER_WITH_AUTH + 786const u32 nfs41_maxwrite_overhead = ((RPC_MAX_HEADER_WITH_AUTH +
777 compound_encode_hdr_maxsz + 787 compound_encode_hdr_maxsz +
@@ -1938,6 +1948,20 @@ encode_layoutreturn(struct xdr_stream *xdr,
1938 hdr->nops++; 1948 hdr->nops++;
1939 hdr->replen += decode_layoutreturn_maxsz; 1949 hdr->replen += decode_layoutreturn_maxsz;
1940} 1950}
1951
1952static int
1953encode_secinfo_no_name(struct xdr_stream *xdr,
1954 const struct nfs41_secinfo_no_name_args *args,
1955 struct compound_hdr *hdr)
1956{
1957 __be32 *p;
1958 p = reserve_space(xdr, 8);
1959 *p++ = cpu_to_be32(OP_SECINFO_NO_NAME);
1960 *p++ = cpu_to_be32(args->style);
1961 hdr->nops++;
1962 hdr->replen += decode_secinfo_no_name_maxsz;
1963 return 0;
1964}
1941#endif /* CONFIG_NFS_V4_1 */ 1965#endif /* CONFIG_NFS_V4_1 */
1942 1966
1943/* 1967/*
@@ -2790,6 +2814,25 @@ static void nfs4_xdr_enc_layoutreturn(struct rpc_rqst *req,
2790 encode_layoutreturn(xdr, args, &hdr); 2814 encode_layoutreturn(xdr, args, &hdr);
2791 encode_nops(&hdr); 2815 encode_nops(&hdr);
2792} 2816}
2817
2818/*
2819 * Encode SECINFO_NO_NAME request
2820 */
2821static int nfs4_xdr_enc_secinfo_no_name(struct rpc_rqst *req,
2822 struct xdr_stream *xdr,
2823 struct nfs41_secinfo_no_name_args *args)
2824{
2825 struct compound_hdr hdr = {
2826 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
2827 };
2828
2829 encode_compound_hdr(xdr, req, &hdr);
2830 encode_sequence(xdr, &args->seq_args, &hdr);
2831 encode_putrootfh(xdr, &hdr);
2832 encode_secinfo_no_name(xdr, args, &hdr);
2833 encode_nops(&hdr);
2834 return 0;
2835}
2793#endif /* CONFIG_NFS_V4_1 */ 2836#endif /* CONFIG_NFS_V4_1 */
2794 2837
2795static void print_overflow_msg(const char *func, const struct xdr_stream *xdr) 2838static void print_overflow_msg(const char *func, const struct xdr_stream *xdr)
@@ -6467,6 +6510,30 @@ static int nfs4_xdr_dec_layoutcommit(struct rpc_rqst *rqstp,
6467out: 6510out:
6468 return status; 6511 return status;
6469} 6512}
6513
6514/*
6515 * Decode SECINFO_NO_NAME response
6516 */
6517static int nfs4_xdr_dec_secinfo_no_name(struct rpc_rqst *rqstp,
6518 struct xdr_stream *xdr,
6519 struct nfs4_secinfo_res *res)
6520{
6521 struct compound_hdr hdr;
6522 int status;
6523
6524 status = decode_compound_hdr(xdr, &hdr);
6525 if (status)
6526 goto out;
6527 status = decode_sequence(xdr, &res->seq_res, rqstp);
6528 if (status)
6529 goto out;
6530 status = decode_putrootfh(xdr);
6531 if (status)
6532 goto out;
6533 status = decode_secinfo(xdr, res);
6534out:
6535 return status;
6536}
6470#endif /* CONFIG_NFS_V4_1 */ 6537#endif /* CONFIG_NFS_V4_1 */
6471 6538
6472/** 6539/**
@@ -6669,6 +6736,7 @@ struct rpc_procinfo nfs4_procedures[] = {
6669 PROC(LAYOUTGET, enc_layoutget, dec_layoutget), 6736 PROC(LAYOUTGET, enc_layoutget, dec_layoutget),
6670 PROC(LAYOUTCOMMIT, enc_layoutcommit, dec_layoutcommit), 6737 PROC(LAYOUTCOMMIT, enc_layoutcommit, dec_layoutcommit),
6671 PROC(LAYOUTRETURN, enc_layoutreturn, dec_layoutreturn), 6738 PROC(LAYOUTRETURN, enc_layoutreturn, dec_layoutreturn),
6739 PROC(SECINFO_NO_NAME, enc_secinfo_no_name, dec_secinfo_no_name),
6672#endif /* CONFIG_NFS_V4_1 */ 6740#endif /* CONFIG_NFS_V4_1 */
6673}; 6741};
6674 6742