summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorMarcel Telka <marcel.telka@nexenta.com>2014-01-10 02:44:54 +0100
committerRobert Mustacchi <rm@joyent.com>2014-02-20 13:54:02 -0800
commit361f55a51b4e8a8d5a73478602f4afdc6e199da5 (patch)
tree7b6796c52d6a352e705ab4450c15b06aa953fc87 /usr/src
parent2c2a4b290e9cec73c81d22d42d3a63f2a3bb4e70 (diff)
downloadillumos-gate-361f55a51b4e8a8d5a73478602f4afdc6e199da5.tar.gz
4576 mountd(1m) needs to be able to set listen backlog
Reviewed by: David Höppner <0xffea@gmail.com> Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com> Reviewed by: Dan McDonald <danmcd@omniti.com> Approved by: Robert Mustacchi <rm@joyent.com>
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/fs.d/nfs/mountd/mountd.c90
-rw-r--r--usr/src/cmd/fs.d/nfs/svc/server.xml3
-rw-r--r--usr/src/lib/libnsl/rpc/svc_generic.c202
-rw-r--r--usr/src/lib/libnsl/rpc/svc_run.c66
-rw-r--r--usr/src/lib/libshare/nfs/libshare_nfs.c12
-rw-r--r--usr/src/uts/common/rpc/rpc_com.h9
6 files changed, 230 insertions, 152 deletions
diff --git a/usr/src/cmd/fs.d/nfs/mountd/mountd.c b/usr/src/cmd/fs.d/nfs/mountd/mountd.c
index d70c6cea8d..0bfa94b225 100644
--- a/usr/src/cmd/fs.d/nfs/mountd/mountd.c
+++ b/usr/src/cmd/fs.d/nfs/mountd/mountd.c
@@ -347,6 +347,22 @@ logging_svc(void *arg)
return (NULL);
}
+static int
+convert_int(int *val, char *str)
+{
+ long lval;
+
+ if (str == NULL || !isdigit(*str))
+ return (-1);
+
+ lval = strtol(str, &str, 10);
+ if (*str != '\0' || lval > INT_MAX)
+ return (-2);
+
+ *val = (int)lval;
+ return (0);
+}
+
int
main(int argc, char *argv[])
{
@@ -354,7 +370,6 @@ main(int argc, char *argv[])
int c;
int rpc_svc_fdunlim = 1;
int rpc_svc_mode = RPC_SVC_MT_AUTO;
- int maxthreads;
int maxrecsz = RPC_MAXDATASIZE;
bool_t exclbind = TRUE;
bool_t can_do_mlp;
@@ -362,6 +377,9 @@ main(int argc, char *argv[])
char defval[4];
int defvers, ret, bufsz;
struct rlimit rl;
+ int listen_backlog = 0;
+ int max_threads = 0;
+ int tmp;
int pipe_fd = -1;
@@ -398,7 +416,12 @@ main(int argc, char *argv[])
(void) enable_extended_FILE_stdio(-1, -1);
- maxthreads = 0;
+ ret = nfs_smf_get_iprop("mountd_max_threads", &max_threads,
+ DEFAULT_INSTANCE, SCF_TYPE_INTEGER, NFSD);
+ if (ret != SA_OK) {
+ syslog(LOG_ERR, "Reading of mountd_max_threads from SMF "
+ "failed, using default value");
+ }
while ((c = getopt(argc, argv, "vrm:")) != EOF) {
switch (c) {
@@ -409,14 +432,17 @@ main(int argc, char *argv[])
rejecting = 1;
break;
case 'm':
- maxthreads = atoi(optarg);
- if (maxthreads < 1) {
- (void) fprintf(stderr,
- "%s: must specify positive maximum threads count, using default\n",
+ if (convert_int(&tmp, optarg) != 0 || tmp < 1) {
+ (void) fprintf(stderr, "%s: invalid "
+ "max_threads option, using defaults\n",
argv[0]);
- maxthreads = 0;
+ break;
}
+ max_threads = tmp;
break;
+ default:
+ fprintf(stderr, "usage: mountd [-v] [-r]\n");
+ exit(1);
}
}
@@ -451,13 +477,20 @@ main(int argc, char *argv[])
}
}
+ ret = nfs_smf_get_iprop("mountd_listen_backlog", &listen_backlog,
+ DEFAULT_INSTANCE, SCF_TYPE_INTEGER, NFSD);
+ if (ret != SA_OK) {
+ syslog(LOG_ERR, "Reading of mountd_listen_backlog from SMF "
+ "failed, using default value");
+ }
+
/*
* Sanity check versions,
* even though we may get versions > MOUNTVERS3, we still need
* to start nfsauth service, so continue on regardless of values.
*/
if (mount_vers_min > mount_vers_max) {
- fprintf(stderr, "server_versmin > server_versmax");
+ fprintf(stderr, "server_versmin > server_versmax\n");
mount_vers_max = mount_vers_min;
}
(void) setlocale(LC_ALL, "");
@@ -482,7 +515,7 @@ main(int argc, char *argv[])
* If we coredump it'll be in /core
*/
if (chdir("/") < 0)
- fprintf(stderr, "chdir /: %s", strerror(errno));
+ fprintf(stderr, "chdir /: %s\n", strerror(errno));
openlog("mountd", LOG_PID, LOG_DAEMON);
@@ -496,7 +529,7 @@ main(int argc, char *argv[])
case 0:
break;
case -1:
- fprintf(stderr, "error locking for %s: %s", MOUNTD,
+ fprintf(stderr, "error locking for %s: %s\n", MOUNTD,
strerror(errno));
exit(2);
default:
@@ -518,7 +551,7 @@ main(int argc, char *argv[])
* A new thread will be spawned for each request.
*/
if (!rpc_control(RPC_SVC_MTMODE_SET, &rpc_svc_mode)) {
- fprintf(stderr, "unable to set automatic MT mode");
+ fprintf(stderr, "unable to set automatic MT mode\n");
exit(1);
}
@@ -527,7 +560,7 @@ main(int argc, char *argv[])
* connection oriented transports.
*/
if (!rpc_control(RPC_SVC_CONNMAXREC_SET, &maxrecsz)) {
- fprintf(stderr, "unable to set RPC max record size");
+ fprintf(stderr, "unable to set RPC max record size\n");
}
/*
@@ -535,15 +568,25 @@ main(int argc, char *argv[])
* from being hijacked by a bind to a more specific addr.
*/
if (!rpc_control(__RPC_SVC_EXCLBIND_SET, &exclbind)) {
- fprintf(stderr, "warning: unable to set udp/tcp EXCLBIND");
+ fprintf(stderr, "warning: unable to set udp/tcp EXCLBIND\n");
+ }
+
+ /*
+ * Set the maximum number of outstanding connection
+ * indications (listen backlog) to the value specified.
+ */
+ if (listen_backlog > 0 && !rpc_control(__RPC_SVC_LSTNBKLOG_SET,
+ &listen_backlog)) {
+ fprintf(stderr, "unable to set listen backlog\n");
+ exit(1);
}
/*
- * If the -m argument was specified, then set the
+ * If max_threads was specified, then set the
* maximum number of threads to the value specified.
*/
- if (maxthreads > 0 && !rpc_control(RPC_SVC_THRMAX_SET, &maxthreads)) {
- fprintf(stderr, "unable to set maxthreads");
+ if (max_threads > 0 && !rpc_control(RPC_SVC_THRMAX_SET, &max_threads)) {
+ fprintf(stderr, "unable to set max_threads\n");
exit(1);
}
@@ -562,7 +605,8 @@ main(int argc, char *argv[])
* traffic) _and_ a doors server (for kernel upcalls).
*/
if (thr_create(NULL, 0, nfsauth_svc, 0, thr_flags, &nfsauth_thread)) {
- fprintf(stderr, gettext("Failed to create NFSAUTH svc thread"));
+ fprintf(stderr,
+ gettext("Failed to create NFSAUTH svc thread\n"));
exit(2);
}
@@ -595,12 +639,12 @@ main(int argc, char *argv[])
if (mount_vers_max >= MOUNTVERS) {
if (svc_create(mnt, MOUNTPROG, MOUNTVERS, "datagram_v") == 0) {
fprintf(stderr,
- "couldn't register datagram_v MOUNTVERS");
+ "couldn't register datagram_v MOUNTVERS\n");
exit(1);
}
if (svc_create(mnt, MOUNTPROG, MOUNTVERS, "circuit_v") == 0) {
fprintf(stderr,
- "couldn't register circuit_v MOUNTVERS");
+ "couldn't register circuit_v MOUNTVERS\n");
exit(1);
}
}
@@ -609,13 +653,13 @@ main(int argc, char *argv[])
if (svc_create(mnt, MOUNTPROG, MOUNTVERS_POSIX,
"datagram_v") == 0) {
fprintf(stderr,
- "couldn't register datagram_v MOUNTVERS_POSIX");
+ "couldn't register datagram_v MOUNTVERS_POSIX\n");
exit(1);
}
if (svc_create(mnt, MOUNTPROG, MOUNTVERS_POSIX,
"circuit_v") == 0) {
fprintf(stderr,
- "couldn't register circuit_v MOUNTVERS_POSIX");
+ "couldn't register circuit_v MOUNTVERS_POSIX\n");
exit(1);
}
}
@@ -623,12 +667,12 @@ main(int argc, char *argv[])
if (mount_vers_max >= MOUNTVERS3) {
if (svc_create(mnt, MOUNTPROG, MOUNTVERS3, "datagram_v") == 0) {
fprintf(stderr,
- "couldn't register datagram_v MOUNTVERS3");
+ "couldn't register datagram_v MOUNTVERS3\n");
exit(1);
}
if (svc_create(mnt, MOUNTPROG, MOUNTVERS3, "circuit_v") == 0) {
fprintf(stderr,
- "couldn't register circuit_v MOUNTVERS3");
+ "couldn't register circuit_v MOUNTVERS3\n");
exit(1);
}
}
diff --git a/usr/src/cmd/fs.d/nfs/svc/server.xml b/usr/src/cmd/fs.d/nfs/svc/server.xml
index 90b98d8c86..3faffa1457 100644
--- a/usr/src/cmd/fs.d/nfs/svc/server.xml
+++ b/usr/src/cmd/fs.d/nfs/svc/server.xml
@@ -22,6 +22,7 @@
CDDL HEADER END
Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ Copyright 2014 Nexenta Systems, Inc. All rights reserved.
NOTE: This service manifest is not editable; its contents will
be overwritten by package or patch operations, including
@@ -167,6 +168,8 @@
<propval name='server_versmax' type='integer' value='4'/>
<propval name='server_versmin' type='integer' value='2'/>
<propval name='servers' type='integer' value='16'/>
+ <propval name='mountd_listen_backlog' type='integer' value='64'/>
+ <propval name='mountd_max_threads' type='integer' value='16'/>
</property_group>
</instance>
diff --git a/usr/src/lib/libnsl/rpc/svc_generic.c b/usr/src/lib/libnsl/rpc/svc_generic.c
index a62cad1a5c..ca9322b45d 100644
--- a/usr/src/lib/libnsl/rpc/svc_generic.c
+++ b/usr/src/lib/libnsl/rpc/svc_generic.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
*/
/* Copyright (c) 1988 AT&T */
@@ -122,7 +123,7 @@ svc_create(void (*dispatch)(), const rpcprog_t prognum, const rpcvers_t versnum,
if (__rpc_try_doors(nettype, &try_others)) {
if (svc_door_create(dispatch, prognum, versnum, 0) == NULL)
(void) syslog(LOG_ERR,
- "svc_create: could not register over doors");
+ "svc_create: could not register over doors");
else
num++;
}
@@ -139,10 +140,11 @@ svc_create(void (*dispatch)(), const rpcprog_t prognum, const rpcvers_t versnum,
/* Found an old one, use it */
(void) rpcb_unset(prognum, versnum, nconf);
if (svc_reg(l->xprt, prognum, versnum,
- dispatch, nconf) == FALSE)
- (void) syslog(LOG_ERR,
- "svc_create: could not register prog %d vers %d on %s",
- prognum, versnum, nconf->nc_netid);
+ dispatch, nconf) == FALSE)
+ (void) syslog(LOG_ERR, "svc_create: "
+ "could not register prog %d vers "
+ "%d on %s",
+ prognum, versnum, nconf->nc_netid);
else
num++;
break;
@@ -154,9 +156,9 @@ svc_create(void (*dispatch)(), const rpcprog_t prognum, const rpcvers_t versnum,
xprt = svc_tp_create(dispatch, prognum, versnum, nconf);
if (xprt) {
if (!__svc_add_to_xlist(&_svc_xprtlist, xprt,
- &xprtlist_lock)) {
+ &xprtlist_lock)) {
(void) syslog(LOG_ERR,
- "svc_create: no memory");
+ "svc_create: no memory");
return (0);
}
num++;
@@ -184,9 +186,8 @@ svc_tp_create(void (*dispatch)(), const rpcprog_t prognum,
boolean_t anon_mlp = B_FALSE;
if (nconf == NULL) {
- (void) syslog(LOG_ERR,
- "svc_tp_create: invalid netconfig structure for prog %d vers %d",
- prognum, versnum);
+ (void) syslog(LOG_ERR, "svc_tp_create: invalid netconfig "
+ "structure for prog %d vers %d", prognum, versnum);
return (NULL);
}
@@ -200,8 +201,8 @@ svc_tp_create(void (*dispatch)(), const rpcprog_t prognum,
(void) rpcb_unset(prognum, versnum, (struct netconfig *)nconf);
if (svc_reg(xprt, prognum, versnum, dispatch, nconf) == FALSE) {
(void) syslog(LOG_ERR,
- "svc_tp_create: Could not register prog %d vers %d on %s",
- prognum, versnum, nconf->nc_netid);
+ "svc_tp_create: Could not register prog %d vers %d on %s",
+ prognum, versnum, nconf->nc_netid);
SVC_DESTROY(xprt);
return (NULL);
}
@@ -247,10 +248,9 @@ svc_tli_create_common(const int ofd, const struct netconfig *nconf,
char errorstr[100];
__tli_sys_strerror(errorstr, sizeof (errorstr),
- t_errno, errno);
- (void) syslog(LOG_ERR,
- "svc_tli_create: could not open connection for %s: %s",
- nconf->nc_netid, errorstr);
+ t_errno, errno);
+ (void) syslog(LOG_ERR, "svc_tli_create: could not open "
+ "connection for %s: %s", nconf->nc_netid, errorstr);
return (NULL);
}
madefd = TRUE;
@@ -263,52 +263,52 @@ svc_tli_create_common(const int ofd, const struct netconfig *nconf,
char errorstr[100];
__tli_sys_strerror(errorstr, sizeof (errorstr),
- t_errno, errno);
+ t_errno, errno);
(void) syslog(LOG_ERR,
- "svc_tli_create: could not do t_sync: %s",
- errorstr);
+ "svc_tli_create: could not do t_sync: %s",
+ errorstr);
return (NULL);
}
if (t_getinfo(fd, &tinfo) == -1) {
char errorstr[100];
__tli_sys_strerror(errorstr, sizeof (errorstr),
- t_errno, errno);
- (void) syslog(LOG_ERR,
- "svc_tli_create: could not get transport information: %s",
- errorstr);
+ t_errno, errno);
+ (void) syslog(LOG_ERR, "svc_tli_create: could not get "
+ "transport information: %s", errorstr);
return (NULL);
}
/* Enable options of returning the ip's for udp */
if (nconf) {
- int ret = 0;
- if (strcmp(nconf->nc_netid, "udp6") == 0) {
- ret = __rpc_tli_set_options(fd, IPPROTO_IPV6,
- IPV6_RECVPKTINFO, 1);
- if (ret < 0) {
- char errorstr[100];
-
- __tli_sys_strerror(errorstr, sizeof (errorstr),
- t_errno, errno);
- (void) syslog(LOG_ERR,
- "svc_tli_create: IPV6_RECVPKTINFO(1): %s",
- errorstr);
- return (NULL);
- }
- } else if (strcmp(nconf->nc_netid, "udp") == 0) {
- ret = __rpc_tli_set_options(fd, IPPROTO_IP,
- IP_RECVDSTADDR, 1);
- if (ret < 0) {
- char errorstr[100];
-
- __tli_sys_strerror(errorstr, sizeof (errorstr),
- t_errno, errno);
- (void) syslog(LOG_ERR,
- "svc_tli_create: IP_RECVDSTADDR(1): %s",
- errorstr);
- return (NULL);
+ int ret = 0;
+ if (strcmp(nconf->nc_netid, "udp6") == 0) {
+ ret = __rpc_tli_set_options(fd, IPPROTO_IPV6,
+ IPV6_RECVPKTINFO, 1);
+ if (ret < 0) {
+ char errorstr[100];
+
+ __tli_sys_strerror(errorstr,
+ sizeof (errorstr), t_errno, errno);
+ (void) syslog(LOG_ERR,
+ "svc_tli_create: "
+ "IPV6_RECVPKTINFO(1): %s",
+ errorstr);
+ return (NULL);
+ }
+ } else if (strcmp(nconf->nc_netid, "udp") == 0) {
+ ret = __rpc_tli_set_options(fd, IPPROTO_IP,
+ IP_RECVDSTADDR, 1);
+ if (ret < 0) {
+ char errorstr[100];
+
+ __tli_sys_strerror(errorstr,
+ sizeof (errorstr), t_errno, errno);
+ (void) syslog(LOG_ERR,
+ "svc_tli_create: "
+ "IP_RECVDSTADDR(1): %s", errorstr);
+ return (NULL);
+ }
}
- }
}
}
@@ -363,15 +363,14 @@ svc_tli_create_common(const int ofd, const struct netconfig *nconf,
}
}
if (bindaddr) {
- if (t_bind(fd, (struct t_bind *)bindaddr,
- tres) == -1) {
+ if (t_bind(fd, (struct t_bind *)bindaddr, tres) == -1) {
char errorstr[100];
__tli_sys_strerror(errorstr, sizeof (errorstr),
- t_errno, errno);
+ t_errno, errno);
(void) syslog(LOG_ERR,
- "svc_tli_create: could not bind: %s",
- errorstr);
+ "svc_tli_create: could not bind: %s",
+ errorstr);
goto freedata;
}
/*
@@ -379,58 +378,64 @@ svc_tli_create_common(const int ofd, const struct netconfig *nconf,
* was non-zero
*/
if (bindaddr->addr.len &&
- (memcmp(bindaddr->addr.buf, tres->addr.buf,
- (int)tres->addr.len) != 0)) {
- (void) syslog(LOG_ERR,
- "svc_tli_create: could not bind to requested address: %s",
- "address mismatch");
+ (memcmp(bindaddr->addr.buf, tres->addr.buf,
+ (int)tres->addr.len) != 0)) {
+ (void) syslog(LOG_ERR, "svc_tli_create: could "
+ "not bind to requested address: address "
+ "mismatch");
goto freedata;
}
} else {
- tres->qlen = 64; /* Chosen Arbitrarily */
+ if (rpc_control(__RPC_SVC_LSTNBKLOG_GET, &tres->qlen)
+ == FALSE) {
+ syslog(LOG_ERR,
+ "svc_tli_create: can't get listen backlog");
+ goto freedata;
+ }
tres->addr.len = 0;
if (t_bind(fd, tres, tres) == -1) {
char errorstr[100];
__tli_sys_strerror(errorstr, sizeof (errorstr),
- t_errno, errno);
+ t_errno, errno);
(void) syslog(LOG_ERR,
- "svc_tli_create: could not bind: %s",
- errorstr);
+ "svc_tli_create: could not bind: %s",
+ errorstr);
goto freedata;
}
}
/* Enable options of returning the ip's for udp */
if (nconf) {
- int ret = 0;
- if (strcmp(nconf->nc_netid, "udp6") == 0) {
- ret = __rpc_tli_set_options(fd, IPPROTO_IPV6,
- IPV6_RECVPKTINFO, 1);
- if (ret < 0) {
- char errorstr[100];
-
- __tli_sys_strerror(errorstr, sizeof (errorstr),
- t_errno, errno);
- (void) syslog(LOG_ERR,
- "svc_tli_create: IPV6_RECVPKTINFO(2): %s",
- errorstr);
- goto freedata;
- }
- } else if (strcmp(nconf->nc_netid, "udp") == 0) {
- ret = __rpc_tli_set_options(fd, IPPROTO_IP,
- IP_RECVDSTADDR, 1);
- if (ret < 0) {
- char errorstr[100];
-
- __tli_sys_strerror(errorstr, sizeof (errorstr),
- t_errno, errno);
- (void) syslog(LOG_ERR,
- "svc_tli_create: IP_RECVDSTADDR(2): %s",
- errorstr);
- goto freedata;
+ int ret = 0;
+ if (strcmp(nconf->nc_netid, "udp6") == 0) {
+ ret = __rpc_tli_set_options(fd, IPPROTO_IPV6,
+ IPV6_RECVPKTINFO, 1);
+ if (ret < 0) {
+ char errorstr[100];
+
+ __tli_sys_strerror(errorstr,
+ sizeof (errorstr), t_errno, errno);
+ (void) syslog(LOG_ERR,
+ "svc_tli_create: "
+ "IPV6_RECVPKTINFO(2): %s",
+ errorstr);
+ goto freedata;
+ }
+ } else if (strcmp(nconf->nc_netid, "udp") == 0) {
+ ret = __rpc_tli_set_options(fd, IPPROTO_IP,
+ IP_RECVDSTADDR, 1);
+ if (ret < 0) {
+ char errorstr[100];
+
+ __tli_sys_strerror(errorstr,
+ sizeof (errorstr), t_errno, errno);
+ (void) syslog(LOG_ERR,
+ "svc_tli_create: "
+ "IP_RECVDSTADDR(2): %s", errorstr);
+ goto freedata;
+ }
}
- }
}
break;
@@ -444,7 +449,7 @@ svc_tli_create_common(const int ofd, const struct netconfig *nconf,
}
tres->addr.len = bindaddr->addr.len;
(void) memcpy(tres->addr.buf, bindaddr->addr.buf,
- (int)tres->addr.len);
+ (int)tres->addr.len);
} else
if (t_getname(fd, &(tres->addr), LOCALNAME) == -1)
tres->addr.len = 0;
@@ -452,9 +457,8 @@ svc_tli_create_common(const int ofd, const struct netconfig *nconf,
case T_INREL:
(void) t_rcvrel(fd);
(void) t_sndrel(fd);
- (void) syslog(LOG_ERR,
- "svc_tli_create: other side wants to\
-release connection");
+ (void) syslog(LOG_ERR, "svc_tli_create: other side wants to "
+ "release connection");
goto freedata;
case T_INCON:
@@ -483,15 +487,15 @@ release connection");
case T_COTS:
if (state == T_DATAXFER)
xprt = svc_fd_create_private(fd, sendsz,
- recvsz);
+ recvsz);
else
xprt = svc_vc_create_private(fd, sendsz,
- recvsz);
+ recvsz);
if (!nconf || !xprt)
break;
if ((tinfo.servtype == T_COTS_ORD) &&
- (state != T_DATAXFER) &&
- (strcmp(nconf->nc_protofmly, "inet") == 0))
+ (state != T_DATAXFER) &&
+ (strcmp(nconf->nc_protofmly, "inet") == 0))
(void) __svc_vc_setflag(xprt, TRUE);
break;
case T_CLTS:
diff --git a/usr/src/lib/libnsl/rpc/svc_run.c b/usr/src/lib/libnsl/rpc/svc_run.c
index cb91ad6515..9b968fe8f6 100644
--- a/usr/src/lib/libnsl/rpc/svc_run.c
+++ b/usr/src/lib/libnsl/rpc/svc_run.c
@@ -23,6 +23,9 @@
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
+/*
+ * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
+ */
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
@@ -32,8 +35,6 @@
* California.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* This is the rpc server side idle loop
* Wait for input, call server program.
@@ -98,6 +99,11 @@ int __rpc_irtimeout = 35;
bool_t __rpc_tp_exclbind = FALSE;
/*
+ * Maximum number of outstanding connection indications (listen backlog).
+ */
+static int __svc_lstnbklog = 64; /* Chosen Arbitrarily */
+
+/*
* XXX - eventually, all mutexes and their initializations static
*/
@@ -310,7 +316,7 @@ alloc_pollset(int npollfds)
svc_pollset_allocd += POLLSET_EXTEND;
} while (npollfds > svc_pollset_allocd);
tmp = realloc(svc_pollset,
- sizeof (pollfd_t) * svc_pollset_allocd);
+ sizeof (pollfd_t) * svc_pollset_allocd);
if (tmp == NULL) {
syslog(LOG_ERR, "alloc_pollset: out of memory");
return (-1);
@@ -345,7 +351,7 @@ _svc_run(void)
if (alloc_pollset(svc_npollfds) == -1)
break;
npollfds = __rpc_compress_pollfd(svc_max_pollfd,
- svc_pollfd, svc_pollset);
+ svc_pollfd, svc_pollset);
(void) rw_unlock(&svc_fd_lock);
if (npollfds == 0)
break; /* None waiting, hence return */
@@ -457,7 +463,7 @@ continue_with_locks:
*/
(void) rw_rdlock(&svc_fd_lock);
if (svc_npollfds == 0 ||
- alloc_pollset(svc_npollfds + 1) == -1) {
+ alloc_pollset(svc_npollfds + 1) == -1) {
(void) rw_unlock(&svc_fd_lock);
svc_polling = FALSE;
svc_thr_total--;
@@ -471,7 +477,7 @@ continue_with_locks:
}
npollfds = __rpc_compress_pollfd(svc_max_pollfd,
- svc_pollfd, svc_pollset);
+ svc_pollfd, svc_pollset);
(void) rw_unlock(&svc_fd_lock);
if (npollfds == 0) {
@@ -491,12 +497,12 @@ continue_with_locks:
}
while (svc_npollfds_set == 0 &&
- svc_pollfds == 0 &&
- svc_total_pending == 0 &&
- !svc_exit_done) {
+ svc_pollfds == 0 &&
+ svc_total_pending == 0 &&
+ !svc_exit_done) {
svc_waiters++;
(void) cond_wait(&svc_thr_fdwait,
- &svc_mutex);
+ &svc_mutex);
svc_waiters--;
}
@@ -616,9 +622,9 @@ continue_with_locks:
* (svc_thr_max - svc_thr_total).
*/
if (svc_thr_total < svc_thr_max &&
- svc_mt_mode == RPC_SVC_MT_AUTO && !svc_exit_done) {
+ svc_mt_mode == RPC_SVC_MT_AUTO && !svc_exit_done) {
n_new = 1 + 1 + svc_pollfds + svc_total_pending -
- (svc_thr_total - svc_thr_active);
+ (svc_thr_total - svc_thr_active);
if (n_new > (svc_thr_max - svc_thr_total))
n_new = svc_thr_max - svc_thr_total;
if (n_new > 0)
@@ -677,7 +683,7 @@ continue_with_locks:
msg->rm_call.cb_cred.oa_base = cred_area;
msg->rm_call.cb_verf.oa_base =
- &(cred_area[MAX_AUTH_BYTES]);
+ &(cred_area[MAX_AUTH_BYTES]);
r->rq_clntcred = &(cred_area[2 * MAX_AUTH_BYTES]);
/*
@@ -717,10 +723,10 @@ continue_with_locks:
* there's some immediate work.
*/
if (!main_thread &&
- svc_pollfds <= 0 &&
- svc_total_pending <= 0 &&
- (svc_polling ||
- svc_waiters > 0)) {
+ svc_pollfds <= 0 &&
+ svc_total_pending <= 0 &&
+ (svc_polling ||
+ svc_waiters > 0)) {
svc_thr_total--;
if (svc_thr_total ==
svc_waiters) {
@@ -770,17 +776,17 @@ create_pipe(void)
{
if (pipe(svc_pipe) == -1) {
syslog(LOG_ERR, dgettext(__nsl_dom,
- "RPC: svc could not create pipe - exiting"));
+ "RPC: svc could not create pipe - exiting"));
exit(1);
}
if (fcntl(svc_pipe[0], F_SETFL, O_NONBLOCK) == -1) {
syslog(LOG_ERR, dgettext(__nsl_dom,
- "RPC: svc pipe error - exiting"));
+ "RPC: svc pipe error - exiting"));
exit(1);
}
if (fcntl(svc_pipe[1], F_SETFL, O_NONBLOCK) == -1) {
syslog(LOG_ERR, dgettext(__nsl_dom,
- "RPC: svc pipe error - exiting"));
+ "RPC: svc pipe error - exiting"));
exit(1);
}
}
@@ -812,8 +818,7 @@ select_next_pollfd(int *fd, int *pollfdIndex)
assert(MUTEX_HELD(&svc_thr_mutex));
assert(MUTEX_HELD(&svc_mutex));
- for (i = svc_next_pollfd; svc_pollfds > 0 && i < svc_polled;
- i++) {
+ for (i = svc_next_pollfd; svc_pollfds > 0 && i < svc_polled; i++) {
if (svc_pollset[i].revents) {
svc_pollfds--;
/*
@@ -907,7 +912,7 @@ _svc_done_private(SVCXPRT *xprt)
if (svc_failed(xprt) || svc_defunct(xprt)) {
/* LINTED pointer alignment */
svc_flags(parent) |= (svc_flags(xprt) &
- (SVC_FAILED | SVC_DEFUNCT));
+ (SVC_FAILED | SVC_DEFUNCT));
/* LINTED pointer alignment */
if (SVCEXT(parent)->refcnt == 0)
_svc_destroy_private(xprt);
@@ -962,7 +967,7 @@ svc_args_done(SVCXPRT *xprt)
/* LINTED pointer alignment */
if (svc_type(xprt) == SVC_CONNECTION &&
- (stat = SVC_STAT(xprt)) != XPRT_IDLE) {
+ (stat = SVC_STAT(xprt)) != XPRT_IDLE) {
if (stat == XPRT_MOREREQS) {
(void) mutex_lock(&svc_mutex);
svc_pending_fds[svc_last_pending++] = xprt->xp_fd;
@@ -1039,7 +1044,7 @@ rpc_control(int op, void *info)
case RPC_SVC_MTMODE_SET:
tmp = *((int *)info);
if (tmp != RPC_SVC_MT_NONE && tmp != RPC_SVC_MT_AUTO &&
- tmp != RPC_SVC_MT_USER)
+ tmp != RPC_SVC_MT_USER)
return (FALSE);
if (svc_mt_mode != RPC_SVC_MT_NONE && svc_mt_mode != tmp)
return (FALSE);
@@ -1109,6 +1114,17 @@ rpc_control(int op, void *info)
}
return (FALSE);
+ case __RPC_SVC_LSTNBKLOG_SET:
+ tmp = *(int *)info;
+ if (tmp > 0) {
+ __svc_lstnbklog = tmp;
+ return (TRUE);
+ }
+ return (FALSE);
+ case __RPC_SVC_LSTNBKLOG_GET:
+ *(int *)info = __svc_lstnbklog;
+ return (TRUE);
+
default:
return (FALSE);
}
diff --git a/usr/src/lib/libshare/nfs/libshare_nfs.c b/usr/src/lib/libshare/nfs/libshare_nfs.c
index 90cb9624e7..e14a8a0ef7 100644
--- a/usr/src/lib/libshare/nfs/libshare_nfs.c
+++ b/usr/src/lib/libshare/nfs/libshare_nfs.c
@@ -21,9 +21,7 @@
/*
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
- */
-/*
- * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
*/
/*
@@ -2399,6 +2397,14 @@ struct proto_option_defs {
{"nfsd_device",
"device", PROTO_OPT_NFSD_DEVICE,
OPT_TYPE_STRING, NULL, SVC_NFSD, 0, 0},
+#define PROTO_OPT_MOUNTD_LISTEN_BACKLOG 15
+ {"mountd_listen_backlog",
+ "mountd_listen_backlog", PROTO_OPT_MOUNTD_LISTEN_BACKLOG,
+ OPT_TYPE_NUMBER, 64, SVC_NFSD|SVC_MOUNTD, 1, INT32_MAX},
+#define PROTO_OPT_MOUNTD_MAX_THREADS 16
+ {"mountd_max_threads",
+ "mountd_max_threads", PROTO_OPT_MOUNTD_MAX_THREADS,
+ OPT_TYPE_NUMBER, 16, SVC_NFSD|SVC_MOUNTD, 1, INT32_MAX},
{NULL}
};
diff --git a/usr/src/uts/common/rpc/rpc_com.h b/usr/src/uts/common/rpc/rpc_com.h
index c0aa33f85e..0e02251d08 100644
--- a/usr/src/uts/common/rpc/rpc_com.h
+++ b/usr/src/uts/common/rpc/rpc_com.h
@@ -22,6 +22,9 @@
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
+/*
+ * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
+ */
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
@@ -39,8 +42,6 @@
#ifndef _RPC_RPC_COM_H
#define _RPC_RPC_COM_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/types.h>
#include <rpc/types.h>
@@ -120,6 +121,10 @@ bool_t rpc_control();
/* set inter record timeout for COTS RPC */
#define RPC_SVC_IRTIMEOUT_SET 15
+/* private interface for maximum number of outstanding connection indications */
+#define __RPC_SVC_LSTNBKLOG_SET 16 /* set listen backlog */
+#define __RPC_SVC_LSTNBKLOG_GET 17 /* get listen backlog */
+
#endif /* !_KERNEL */
#ifdef __cplusplus