[pnfs] [PATCH 10/12] minorversion 1 xdr infrastructure for nfsv4.1 callbacks
William A. (Andy) Adamson
andros at citi.umich.edu
Tue May 15 14:21:28 EDT 2007
Hi Benny
Looks OK, except that this patch contains master branch (enc_cb_layout_sz )
and 4.1-sessions branch changes (all the rest!)
-->Andy
On 5/7/07, Benny Halevy <bhalevy at panasas.com> wrote:
>
>
>
> From 1a15c081de9bd26c721424fb24df5d6e19de0abb Mon Sep 17 00:00:00 2001
> From: Benny Halevy <bhalevy at ns1.bhalevy.com>
> Date: Mon, 7 May 2007 19:35:06 +0300
> Subject: [PATCH] minorversion 1 xdr infrastructure for nfsv4.1 callbacks
>
> todo: for v4.1 must send cb_sequence first
> ---
> fs/nfsd/nfs4callback.c | 23 ++++++++++++++++-------
> fs/nfsd/nfs4state.c | 4 ++++
> include/linux/nfs4.h | 1 -
> include/linux/nfsd/state.h | 4 +++-
> 4 files changed, 23 insertions(+), 9 deletions(-)
>
> diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
> index c2f4732..6caca21 100644
> --- a/fs/nfsd/nfs4callback.c
> +++ b/fs/nfsd/nfs4callback.c
> @@ -84,8 +84,8 @@ enum nfs_cb_opnum4 {
> #define NFS4_dec_cb_recall_sz (cb_compound_dec_hdr_sz + \
> op_dec_sz)
> #define NFS4_enc_cb_layout_sz (cb_compound_enc_hdr_sz + \
> - 1 + enc_stateid_sz + \
> - enc_nfs4_fh_sz)
> + 1 + 3 + \
> + enc_nfs4_fh_sz + 4)
>
> #define NFS4_dec_cb_layout_sz (cb_compound_dec_hdr_sz + \
> op_dec_sz)
> @@ -150,9 +150,13 @@ xdr_error: \
> } while (0)
>
> struct nfs4_cb_compound_hdr {
> - int status;
> - u32 ident;
> + /* args */
> + u32 minorversion;
> + u32 ident; /* minorversion 0 only */
> u32 nops;
> +
> + /* res */
> + int status;
> u32 taglen;
> char * tag;
> };
> @@ -221,8 +225,10 @@ encode_cb_compound_hdr(struct xdr_stream *xdr, struct
> nfs4_cb_compound_hdr *hdr)
>
> RESERVE_SPACE(16);
> WRITE32(0); /* tag length is always 0 */
> - WRITE32(NFS4_MINOR_VERSION);
> - WRITE32(hdr->ident);
> + WRITE32(hdr->minorversion);
> + if (hdr->minorversion == 0) {
> + WRITE32(hdr->ident);
> + }
> WRITE32(hdr->nops);
> return 0;
> }
> @@ -291,6 +297,7 @@ nfs4_xdr_enc_cb_recall(struct rpc_rqst *req, u32 *p,
> struct nfs4_cb_recall *args
> {
> struct xdr_stream xdr;
> struct nfs4_cb_compound_hdr hdr = {
> + .minorversion = args->cbr_minorversion,
> .ident = args->cbr_ident,
> .nops = 1,
> };
> @@ -306,7 +313,8 @@ nfs4_xdr_enc_cb_layout(struct rpc_rqst *req, u32 *p,
> struct nfs4_cb_layout *args
> struct xdr_stream xdr;
>
> struct nfs4_cb_compound_hdr hdr = {
> - .ident = args->cbl_ident,
> + .minorversion = 1,
> + .ident = 0,
> .nops = 1,
> };
>
> @@ -588,6 +596,7 @@ nfsd4_cb_recall(struct nfs4_delegation *dp)
> if (IS_ERR(msg.rpc_cred))
> goto out;
>
> + cbr->cbr_minorversion = clp->cl_callback.cb_minorversion;
> cbr->cbr_trunc = 0; /* XXX need to implement truncate optimization
> */
> cbr->cbr_dp = dp;
>
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index cd5c212..3d438e4 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -1378,6 +1378,10 @@ int nfsd4_create_session(struct svc_rqst *rqstp,
> struct nfsd4_create_session *se
> conf = unconf;
> unconf = NULL;
> }
> +
> + conf->cl_callback.cb_minorversion = 1;
> + conf->cl_callback.cb_prog = session->callback_prog;
> +
> status = alloc_init_session(conf, session);
>
> out_replay:
> diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
> index c77a9ec..e8ddf14 100644
> --- a/include/linux/nfs4.h
> +++ b/include/linux/nfs4.h
> @@ -399,7 +399,6 @@ enum lock_type4 {
>
> #define NFSPROC4_NULL 0
> #define NFSPROC4_COMPOUND 1
> -#define NFS4_MINOR_VERSION 0
> #define NFS4_DEBUG 1
>
> /* Index of predefined Linux client operations */
> diff --git a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h
> index db0ff4d..5040b6f 100644
> --- a/include/linux/nfsd/state.h
> +++ b/include/linux/nfsd/state.h
> @@ -70,6 +70,7 @@ typedef struct {
>
>
> struct nfs4_cb_recall {
> + u32 cbr_minorversion;
> u32 cbr_ident;
> int cbr_trunc;
> stateid_t cbr_stateid;
> @@ -102,7 +103,8 @@ struct nfs4_callback {
> u32 cb_addr;
> unsigned short cb_port;
> u32 cb_prog;
> - u32 cb_ident;
> + u32 cb_minorversion;
> + u32 cb_ident; /* minorversion 0 only */
> /* RPC client info */
> atomic_t cb_set; /* successful CB_NULL call */
> struct rpc_program cb_program;
> --
> 1.5.1
>
>
> _______________________________________________
> pNFS mailing list
> pNFS at linux-nfs.org
> http://linux-nfs.org/cgi-bin/mailman/listinfo/pnfs
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://linux-nfs.org/pipermail/pnfs/attachments/20070515/cb4cc7e6/attachment-0001.htm
More information about the pNFS
mailing list