summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjjj <none@none>2006-06-05 12:54:58 -0700
committerjjj <none@none>2006-06-05 12:54:58 -0700
commit064ed339d53d38ca3b43105dc6fc88512efed351 (patch)
tree2770105fe5ff4903568e6aba5c6a35b628b2fbeb
parent0c44d0008f52b6a42b9c01d3b344661217520a68 (diff)
downloadillumos-joyent-064ed339d53d38ca3b43105dc6fc88512efed351.tar.gz
6432964 rpcbind should not require restart to begin listening to the network
6432967 rpcbind must listen to the network if NFS is in use
-rw-r--r--usr/src/cmd/fs.d/nfs/svc/Makefile9
-rw-r--r--usr/src/cmd/fs.d/nfs/svc/nlockmgr64
-rw-r--r--usr/src/cmd/fs.d/nfs/svc/nlockmgr.xml9
-rw-r--r--usr/src/cmd/rpcbind/bind.xml7
-rw-r--r--usr/src/cmd/rpcbind/rpcb_svc_com.c6
-rw-r--r--usr/src/cmd/rpcbind/rpcbind.c27
-rw-r--r--usr/src/cmd/rpcbind/rpcbind.h3
-rw-r--r--usr/src/cmd/svc/shell/netservices.sh13
-rw-r--r--usr/src/pkgdefs/SUNWnfscr/prototype_com8
9 files changed, 111 insertions, 35 deletions
diff --git a/usr/src/cmd/fs.d/nfs/svc/Makefile b/usr/src/cmd/fs.d/nfs/svc/Makefile
index a7de6c87df..f4ca4d63de 100644
--- a/usr/src/cmd/fs.d/nfs/svc/Makefile
+++ b/usr/src/cmd/fs.d/nfs/svc/Makefile
@@ -2,9 +2,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -28,7 +27,7 @@
MANIFEST= server.xml client.xml rquota.xml mapid.xml nlockmgr.xml \
status.xml cbd.xml
-SVCMETHOD= nfs-server nfs-client
+SVCMETHOD= nfs-server nfs-client nlockmgr
include $(SRC)/cmd/Makefile.cmd
diff --git a/usr/src/cmd/fs.d/nfs/svc/nlockmgr b/usr/src/cmd/fs.d/nfs/svc/nlockmgr
new file mode 100644
index 0000000000..3a543d6d7c
--- /dev/null
+++ b/usr/src/cmd/fs.d/nfs/svc/nlockmgr
@@ -0,0 +1,64 @@
+#!/sbin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+#ident "%Z%%M% %I% %E% SMI"
+
+#
+# Start the lockd service; we are serving NFS and we need to verify
+# that rpcbind is accepting traffic from the network.
+#
+
+BIND_FMRI=svc:/network/rpc/bind
+do_change=false
+if set -- `svcprop -t -p config/local_only $BIND_FMRI`; then
+ if [ "$2" != boolean ]; then
+ echo "$0: config/local_only property for $BIND_FMRI has wrong "\
+ "type" 1>&2
+ elif [ "$#" -ne 3 ]; then
+ echo "$0: config/local_only property for $BIND_FMRI has wrong "\
+ "number of values" 1>&2
+ elif [ "$3" = true ]; then
+ do_change=true
+ fi
+else
+ # If the property is not found, we just set it.
+ do_change=true
+fi
+
+if $do_change
+then
+ # These will generate errors in the log.
+ svccfg -s $BIND_FMRI setprop config/local_only = boolean: false
+ if [ $? != 0 ]; then
+ echo "$0: WARNING setprop failed" 1>&2
+ fi
+
+ svcadm refresh $BIND_FMRI
+ if [ $? != 0 ]; then
+ echo "$0: WARNING svcadm refresh failed" 1>&2
+ fi
+fi
+
+exec /usr/lib/nfs/lockd
diff --git a/usr/src/cmd/fs.d/nfs/svc/nlockmgr.xml b/usr/src/cmd/fs.d/nfs/svc/nlockmgr.xml
index d047bc12ea..42ec7152a2 100644
--- a/usr/src/cmd/fs.d/nfs/svc/nlockmgr.xml
+++ b/usr/src/cmd/fs.d/nfs/svc/nlockmgr.xml
@@ -1,15 +1,14 @@
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<!--
- Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ Copyright 2006 Sun Microsystems, Inc. All rights reserved.
Use is subject to license terms.
CDDL HEADER START
The contents of this file are subject to the terms of the
- Common Development and Distribution License, Version 1.0 only
- (the "License"). You may not use this file except in compliance
- with the License.
+ Common Development and Distribution License (the "License").
+ You may not use this file except in compliance with the License.
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
or http://www.opensolaris.org/os/licensing.
@@ -78,7 +77,7 @@
<exec_method
type='method'
name='start'
- exec='/usr/lib/nfs/lockd'
+ exec='/lib/svc/method/nlockmgr'
timeout_seconds='60' />
<exec_method
diff --git a/usr/src/cmd/rpcbind/bind.xml b/usr/src/cmd/rpcbind/bind.xml
index 687ce1d12d..2f25398726 100644
--- a/usr/src/cmd/rpcbind/bind.xml
+++ b/usr/src/cmd/rpcbind/bind.xml
@@ -99,6 +99,13 @@
<exec_method
type='method'
+ name='refresh'
+ exec=':kill -HUP'
+ timeout_seconds='0'>
+ </exec_method>
+
+ <exec_method
+ type='method'
name='stop'
exec='/lib/svc/method/rpc-bind %m %{restarter/contract}'
timeout_seconds='60'>
diff --git a/usr/src/cmd/rpcbind/rpcb_svc_com.c b/usr/src/cmd/rpcbind/rpcb_svc_com.c
index 929aff94e5..e40847d163 100644
--- a/usr/src/cmd/rpcbind/rpcb_svc_com.c
+++ b/usr/src/cmd/rpcbind/rpcb_svc_com.c
@@ -1433,7 +1433,13 @@ my_svc_run()
* We ignore all errors, continuing with the assumption
* that it was set by the signal handlers (or any
* other outside event) and not caused by poll().
+ * If it was our refresh signal, call the refresh
+ * function.
*/
+ if (sigrefresh) {
+ sigrefresh = 0;
+ rpcb_check_init();
+ }
case 0:
continue;
default:
diff --git a/usr/src/cmd/rpcbind/rpcbind.c b/usr/src/cmd/rpcbind/rpcbind.c
index c0048484f0..e12942ce79 100644
--- a/usr/src/cmd/rpcbind/rpcbind.c
+++ b/usr/src/cmd/rpcbind/rpcbind.c
@@ -59,7 +59,6 @@
#include <stdlib.h>
#include <thread.h>
#include <synch.h>
-#include <deflt.h>
#include <stdarg.h>
#ifdef PORTMAP
#include <netinet/in.h>
@@ -89,6 +88,7 @@ extern int Is_ipv6present(void);
#define MAX_FILEDESC_LIMIT 1023
static void terminate(int);
+static void note_refresh(int);
static void detachfromtty(void);
static void parseargs(int, char *[]);
static void rbllist_add(ulong_t, ulong_t, struct netconfig *, struct netbuf *);
@@ -96,7 +96,6 @@ static int init_transport(struct netconfig *);
static int check_netconfig(void);
static boolean_t check_hostserv(struct netconfig *, const char *, const char *);
-static void rpcb_check_init(void);
static int setopt_reuseaddr(int);
static int setopt_anon_mlp(int);
static int setup_callit(int);
@@ -120,6 +119,8 @@ boolean_t wrap_enabled = B_FALSE;
boolean_t allow_indirect = B_TRUE;
boolean_t local_only = B_FALSE;
+volatile sig_atomic_t sigrefresh;
+
/* Local Variable */
static int warmstart = 0; /* Grab a old copy of registrations */
@@ -241,7 +242,7 @@ main(int argc, char *argv[])
(void) signal(SIGTERM, terminate);
(void) signal(SIGQUIT, terminate);
/* ignore others that could get sent */
- (void) signal(SIGHUP, SIG_IGN);
+ (void) sigset(SIGHUP, note_refresh);
(void) signal(SIGUSR1, SIG_IGN);
(void) signal(SIGUSR2, SIG_IGN);
if (warmstart) {
@@ -710,6 +711,13 @@ terminate(int sig)
exit(2);
}
+/* ARGSUSED */
+static void
+note_refresh(int sig)
+{
+ sigrefresh = 1;
+}
+
void
rpcbind_abort(void)
{
@@ -904,8 +912,6 @@ check_hostserv(struct netconfig *nconf, const char *host, const char *serv)
return (B_TRUE);
}
-#define DEFRPCBIND "/etc/default/rpcbind"
-
/* Maximum outstanding syslog requests */
#define MAXLOG 100
/* Maximum length: the messages generated are fairly short; no hostnames. */
@@ -970,20 +976,25 @@ get_smf_prop(const char *var, boolean_t def_val)
}
/*
- * Initialize: read the configuration parameters from SMF
+ * Initialize: read the configuration parameters from SMF.
+ * This function must be idempotent because it can be called from the
+ * main poll() loop in my_svc_run().
*/
-static void
+void
rpcb_check_init(void)
{
thread_t tid;
+ static int thr_running;
wrap_enabled = get_smf_prop("enable_tcpwrappers", B_FALSE);
verboselog = get_smf_prop("verbose_logging", B_FALSE);
allow_indirect = get_smf_prop("allow_indirect", B_TRUE);
local_only = get_smf_prop("local_only", B_FALSE);
- if (wrap_enabled)
+ if (wrap_enabled && !thr_running) {
(void) thr_create(NULL, 0, logthread, NULL, THR_DETACHED, &tid);
+ thr_running = 1;
+ }
}
/*
diff --git a/usr/src/cmd/rpcbind/rpcbind.h b/usr/src/cmd/rpcbind/rpcbind.h
index 477079a00f..78c0757e40 100644
--- a/usr/src/cmd/rpcbind/rpcbind.h
+++ b/usr/src/cmd/rpcbind/rpcbind.h
@@ -47,6 +47,7 @@
#include <rpc/pmap_prot.h>
#endif
#include <rpc/rpcb_prot.h>
+#include <signal.h>
#include <tcpd.h>
@@ -60,6 +61,7 @@ extern rpcblist_ptr list_rbl; /* A list of version 3 & 4 rpcbind services */
extern char *loopback_dg; /* CLTS loopback transport, for set/unset */
extern char *loopback_vc; /* COTS loopback transport, for set/unset */
extern char *loopback_vc_ord; /* COTS_ORD loopback transport, for set/unset */
+extern volatile sig_atomic_t sigrefresh; /* Did we receive a SIGHUP recently? */
#ifdef PORTMAP
extern pmaplist *list_pml; /* A list of version 2 rpcbind services */
@@ -74,6 +76,7 @@ extern int add_bndlist();
extern int create_rmtcall_fd();
extern bool_t is_bound();
extern void my_svc_run();
+extern void rpcb_check_init(void);
/* TCP wrapper functions and variables. */
extern boolean_t localxprt(SVCXPRT *, boolean_t);
diff --git a/usr/src/cmd/svc/shell/netservices.sh b/usr/src/cmd/svc/shell/netservices.sh
index 162a282737..1de13b54fc 100644
--- a/usr/src/cmd/svc/shell/netservices.sh
+++ b/usr/src/cmd/svc/shell/netservices.sh
@@ -277,19 +277,6 @@ then
svcadm restart $SENDMAIL_FMRI
fi
-if [ "`svcprop -p restarter/state $BIND_FMRI:default`" = "online" ]
-then
- # since inetd won't successfully re-register RPC-services after
- # rpcbind restarts, we need to stop/start inetd too (and serialize
- # these state-transitions)
- svcadm disable -s $INETD_FMRI:default
- svcadm disable -s $BIND_FMRI:default
- echo "restarting rpcbind"
- svcadm enable -s $BIND_FMRI:default
- echo "restarting inetd"
- svcadm enable -s $INETD_FMRI:default
-fi
-
if [ $DT_CHANGED -eq 1 ]; then
if [ "`svcprop -p restarter/state $DTLOGIN_FMRI:default`" = "online" ]
then
diff --git a/usr/src/pkgdefs/SUNWnfscr/prototype_com b/usr/src/pkgdefs/SUNWnfscr/prototype_com
index b684433162..999a3a97c1 100644
--- a/usr/src/pkgdefs/SUNWnfscr/prototype_com
+++ b/usr/src/pkgdefs/SUNWnfscr/prototype_com
@@ -2,9 +2,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -73,3 +72,4 @@ d none lib 0755 root bin
d none lib/svc 0755 root bin
d none lib/svc/method 0755 root bin
f none lib/svc/method/nfs-client 0555 root bin
+f none lib/svc/method/nlockmgr 0555 root bin