Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 May 2009 12:52:52 -0400 (EDT)
From:      Rick Macklem <rick@snowhite.cis.uoguelph.ca>
To:        dougb@FreeBSD.org
Cc:        rwatson@FreeBSD.org, rc@FreeBSD.org, kib@FreeBSD.org
Subject:   Re: rc scripts for the new experimental nfs subsystem
Message-ID:  <200905291652.MAA15699@snowhite.cis.uoguelph.ca>

next in thread | raw e-mail | index | archive | help
> cursory inspection. Please review
> http://www.freebsd.org/doc/en_US.ISO8859-1/articles/rc-scripting/ as well.

Thanks. Very helpful.

Ok, I've shortened nfsv4_serversupport_enable to nfsv4_server_enable and
changed the names of the others to follow the FreeBSD tradition (now that
I know about it:-). I also made the new scripts follow the traditions, I
think? (I also simplified the if in nfsd, since I thought that's what
you meant by "shorten" the first time I read the email. I think it's more
readable this way, anyhow.)

The "REQUIRE: NETWORKING" is debatable for nfsuserd, since it doesn't
use networking itself. However, it calls functions like getpwent(), which
usually use LDAP, NIS,... these days. Also, it's used by NFS, which is
useless without networking, so I thought it made sense?

Thanks for helping out, rick
Here's a diff -u:
--- rc.conf.sav	2009-05-29 11:27:49.000000000 -0400
+++ rc.conf	2009-05-29 11:27:17.000000000 -0400
@@ -311,6 +311,11 @@
 rpc_ypupdated_enable="NO"	# Run if NIS master and SecureRPC (or NO).
 keyserv_enable="NO"		# Run the SecureRPC keyserver (or NO).
 keyserv_flags=""		# Flags to keyserv (if enabled).
+nfsv4_server_enable="NO"	# Enable support for NFSv4
+nfscbd_enable="NO"		# NFSv4 client side callback daemon
+nfscbd_flags=""			# Flags for nfscbd
+nfsuserd_enable="NO"		# NFSv4 user/group name mapping daemon
+nfsuserd_flags=""		# Flags for nfsuserd
 
 ### Network Time Services options: ###
 timed_enable="NO"		# Run the time daemon (or NO).
diff -u -N -r rc.d.sav/mountd rc.d/mountd
--- rc.d.sav/mountd	2009-05-28 14:59:22.000000000 -0400
+++ rc.d/mountd	2009-05-29 11:55:38.000000000 -0400
@@ -37,6 +37,13 @@
 		fi
 	fi
 
+	# If nfsv4_server_enable is yes, force use of the experimental
+	# server
+	#
+	if checkyesno nfsv4_server_enable; then
+		rc_flags="-e ${rc_flags}"
+	fi
+
 	if checkyesno zfs_enable; then
 		rc_flags="${rc_flags} /etc/exports /etc/zfs/exports"
 	fi
diff -u -N -r rc.d.sav/nfscbd rc.d/nfscbd
--- rc.d.sav/nfscbd	1969-12-31 19:00:00.000000000 -0500
+++ rc.d/nfscbd	2009-05-29 11:55:38.000000000 -0400
@@ -0,0 +1,19 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: nfscbd
+# REQUIRE: NETWORKING
+# KEYWORD: nojail shutdown
+
+. /etc/rc.subr
+
+name="nfscbd"
+rcvar=`set_rcvar`
+command="/usr/sbin/${name}"
+
+load_rc_config $name
+sig_stop="USR1"
+
+run_rc_command "$1"
diff -u -N -r rc.d.sav/nfsd rc.d/nfsd
--- rc.d.sav/nfsd	2009-05-28 14:59:22.000000000 -0400
+++ rc.d/nfsd	2009-05-29 11:55:38.000000000 -0400
@@ -14,13 +14,30 @@
 command="/usr/sbin/${name}"
 
 load_rc_config $name
-command_args="${nfs_server_flags}"
 start_precmd="nfsd_precmd"
 sig_stop="USR1"
 
 nfsd_precmd()
 {
-	if ! sysctl vfs.nfsrv >/dev/null 2>&1; then
+	# If nfsv4_server_enable is yes, force use of the experimental
+	# server
+	#
+	if checkyesno nfsv4_server_enable; then
+		rc_flags="-e ${nfs_server_flags}"
+	else
+		rc_flags="${nfs_server_flags}"
+	fi
+
+	if checkyesno nfsv4_server_enable; then
+		if ! checkyesno nfsuserd_enable  && \
+		    ! /etc/rc.d/nfsuserd forcestatus 1>/dev/null 2>&1
+		then
+			force_depend nfsuserd || return 1
+		fi
+	fi
+
+	if ! checkyesno nfsv4_server_enable  && \
+	    ! sysctl vfs.nfsrv >/dev/null 2>&1; then
 		force_depend nfsserver || return 1
 	fi
 
@@ -36,7 +53,8 @@
 		force_depend mountd || return 1
 	fi
 
-	if checkyesno nfs_reserved_port_only; then
+	if ! checkyesno nfsv4_server_enable  && \
+	    checkyesno nfs_reserved_port_only; then
 		echo 'NFS on reserved port only=YES'
 		sysctl vfs.nfsrv.nfs_privport=1 > /dev/null
 	fi
diff -u -N -r rc.d.sav/nfsuserd rc.d/nfsuserd
--- rc.d.sav/nfsuserd	1969-12-31 19:00:00.000000000 -0500
+++ rc.d/nfsuserd	2009-05-29 11:55:38.000000000 -0400
@@ -0,0 +1,19 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: nfsuserd
+# REQUIRE: NETWORKING
+# KEYWORD: nojail shutdown
+
+. /etc/rc.subr
+
+name="nfsuserd"
+rcvar=`set_rcvar`
+command="/usr/sbin/${name}"
+
+load_rc_config $name
+sig_stop="USR1"
+
+run_rc_command "$1"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200905291652.MAA15699>