public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Benny Halevy <bhalevy@panasas.com>
To: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: Ricardo Labiaga <Ricardo.Labiaga@netapp.com>,
	pnfs@linux-nfs.org, linux-nfs@vger.kernel.org,
	Benny Halevy <bhalevy@panasas.com>
Subject: [RFC 15/39] nfs41: sunrpc: provide functions to create and destroy a svc_xprt for backchannel use
Date: Fri,  1 May 2009 02:21:36 +0300	[thread overview]
Message-ID: <1241133696-784-1-git-send-email-bhalevy@panasas.com> (raw)
In-Reply-To: <49FA3180.5030404@panasas.com>

For nfs41 callbacks we need an svc_xprt to process requests coming up the
backchannel socket as rpc_rqst's that are transformed into svc_rqst's that
need a rq_xprt to be processed.

The svc_{udp,tcp}_create methods are too heavy for this job as svc_create_socket
creates an actual socket to listen on while for nfs41 we're "reusing" the
fore channel's socket.

Signed-off-by: Benny Halevy <bhalevy@panasas.com>
---
 include/linux/sunrpc/svcsock.h |    2 ++
 net/sunrpc/svcsock.c           |   39 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h
index 483e103..6bb1ec4 100644
--- a/include/linux/sunrpc/svcsock.h
+++ b/include/linux/sunrpc/svcsock.h
@@ -42,6 +42,8 @@ int		svc_sock_names(char *buf, struct svc_serv *serv, char *toclose);
 int		svc_addsock(struct svc_serv *serv, int fd, char *name_return);
 void		svc_init_xprt_sock(void);
 void		svc_cleanup_xprt_sock(void);
+struct svc_xprt *svc_sock_create(struct svc_serv *serv, int prot);
+void		svc_sock_destroy(struct svc_xprt *);
 
 /*
  * svc_makesock socket characteristics
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index af31988..2334546 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -1306,3 +1306,42 @@ static void svc_sock_free(struct svc_xprt *xprt)
 		sock_release(svsk->sk_sock);
 	kfree(svsk);
 }
+
+/*
+ * Create a svc_xprt.
+ *
+ * For internal use only (e.g. nfsv4.1 backchannel).
+ * Callers should typically use the xpo_create() method.
+ */
+struct svc_xprt *svc_sock_create(struct svc_serv *serv, int prot)
+{
+	struct svc_sock *svsk;
+	struct svc_xprt *xprt = NULL;
+
+	dprintk("svc: %s\n", __func__);
+	svsk = kzalloc(sizeof(*svsk), GFP_KERNEL);
+	if (!svsk)
+		goto out;
+
+	xprt = &svsk->sk_xprt;
+	if (prot == IPPROTO_TCP)
+		svc_xprt_init(&svc_tcp_class, xprt, serv);
+	else if (prot == IPPROTO_UDP)
+		svc_xprt_init(&svc_udp_class, xprt, serv);
+	else
+		BUG();
+out:
+	dprintk("svc: %s return %p\n", __func__, xprt);
+	return xprt;
+}
+EXPORT_SYMBOL_GPL(svc_sock_create);
+
+/*
+ * Destroy a svc_sock.
+ */
+void svc_sock_destroy(struct svc_xprt *xprt)
+{
+	if (xprt)
+		kfree(container_of(xprt, struct svc_sock, sk_xprt));
+}
+EXPORT_SYMBOL_GPL(svc_sock_destroy);
-- 
1.6.2.1


  parent reply	other threads:[~2009-04-30 23:21 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 ` Benny Halevy [this message]
2009-04-30 23:21 ` [RFC 16/39] nfs41: sunrpc: add a struct svc_xprt pointer to struct svc_serv for backchannel use 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
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=1241133696-784-1-git-send-email-bhalevy@panasas.com \
    --to=bhalevy@panasas.com \
    --cc=Ricardo.Labiaga@netapp.com \
    --cc=Trond.Myklebust@netapp.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