aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/callback.c
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2007-02-12 03:53:29 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-12 12:48:35 -0500
commit482fb94e1b0c2efe8258334aa2a68d4f4a91de9c (patch)
tree84353b34bb5ea02df98b598fff037cf1da20d6b0 /fs/nfs/callback.c
parent6b174337e5126de834a971d3edc3681bbfa45e2c (diff)
[PATCH] knfsd: SUNRPC: allow creating an RPC service without registering with portmapper
Sometimes we need to create an RPC service but not register it with the local portmapper. NFSv4 delegation callback, for example. Change the svc_makesock() API to allow optionally creating temporary or permanent sockets, optionally registering with the local portmapper, and make it return the ephemeral port of the new socket. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net> Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/nfs/callback.c')
-rw-r--r--fs/nfs/callback.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c
index 7933e2e99dbc..a070109fa6c7 100644
--- a/fs/nfs/callback.c
+++ b/fs/nfs/callback.c
@@ -106,7 +106,6 @@ static void nfs_callback_svc(struct svc_rqst *rqstp)
106int nfs_callback_up(void) 106int nfs_callback_up(void)
107{ 107{
108 struct svc_serv *serv; 108 struct svc_serv *serv;
109 struct svc_sock *svsk;
110 int ret = 0; 109 int ret = 0;
111 110
112 lock_kernel(); 111 lock_kernel();
@@ -119,17 +118,14 @@ int nfs_callback_up(void)
119 ret = -ENOMEM; 118 ret = -ENOMEM;
120 if (!serv) 119 if (!serv)
121 goto out_err; 120 goto out_err;
122 /* FIXME: We don't want to register this socket with the portmapper */ 121
123 ret = svc_makesock(serv, IPPROTO_TCP, nfs_callback_set_tcpport); 122 ret = svc_makesock(serv, IPPROTO_TCP, nfs_callback_set_tcpport,
124 if (ret < 0) 123 SVC_SOCK_ANONYMOUS);
124 if (ret <= 0)
125 goto out_destroy; 125 goto out_destroy;
126 if (!list_empty(&serv->sv_permsocks)) { 126 nfs_callback_tcpport = ret;
127 svsk = list_entry(serv->sv_permsocks.next, 127 dprintk("Callback port = 0x%x\n", nfs_callback_tcpport);
128 struct svc_sock, sk_list); 128
129 nfs_callback_tcpport = ntohs(inet_sk(svsk->sk_sk)->sport);
130 dprintk ("Callback port = 0x%x\n", nfs_callback_tcpport);
131 } else
132 BUG();
133 ret = svc_create_thread(nfs_callback_svc, serv); 129 ret = svc_create_thread(nfs_callback_svc, serv);
134 if (ret < 0) 130 if (ret < 0)
135 goto out_destroy; 131 goto out_destroy;
@@ -140,6 +136,8 @@ out:
140 unlock_kernel(); 136 unlock_kernel();
141 return ret; 137 return ret;
142out_destroy: 138out_destroy:
139 dprintk("Couldn't create callback socket or server thread; err = %d\n",
140 ret);
143 svc_destroy(serv); 141 svc_destroy(serv);
144out_err: 142out_err:
145 nfs_callback_info.users--; 143 nfs_callback_info.users--;