[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:
parent
6b174337e5
commit
482fb94e1b
5 changed files with 34 additions and 26 deletions
|
|
@ -223,23 +223,29 @@ static int find_socket(struct svc_serv *serv, int proto)
|
|||
return found;
|
||||
}
|
||||
|
||||
/*
|
||||
* Make any sockets that are needed but not present.
|
||||
* If nlm_udpport or nlm_tcpport were set as module
|
||||
* options, make those sockets unconditionally
|
||||
*/
|
||||
static int make_socks(struct svc_serv *serv, int proto)
|
||||
{
|
||||
/* Make any sockets that are needed but not present.
|
||||
* If nlm_udpport or nlm_tcpport were set as module
|
||||
* options, make those sockets unconditionally
|
||||
*/
|
||||
static int warned;
|
||||
static int warned;
|
||||
int err = 0;
|
||||
|
||||
if (proto == IPPROTO_UDP || nlm_udpport)
|
||||
if (!find_socket(serv, IPPROTO_UDP))
|
||||
err = svc_makesock(serv, IPPROTO_UDP, nlm_udpport);
|
||||
if (err == 0 && (proto == IPPROTO_TCP || nlm_tcpport))
|
||||
err = svc_makesock(serv, IPPROTO_UDP, nlm_udpport,
|
||||
SVC_SOCK_DEFAULTS);
|
||||
if (err >= 0 && (proto == IPPROTO_TCP || nlm_tcpport))
|
||||
if (!find_socket(serv, IPPROTO_TCP))
|
||||
err= svc_makesock(serv, IPPROTO_TCP, nlm_tcpport);
|
||||
if (!err)
|
||||
err = svc_makesock(serv, IPPROTO_TCP, nlm_tcpport,
|
||||
SVC_SOCK_DEFAULTS);
|
||||
|
||||
if (err >= 0) {
|
||||
warned = 0;
|
||||
else if (warned++ == 0)
|
||||
err = 0;
|
||||
} else if (warned++ == 0)
|
||||
printk(KERN_WARNING
|
||||
"lockd_up: makesock failed, error=%d\n", err);
|
||||
return err;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue