From: Trond Myklebust <Trond.Myklebust@netapp.com>
To: "Halevy, Benny" <bhalevy@panasas.com>
Cc: linux-nfs@vger.kernel.org, pnfs@linux-nfs.org
Subject: RE: [pnfs] [RFC 31/39] nfs41: cb_sequence xdr implementation
Date: Tue, 16 Jun 2009 10:58:19 -0700 [thread overview]
Message-ID: <1245175099.6755.3.camel@heimdal.trondhjem.org> (raw)
In-Reply-To: <7225594ED4A1304C9E43D030A886D221F4C55A-QcknvLX4j1suWLk7KE+CsC1byIy0dIec@public.gmane.org>
On Mon, 2009-06-15 at 22:25 -0400, Halevy, Benny wrote:
> > > +#define READ64(x) do { \
> > > + (x) = (u64)ntohl(*p++) << 32; \
> > > + (x) |= ntohl(*p++); \
> > > +} while (0)
> >
> > This doesn't appear to be used, and in any case, it duplicates the
>
> Oops, Will do.
>
> > existing function xdr_duplicate_hyper(). Please remove...
>
> xdr_decode_hyper?
Err... Yes. In the non-jetlagged vernacular, it is indeed
xdr_decode_hyper()...
Trond
> Benny
>
> -----Original Message-----
> From: Trond Myklebust [mailto:Trond.Myklebust@netapp.com]
> Sent: Tue 2009-06-16 03:18
> To: Halevy, Benny
> Cc: linux-nfs@vger.kernel.org; pnfs@linux-nfs.org
> Subject: Re: [pnfs] [RFC 31/39] nfs41: cb_sequence xdr implementation
>
> On Fri, 2009-05-01 at 02:24 +0300, Benny Halevy wrote:
> > [nfs41: get rid of READMEM and COPYMEM for callback_xdr.c]
> > Signed-off-by: Benny Halevy <bhalevy@panasas.com>
> > ---
> > fs/nfs/callback_xdr.c | 181 ++++++++++++++++++++++++++++++++++++++++++++++++-
> > 1 files changed, 179 insertions(+), 2 deletions(-)
> >
> > diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c
> > index 9db88ce..066273c 100644
> > --- a/fs/nfs/callback_xdr.c
> > +++ b/fs/nfs/callback_xdr.c
> > @@ -20,8 +20,18 @@
> > 2 + 2 + 3 + 3)
> > #define CB_OP_RECALL_RES_MAXSZ (CB_OP_HDR_RES_MAXSZ)
> >
> > +#if defined(CONFIG_NFS_V4_1)
> > +#define CB_OP_SEQUENCE_RES_MAXSZ (CB_OP_HDR_RES_MAXSZ + \
> > + 4 + 1 + 3)
> > +#endif /* CONFIG_NFS_V4_1 */
> > +
> > #define NFSDBG_FACILITY NFSDBG_CALLBACK
> >
> > +#define READ64(x) do { \
> > + (x) = (u64)ntohl(*p++) << 32; \
> > + (x) |= ntohl(*p++); \
> > +} while (0)
>
> This doesn't appear to be used, and in any case, it duplicates the
> existing function xdr_duplicate_hyper(). Please remove...
>
> > +
> > typedef __be32 (*callback_process_op_t)(void *, void *);
> > typedef __be32 (*callback_decode_arg_t)(struct svc_rqst *, struct xdr_stream *, void *);
> > typedef __be32 (*callback_encode_res_t)(struct svc_rqst *, struct xdr_stream *, void *);
> > @@ -210,6 +220,122 @@ out:
> > return status;
> > }
> >
> > +#if defined(CONFIG_NFS_V4_1)
> > +
> > +static unsigned decode_sessionid(struct xdr_stream *xdr,
> > + struct nfs4_sessionid *sid)
> > +{
> > + uint32_t *p;
> > + int len = NFS4_MAX_SESSIONID_LEN;
> > +
> > + p = read_buf(xdr, len);
> > + if (unlikely(p == NULL))
> > + return htonl(NFS4ERR_RESOURCE);;
> > +
> > + memcpy(sid->data, p, len);
> > + return 0;
> > +}
> > +
> > +static unsigned decode_rc_list(struct xdr_stream *xdr,
> > + struct referring_call_list *rc_list)
> > +{
> > + uint32_t *p;
> > + int i;
> > + unsigned status;
> > +
> > + status = decode_sessionid(xdr, &rc_list->rcl_sessionid);
> > + if (status)
> > + goto out;
> > +
> > + status = htonl(NFS4ERR_RESOURCE);
> > + p = read_buf(xdr, sizeof(uint32_t));
> > + if (unlikely(p == NULL))
> > + goto out;
> > +
> > + rc_list->rcl_nrefcalls = ntohl(*p++);
> > + if (rc_list->rcl_nrefcalls) {
> > + p = read_buf(xdr,
> > + rc_list->rcl_nrefcalls * 2 * sizeof(uint32_t));
> > + if (unlikely(p == NULL))
> > + goto out;
> > + rc_list->rcl_refcalls = kmalloc(rc_list->rcl_nrefcalls *
> > + sizeof(*rc_list->rcl_refcalls),
> > + GFP_KERNEL);
> > + if (unlikely(rc_list->rcl_refcalls == NULL))
> > + goto out;
> > + for (i = 0; i < rc_list->rcl_nrefcalls; i++) {
> > + rc_list->rcl_refcalls[i].rc_sequenceid = ntohl(*p++);
> > + rc_list->rcl_refcalls[i].rc_slotid = ntohl(*p++);
> > + }
> > + }
> > + status = 0;
> > +
> > +out:
> > + return status;
> > +}
> > +
> > +static unsigned decode_cb_sequence_args(struct svc_rqst *rqstp,
> > + struct xdr_stream *xdr,
> > + struct cb_sequenceargs *args)
> > +{
> > + uint32_t *p;
> > + int i;
> > + unsigned status;
> > +
> > + status = decode_sessionid(xdr, &args->csa_sessionid);
> > + if (status)
> > + goto out;
> > +
> > + status = htonl(NFS4ERR_RESOURCE);
> > + p = read_buf(xdr, 5 * sizeof(uint32_t));
> > + if (unlikely(p == NULL))
> > + goto out;
> > +
> > + args->csa_addr = svc_addr_in(rqstp);
> > + args->csa_sequenceid = ntohl(*p++);
> > + args->csa_slotid = ntohl(*p++);
> > + args->csa_highestslotid = ntohl(*p++);
> > + args->csa_cachethis = ntohl(*p++);
> > + args->csa_nrclists = ntohl(*p++);
> > + args->csa_rclists = NULL;
> > + if (args->csa_nrclists) {
> > + args->csa_rclists = kmalloc(args->csa_nrclists *
> > + sizeof(*args->csa_rclists),
> > + GFP_KERNEL);
> > + if (unlikely(args->csa_rclists == NULL))
> > + goto out;
> > +
> > + for (i = 0; i < args->csa_nrclists; i++) {
> > + status = decode_rc_list(xdr, &args->csa_rclists[i]);
> > + if (status)
> > + goto out_free;
> > + }
> > + }
> > + status = 0;
> > +
> > + dprintk("%s: sessionid %x:%x:%x:%x sequenceid %u slotid %u "
> > + "highestslotid %u cachethis %d nrclists %u\n",
> > + __func__,
> > + ((u32 *)&args->csa_sessionid)[0],
> > + ((u32 *)&args->csa_sessionid)[1],
> > + ((u32 *)&args->csa_sessionid)[2],
> > + ((u32 *)&args->csa_sessionid)[3],
> > + args->csa_sequenceid, args->csa_slotid,
> > + args->csa_highestslotid, args->csa_cachethis,
> > + args->csa_nrclists);
> > +out:
> > + dprintk("%s: exit with status = %d\n", __func__, ntohl(status));
> > + return status;
> > +
> > +out_free:
> > + for (i = 0; i < args->csa_nrclists; i++)
> > + kfree(args->csa_rclists[i].rcl_refcalls);
> > + kfree(args->csa_rclists);
> > + goto out;
> > +}
> > +
> > +#endif /* CONFIG_NFS_V4_1 */
> > +
> > static __be32 encode_string(struct xdr_stream *xdr, unsigned int len, const char *str)
> > {
> > __be32 *p;
> > @@ -359,6 +485,49 @@ out:
> > return status;
> > }
> >
> > +#if defined(CONFIG_NFS_V4_1)
> > +
> > +static unsigned encode_sessionid(struct xdr_stream *xdr,
> > + const struct nfs4_sessionid *sid)
> > +{
> > + uint32_t *p;
> > + int len = NFS4_MAX_SESSIONID_LEN;
> > +
> > + p = xdr_reserve_space(xdr, len);
> > + if (unlikely(p == NULL))
> > + return htonl(NFS4ERR_RESOURCE);
> > +
> > + memcpy(p, sid, len);
> > + return 0;
> > +}
> > +
> > +static unsigned encode_cb_sequence_res(struct svc_rqst *rqstp,
> > + struct xdr_stream *xdr,
> > + const struct cb_sequenceres *res)
> > +{
> > + uint32_t *p;
> > + unsigned status = res->csr_status;
> > +
> > + if (unlikely(status != 0))
> > + goto out;
> > +
> > + encode_sessionid(xdr, &res->csr_sessionid);
> > +
> > + p = xdr_reserve_space(xdr, 4 * sizeof(uint32_t));
> > + if (unlikely(p == NULL))
> > + return htonl(NFS4ERR_RESOURCE);
> > +
> > + *p++ = htonl(res->csr_sequenceid);
> > + *p++ = htonl(res->csr_slotid);
> > + *p++ = htonl(res->csr_highestslotid);
> > + *p++ = htonl(res->csr_target_highestslotid);
> > +out:
> > + dprintk("%s: exit with status = %d\n", __func__, ntohl(status));
> > + return status;
> > +}
> > +
> > +#endif /* CONFIG_NFS_V4_1 */
> > +
> > static __be32 process_op(uint32_t minorversion, int nop,
> > struct svc_rqst *rqstp,
> > struct xdr_stream *xdr_in, void *argp,
> > @@ -382,6 +551,7 @@ static __be32 process_op(uint32_t minorversion, int nop,
> > switch (op_nr) {
> > case OP_CB_GETATTR:
> > case OP_CB_RECALL:
> > + case OP_CB_SEQUENCE:
> > op = &callback_ops[op_nr];
> > break;
> >
> > @@ -391,7 +561,6 @@ static __be32 process_op(uint32_t minorversion, int nop,
> > case OP_CB_RECALL_ANY:
> > case OP_CB_RECALLABLE_OBJ_AVAIL:
> > case OP_CB_RECALL_SLOT:
> > - case OP_CB_SEQUENCE:
> > case OP_CB_WANTS_CANCELLED:
> > case OP_CB_NOTIFY_LOCK:
> > case OP_CB_NOTIFY_DEVICEID:
> > @@ -496,7 +665,15 @@ static struct callback_op callback_ops[] = {
> > .process_op = (callback_process_op_t)nfs4_callback_recall,
> > .decode_args = (callback_decode_arg_t)decode_recall_args,
> > .res_maxsize = CB_OP_RECALL_RES_MAXSZ,
> > - }
> > + },
> > +#if defined(CONFIG_NFS_V4_1)
> > + [OP_CB_SEQUENCE] = {
> > + .process_op = (callback_process_op_t)nfs4_callback_sequence,
> > + .decode_args = (callback_decode_arg_t)decode_cb_sequence_args,
> > + .encode_res = (callback_encode_res_t)encode_cb_sequence_res,
> > + .res_maxsize = CB_OP_SEQUENCE_RES_MAXSZ,
> > + },
> > +#endif /* CONFIG_NFS_V4_1 */
> > };
> >
> > /*
>
--
Trond Myklebust
Linux NFS client maintainer
NetApp
Trond.Myklebust@netapp.com
www.netapp.com
next prev parent reply other threads:[~2009-06-16 17:58 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-30 23:17 [RFC 0/39] nfs41 client backchannel for 2.6.31 Benny Halevy
2009-04-30 23:19 ` [RFC 01/39] nfs41: Add ability to read RPC call direction on TCP stream Benny Halevy
2009-04-30 23:19 ` [RFC 02/39] nfs41: Skip past the RPC call direction Benny Halevy
2009-06-03 21:30 ` [pnfs] " Trond Myklebust
[not found] ` <1244064624.5603.53.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2009-06-03 23:30 ` Labiaga, Ricardo
2009-04-30 23:19 ` [RFC 03/39] nfs41: Refactor nfs4_{init,destroy}_callback for nfs4.0 Benny Halevy
2009-04-30 23:19 ` [RFC 04/39] nfs41: minorversion support for nfs4_{init,destroy}_callback Benny Halevy
2009-06-04 2:39 ` [pnfs] [RFC 04/39] nfs41: minorversion support for nfs4_{init, destroy}_callback Trond Myklebust
[not found] ` <1244083198.5603.354.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2009-06-04 18:13 ` Labiaga, Ricardo
2009-04-30 23:19 ` [RFC 05/39] nfs41: client callback structures Benny Halevy
2009-04-30 23:20 ` [RFC 06/39] nfs41: Initialize new rpc_xprt callback related fields Benny Halevy
2009-04-30 23:20 ` [RFC 07/39] nfs41: New backchannel helper routines Benny Halevy
2009-04-30 23:20 ` [RFC 08/39] nfs41: New include/linux/sunrpc/bc_xprt.h Benny Halevy
2009-04-30 23:20 ` [RFC 09/39] nfs41: New xs_tcp_read_data() Benny Halevy
2009-04-30 23:20 ` [RFC 10/39] nfs41: Add backchannel processing support to RPC state machine Benny Halevy
2009-06-04 19:54 ` [pnfs] " Trond Myklebust
[not found] ` <1244145285.5203.94.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2009-06-05 17:44 ` Labiaga, Ricardo
[not found] ` <273FE88A07F5D445824060902F7003440612B896-hX7t0kiaRRpT+ZUat5FNkAK/GNPrWCqfQQ4Iyu8u01E@public.gmane.org>
2009-06-11 23:35 ` [pnfs] [RFC 10/39] nfs41: Add backchannel processing support toRPC " Labiaga, Ricardo
2009-04-30 23:20 ` [RFC 11/39] nfs41: Backchannel callback service helper routines Benny Halevy
2009-06-04 20:20 ` [pnfs] " Trond Myklebust
[not found] ` <1244146842.5203.101.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2009-06-05 18:02 ` Labiaga, Ricardo
2009-04-30 23:21 ` [RFC 12/39] nfs41: Refactor svc_process() Benny Halevy
2009-04-30 23:21 ` [RFC 13/39] nfs41: Backchannel bc_svc_process() Benny Halevy
2009-04-30 23:21 ` [RFC 14/39] nfs41: Implement NFSv4.1 callback service process Benny Halevy
2009-06-04 20:18 ` [pnfs] " Trond Myklebust
[not found] ` <1244146681.5203.99.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2009-06-05 17:57 ` Labiaga, Ricardo
2009-04-30 23:21 ` [RFC 15/39] nfs41: sunrpc: provide functions to create and destroy a svc_xprt for backchannel use Benny Halevy
2009-04-30 23:21 ` [RFC 16/39] nfs41: sunrpc: add a struct svc_xprt pointer to struct svc_serv " Benny Halevy
2009-04-30 23:22 ` [RFC 17/39] nfs41: create a svc_xprt for nfs41 callback thread and use for incoming callbacks Benny Halevy
2009-04-30 23:22 ` [RFC 18/39] nfs41: save svc_serv in nfs_callback_info Benny Halevy
2009-04-30 23:22 ` [RFC 19/39] nfs41: Allow NFSv4 and NFSv4.1 callback services to coexist Benny Halevy
2009-04-30 23:22 ` [RFC 20/39] nfs41: Setup the backchannel Benny Halevy
2009-04-30 23:22 ` [RFC 21/39] nfs41: Client indicates presence of NFSv4.1 callback channel Benny Halevy
2009-04-30 23:22 ` [RFC 22/39] nfs41: Get the rpc_xprt * from the rpc_rqst instead of the rpc_clnt Benny Halevy
2009-04-30 23:22 ` [RFC 23/39] nfs41: Release backchannel resources associated with session Benny Halevy
2009-04-30 23:23 ` [RFC 24/39] nfs41: store minorversion in cb_compound_hdr_arg Benny Halevy
2009-04-30 23:23 ` [RFC 25/39] nfs41: decode minorversion 1 cb_compound header Benny Halevy
2009-06-16 0:13 ` [pnfs] " Trond Myklebust
2009-06-16 1:07 ` Halevy, Benny
2009-04-30 23:23 ` [RFC 26/39] nfs41: callback numbers definitions Benny Halevy
2009-04-30 23:23 ` [RFC 27/39] nfs41: consider minorversion in callback_xdr:process_op Benny Halevy
2009-06-16 0:15 ` [pnfs] " Trond Myklebust
2009-04-30 23:23 ` [RFC 28/39] nfs41: define CB_NOTIFY_DEVICEID as not supported Benny Halevy
2009-04-30 23:24 ` [RFC 29/39] nfs41: cb_sequence protocol level data structures Benny Halevy
2009-04-30 23:24 ` [RFC 30/39] nfs41: cb_sequence proc implementation Benny Halevy
2009-04-30 23:24 ` [RFC 31/39] nfs41: cb_sequence xdr implementation Benny Halevy
2009-06-16 0:18 ` [pnfs] " Trond Myklebust
2009-06-16 2:25 ` Halevy, Benny
[not found] ` <7225594ED4A1304C9E43D030A886D221F4C55A-QcknvLX4j1suWLk7KE+CsC1byIy0dIec@public.gmane.org>
2009-06-16 17:58 ` Trond Myklebust [this message]
2009-04-30 23:24 ` [RFC 32/39] nfs41: verify CB_SEQUENCE position in callback compound Benny Halevy
2009-04-30 23:24 ` [RFC 33/39] nfs41: Rename rq_received to rq_reply_bytes_recvd Benny Halevy
2009-04-30 23:25 ` [RFC 34/39] nfs41: Backchannel: update cb_sequence args and results Benny Halevy
2009-04-30 23:25 ` [RFC 35/39] nfs41: Backchannel: Refactor nfs4_reset_slot_table() Benny Halevy
2009-04-30 23:25 ` [RFC 36/39] nfs41: Backchannel: Refactor nfs4_init_slot_table() Benny Halevy
2009-04-30 23:25 ` [RFC 37/39] nfs41: Backchannel: Add a backchannel slot table to the session Benny Halevy
2009-04-30 23:25 ` [RFC 38/39] nfs41: Backchannel: New find_client_with_session() Benny Halevy
2009-04-30 23:25 ` [RFC 39/39] nfs41: Backchannel: CB_SEQUENCE validation Benny Halevy
2009-06-16 0:27 ` [pnfs] " Trond Myklebust
[not found] ` <1245112062.7470.6.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2009-06-16 0:42 ` Labiaga, Ricardo
2009-06-16 2:40 ` Labiaga, Ricardo
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=1245175099.6755.3.camel@heimdal.trondhjem.org \
--to=trond.myklebust@netapp.com \
--cc=bhalevy@panasas.com \
--cc=linux-nfs@vger.kernel.org \
--cc=pnfs@linux-nfs.org \
/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