aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc
diff options
context:
space:
mode:
authorBenny Halevy <bhalevy@panasas.com>2009-04-01 09:23:09 -0400
committerBenny Halevy <bhalevy@panasas.com>2009-06-17 17:11:30 -0400
commit7652e5a09ba319241607b22d9055ce93fd5b8039 (patch)
tree9d1d491af237dffb1593ed8f2351ebda36b32972 /net/sunrpc
parenta43cde94feded0f65fce36330614691c650ae8fe (diff)
nfs41: sunrpc: provide functions to create and destroy a svc_xprt for backchannel use
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>
Diffstat (limited to 'net/sunrpc')
-rw-r--r--net/sunrpc/svcsock.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index 9d504234af4a..a2a03e500533 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -1327,3 +1327,42 @@ static void svc_sock_free(struct svc_xprt *xprt)
1327 sock_release(svsk->sk_sock); 1327 sock_release(svsk->sk_sock);
1328 kfree(svsk); 1328 kfree(svsk);
1329} 1329}
1330
1331/*
1332 * Create a svc_xprt.
1333 *
1334 * For internal use only (e.g. nfsv4.1 backchannel).
1335 * Callers should typically use the xpo_create() method.
1336 */
1337struct svc_xprt *svc_sock_create(struct svc_serv *serv, int prot)
1338{
1339 struct svc_sock *svsk;
1340 struct svc_xprt *xprt = NULL;
1341
1342 dprintk("svc: %s\n", __func__);
1343 svsk = kzalloc(sizeof(*svsk), GFP_KERNEL);
1344 if (!svsk)
1345 goto out;
1346
1347 xprt = &svsk->sk_xprt;
1348 if (prot == IPPROTO_TCP)
1349 svc_xprt_init(&svc_tcp_class, xprt, serv);
1350 else if (prot == IPPROTO_UDP)
1351 svc_xprt_init(&svc_udp_class, xprt, serv);
1352 else
1353 BUG();
1354out:
1355 dprintk("svc: %s return %p\n", __func__, xprt);
1356 return xprt;
1357}
1358EXPORT_SYMBOL_GPL(svc_sock_create);
1359
1360/*
1361 * Destroy a svc_sock.
1362 */
1363void svc_sock_destroy(struct svc_xprt *xprt)
1364{
1365 if (xprt)
1366 kfree(container_of(xprt, struct svc_sock, sk_xprt));
1367}
1368EXPORT_SYMBOL_GPL(svc_sock_destroy);