Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 47974
b: refs/heads/master
c: 482fb94
h: refs/heads/master
v: v3
  • Loading branch information
Chuck Lever authored and Linus Torvalds committed Feb 12, 2007
1 parent 99bdb0e commit 9ffa9a6
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 27 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6b174337e5126de834a971d3edc3681bbfa45e2c
refs/heads/master: 482fb94e1b0c2efe8258334aa2a68d4f4a91de9c
26 changes: 16 additions & 10 deletions trunk/fs/lockd/svc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
20 changes: 9 additions & 11 deletions trunk/fs/nfs/callback.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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;
Expand All @@ -140,6 +136,8 @@ int nfs_callback_up(void)
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--;
Expand Down
6 changes: 4 additions & 2 deletions trunk/fs/nfsd/nfssvc.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,8 @@ static int nfsd_init_socks(int port)

error = lockd_up(IPPROTO_UDP);
if (error >= 0) {
error = svc_makesock(nfsd_serv, IPPROTO_UDP, port);
error = svc_makesock(nfsd_serv, IPPROTO_UDP, port,
SVC_SOCK_DEFAULTS);
if (error < 0)
lockd_down();
}
Expand All @@ -245,7 +246,8 @@ static int nfsd_init_socks(int port)
#ifdef CONFIG_NFSD_TCP
error = lockd_up(IPPROTO_TCP);
if (error >= 0) {
error = svc_makesock(nfsd_serv, IPPROTO_TCP, port);
error = svc_makesock(nfsd_serv, IPPROTO_TCP, port,
SVC_SOCK_DEFAULTS);
if (error < 0)
lockd_down();
}
Expand Down
2 changes: 1 addition & 1 deletion trunk/include/linux/sunrpc/svcsock.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ struct svc_sock {
/*
* Function prototypes.
*/
int svc_makesock(struct svc_serv *, int, unsigned short);
int svc_makesock(struct svc_serv *, int, unsigned short, int flags);
void svc_close_socket(struct svc_sock *);
int svc_recv(struct svc_rqst *, long);
int svc_send(struct svc_rqst *);
Expand Down
6 changes: 4 additions & 2 deletions trunk/net/sunrpc/svcsock.c
Original file line number Diff line number Diff line change
Expand Up @@ -1689,9 +1689,11 @@ void svc_close_socket(struct svc_sock *svsk)
* @serv: RPC server structure
* @protocol: transport protocol to use
* @port: port to use
* @flags: requested socket characteristics
*
*/
int svc_makesock(struct svc_serv *serv, int protocol, unsigned short port)
int svc_makesock(struct svc_serv *serv, int protocol, unsigned short port,
int flags)
{
struct sockaddr_in sin = {
.sin_family = AF_INET,
Expand All @@ -1700,7 +1702,7 @@ int svc_makesock(struct svc_serv *serv, int protocol, unsigned short port)
};

dprintk("svc: creating socket proto = %d\n", protocol);
return svc_create_socket(serv, protocol, &sin, SVC_SOCK_DEFAULTS);
return svc_create_socket(serv, protocol, &sin, flags);
}

/*
Expand Down

0 comments on commit 9ffa9a6

Please sign in to comment.