[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>
This commit is contained in:
committed by
Linus Torvalds
parent
6b174337e5
commit
482fb94e1b
@ -106,7 +106,6 @@ static void nfs_callback_svc(struct svc_rqst *rqstp)
|
||||
int nfs_callback_up(void)
|
||||
{
|
||||
struct svc_serv *serv;
|
||||
struct svc_sock *svsk;
|
||||
int ret = 0;
|
||||
|
||||
lock_kernel();
|
||||
@ -119,17 +118,14 @@ int nfs_callback_up(void)
|
||||
ret = -ENOMEM;
|
||||
if (!serv)
|
||||
goto out_err;
|
||||
/* FIXME: We don't want to register this socket with the portmapper */
|
||||
ret = svc_makesock(serv, IPPROTO_TCP, nfs_callback_set_tcpport);
|
||||
if (ret < 0)
|
||||
|
||||
ret = svc_makesock(serv, IPPROTO_TCP, nfs_callback_set_tcpport,
|
||||
SVC_SOCK_ANONYMOUS);
|
||||
if (ret <= 0)
|
||||
goto out_destroy;
|
||||
if (!list_empty(&serv->sv_permsocks)) {
|
||||
svsk = list_entry(serv->sv_permsocks.next,
|
||||
struct svc_sock, sk_list);
|
||||
nfs_callback_tcpport = ntohs(inet_sk(svsk->sk_sk)->sport);
|
||||
dprintk ("Callback port = 0x%x\n", nfs_callback_tcpport);
|
||||
} else
|
||||
BUG();
|
||||
nfs_callback_tcpport = ret;
|
||||
dprintk("Callback port = 0x%x\n", nfs_callback_tcpport);
|
||||
|
||||
ret = svc_create_thread(nfs_callback_svc, serv);
|
||||
if (ret < 0)
|
||||
goto out_destroy;
|
||||
@ -140,6 +136,8 @@ out:
|
||||
unlock_kernel();
|
||||
return ret;
|
||||
out_destroy:
|
||||
dprintk("Couldn't create callback socket or server thread; err = %d\n",
|
||||
ret);
|
||||
svc_destroy(serv);
|
||||
out_err:
|
||||
nfs_callback_info.users--;
|
||||
|
Reference in New Issue
Block a user