public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Benny Halevy <bhalevy@panasas.com>
To: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: "J. Bruce Fields" <bfields@citi.umich.edu>,
	Andy Adamson <andros@netapp.com>,
	linux-nfs@vger.kernel.org, pnfs@linux-nfs.org
Subject: Re: [pnfs] [RFC 09/10] nfsd41: cb_sequence callback
Date: Fri, 01 May 2009 11:33:16 +0300	[thread overview]
Message-ID: <49FAB3CC.7000600@panasas.com> (raw)
In-Reply-To: <1241135565.15476.111.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>

On May. 01, 2009, 2:52 +0300, Trond Myklebust <trond.myklebust@fys.uio.no> wrote:
> On Fri, 2009-05-01 at 02:06 +0300, Benny Halevy wrote:
>> From: Andy Adamson <andros@netapp.com>
>>
>> Implement the cb_sequence callback conforming to draft-ietf-nfsv4-minorversion1
>>
>> Note: highest slot id and target highest slot id do not have to be 0
>> as was previously implemented.  They can be greater than what the
>> nfs server sent if the client supports a larger slot table on the
>> backchannel.  At this point we just ignore that.
>>
>> Signed-off-by: Benny Halevy <bhalevy@panasas.com>
>> [Rework the back channel xdr using the shared v4.0 and v4.1 framework.]
>> Signed-off-by: Andy Adamson <andros@netapp.com>
>> [fixed indentation]
>> Signed-off-by: Benny Halevy <bhalevy@panasas.com>
>> [nfsd41: use nfsd4_cb_sequence for callback minorversion]
>> Signed-off-by: Benny Halevy <bhalevy@panasas.com>
>> [nfsd41: fix verification of CB_SEQUENCE highest slot id[
>> Signed-off-by: Benny Halevy <bhalevy@panasas.com>
>> [nfsd41: Backchannel: Remove old backchannel serialization]
>> [nfsd41: Backchannel: First callback sequence ID should be 1]
>> Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga@netapp.com>
>> Signed-off-by: Benny Halevy <bhalevy@panasas.com>
>> ---
>>  fs/nfsd/nfs4callback.c |   72 ++++++++++++++++++++++++++++++++++++++++++++++++
>>  fs/nfsd/nfs4state.c    |    1 +
>>  2 files changed, 73 insertions(+), 0 deletions(-)
>>
>> diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
>> index 2bf2cd4..78f4dd2 100644
>> --- a/fs/nfsd/nfs4callback.c
>> +++ b/fs/nfsd/nfs4callback.c
>> @@ -264,6 +264,27 @@ encode_cb_recall(struct xdr_stream *xdr, struct nfs4_cb_recall *cb_rec,
>>  	hdr->nops++;
>>  }
>>  
>> +static void
>> +encode_cb_sequence(struct xdr_stream *xdr, struct nfsd4_cb_sequence *args,
>> +		   struct nfs4_cb_compound_hdr *hdr)
>> +{
>> +	__be32 *p;
>> +
>> +	if (hdr->minorversion == 0)
>> +		return;
>> +
>> +	RESERVE_SPACE(1 + NFS4_MAX_SESSIONID_LEN + 20);
>> +
>> +	WRITE32(OP_CB_SEQUENCE);
>> +	WRITEMEM(args->cbs_clp->cl_sessionid.data, NFS4_MAX_SESSIONID_LEN);
>> +	WRITE32(args->cbs_clp->cl_cb_seq_nr);
>> +	WRITE32(0);		/* slotid, always 0 */
>> +	WRITE32(0);		/* highest slotid always 0 */
>> +	WRITE32(0);		/* cachethis always 0 */
>> +	WRITE32(0); /* FIXME: support referring_call_lists */
>> +	hdr->nops++;
>> +}
>> +
>>  static int
>>  nfs4_xdr_enc_cb_null(struct rpc_rqst *req, __be32 *p)
>>  {
>> @@ -325,6 +346,57 @@ decode_cb_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected)
>>  	return 0;
>>  }
>>  
>> +/*
>> + * Our current back channel implmentation supports a single backchannel
>> + * with a single slot.
>> + */
>> +static int
>> +decode_cb_sequence(struct xdr_stream *xdr, struct nfsd4_cb_sequence *res,
>> +		   struct rpc_rqst *rqstp)
>> +{
>> +	struct nfs4_sessionid id;
>> +	int status;
>> +	u32 dummy;
>> +	__be32 *p;
>> +
>> +	if (res->cbs_minorversion == 0)
>> +		return 0;
>> +
>> +	status = decode_cb_op_hdr(xdr, OP_CB_SEQUENCE);
>> +	if (status)
>> +		return status;
>> +
>> +	/*
>> +	 * If the server returns different values for sessionID, slotID or
>> +	 * sequence number, the server is looney tunes.
>> +	 */
>> +	status = -ESERVERFAULT;
>> +
>> +	READ_BUF(NFS4_MAX_SESSIONID_LEN + 16);
>> +	COPYMEM(id.data, NFS4_MAX_SESSIONID_LEN);
>> +	if (memcmp(id.data, res->cbs_clp->cl_sessionid.data,
>> +		   NFS4_MAX_SESSIONID_LEN)) {
>> +		dprintk("%s Invalid session id\n", __func__);
>> +		goto out;
>> +	}
>> +	READ32(dummy);
>> +	if (dummy != res->cbs_clp->cl_cb_seq_nr) {
>> +		dprintk("%s Invalid sequence number\n", __func__);
>> +		goto out;
>> +	}
>> +	READ32(dummy); 	/* slotid must be 0 */
>> +	if (dummy != 0) {
>> +		dprintk("%s Invalid slotid\n", __func__);
>> +		goto out;
>> +	}
>> +	READ32(dummy); 	/* highest slotid */
>           ^^^^^^^^^^^^^
> 
>> +	READ32(dummy); 	/* target highest slotid */
>           ^^^^^^^^^^^^^^
> 
> Why do you need those?

Good catch :)
Since READ_BUF (xdr_inline_decode) indeed takes care of
adjusting the xdr_stream pointer we can take them out.
A FIXME comment about the need to process these channel
attributes would be clearer.

Benny

> 
>> +	status = 0;
>> +out:
>> +	return status;
>> +}
>> +
>> +
>>  static int
>>  nfs4_xdr_dec_cb_null(struct rpc_rqst *req, __be32 *p)
>>  {
>> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
>> index d7b4028..6f3cf47 100644
>> --- a/fs/nfsd/nfs4state.c
>> +++ b/fs/nfsd/nfs4state.c
>> @@ -1400,6 +1400,7 @@ nfsd4_create_session(struct svc_rqst *rqstp,
>>  			svc_xprt_get(unconf->cl_cb_xprt);
>>  			unconf->cl_callback.cb_minorversion =
>>  				cstate->minorversion;
>> +			unconf->cl_cb_seq_nr = 1;
>>  			unconf->cl_callback.cb_prog = cr_ses->callback_prog;
>>  			nfsd4_probe_callback(unconf);
>>  		}
>> -- 
>> 1.6.2.1
>>
>> _______________________________________________
>> pNFS mailing list
>> pNFS@linux-nfs.org
>> http://linux-nfs.org/cgi-bin/mailman/listinfo/pnfs
> 
> 

  parent reply	other threads:[~2009-05-01  8:34 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-30 23:00 [RFC 0/10] nfsd41 server backchannel for 2.6.31 Benny Halevy
2009-04-30 23:05 ` [RFC 01/10] nfsd: cleanup nfs4.0 callback encode routines Benny Halevy
2009-04-30 23:05 ` [RFC 02/10] nfsd: minorversion support for the back channel Benny Halevy
2009-04-30 23:05 ` [RFC 03/10] nfsd41: sunrpc: Added rpc server-side backchannel handling Benny Halevy
2009-05-01  0:05   ` [pnfs] " Trond Myklebust
     [not found]     ` <1241136328.15476.124.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2009-05-01  0:13       ` Labiaga, Ricardo
2009-06-02  0:33       ` Labiaga, Ricardo
     [not found]         ` <273FE88A07F5D445824060902F70034405FE3129-hX7t0kiaRRpT+ZUat5FNkAK/GNPrWCqfQQ4Iyu8u01E@public.gmane.org>
2009-06-02  0:52           ` J. Bruce Fields
2009-06-02  1:24             ` [pnfs] [RFC 03/10] nfsd41: sunrpc: Added rpc server-sidebackchannel handling Labiaga, Ricardo
2009-06-02  4:51           ` [pnfs] [RFC 03/10] nfsd41: sunrpc: Added rpc server-side backchannel handling Benny Halevy
     [not found]             ` <273FE88A07F5D445824060902F70034402030375@SACMVEXC1-PRD.hq.netapp.com>
     [not found]               ` <273FE88A07F5D445824060902F70034402030375-hX7t0kiaRRpT+ZUat5FNkAK/GNPrWCqfQQ4Iyu8u01E@public.gmane.org>
2009-06-03  8:44                 ` Benny Halevy
2009-05-03 20:36   ` J. Bruce Fields
2009-04-30 23:06 ` [RFC 04/10] nfsd41: Remember the auth flavor to use for callbacks Benny Halevy
2009-05-03 20:42   ` J. Bruce Fields
2009-05-05  2:51     ` [RFC 04/10] nfsd41: Remember the auth flavor to use forcallbacks Labiaga, Ricardo
2009-04-30 23:06 ` [RFC 05/10] nfsd41: callback infrastructure Benny Halevy
2009-05-03 20:49   ` J. Bruce Fields
2009-04-30 23:06 ` [RFC 06/10] nfsd41: Backchannel: Add sequence arguments to callback RPC arguments Benny Halevy
2009-04-30 23:06 ` [RFC 07/10] nfsd41: Backchannel: Server backchannel RPC wait queue Benny Halevy
2009-04-30 23:06 ` [RFC 08/10] nfsd41: Backchannel: Setup sequence information Benny Halevy
2009-04-30 23:06 ` [RFC 09/10] nfsd41: cb_sequence callback Benny Halevy
2009-04-30 23:52   ` [pnfs] " Trond Myklebust
     [not found]     ` <1241135565.15476.111.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2009-05-01  8:33       ` Benny Halevy [this message]
2009-04-30 23:07 ` [RFC 10/10] nfsd41: cb_recall callback Benny Halevy
2009-04-30 23:12 ` [pnfs] [RFC 0/10] nfsd41 server backchannel for 2.6.31 Benny Halevy
2009-05-03 20:53 ` J. Bruce Fields
2009-05-06  4:11   ` Labiaga, Ricardo
2009-05-06 21:24     ` J. Bruce Fields

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49FAB3CC.7000600@panasas.com \
    --to=bhalevy@panasas.com \
    --cc=andros@netapp.com \
    --cc=bfields@citi.umich.edu \
    --cc=linux-nfs@vger.kernel.org \
    --cc=pnfs@linux-nfs.org \
    --cc=trond.myklebust@fys.uio.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox