The rc.d/nfslocking file controls two servers: rpc.statd and rpc.lockd. It worked well

in most cases, except one. The 'restart' case was not working as expected. Specifically,
it would stop both lockd and statd, but it would restart only statd (which appears first
in the script). This is because rc.subr(8) contains code to guard against infinite
recursion in the 'restart' casae.

To fix this use the traditional approach of controlling only one server from one script by
breaking out rc.d/nfslocking into its contituent parts: rc.d/lockd and rc.d/statd. Keep
rc.d/nfslocking around but don't include it in the boot rcorder(8)ing.

PR:	     conf/107316
Approved by: re (bmah)
MFC after:   2 weeks
This commit is contained in:
mtm 2007-08-17 07:58:26 +00:00
parent 5ec55efc55
commit ccb2d02a33
4 changed files with 7 additions and 57 deletions

View File

@ -20,7 +20,7 @@ FILES= DAEMON FILESYSTEMS LOGIN NETWORKING SERVERS \
ipnat ipsec ipxrouted isdnd \
jail \
kadmind kerberos kernel keyserv kldxref kpasswdd \
ldconfig local localpkg lpd \
ldconfig local localpkg lockd lpd \
mixer motd mountcritlocal mountcritremote mountlate \
mdconfig mdconfig2 mountd moused mroute6d mrouted msgs \
named natd netif netoptions \
@ -33,7 +33,7 @@ FILES= DAEMON FILESYSTEMS LOGIN NETWORKING SERVERS \
random rarpd resolv root \
route6d routed routing rpcbind rtadvd rwho \
savecore sdpd securelevel sendmail \
serial sppp swap1 \
serial sppp statd swap1 \
syscons sysctl syslogd \
timed tmp \
ugidfw \

View File

@ -30,34 +30,9 @@ nfslocking_precmd()
then
force_depend rpcbind || ret=1
fi
if [ $name = "statd" ]
then
rc_flags=${rpc_statd_flags}
elif [ $name = "lockd" ]
then
rc_flags=${rpc_lockd_flags}
fi
rc_flags=${rpc_lockd_flags}
return ${ret}
}
start_precmd="nfslocking_precmd"
stop_precmd='checkyesno nfs_server_enable || checkyesno nfs_client_enable'
status_precmd=$stop_precmd
# rpc.statd
#
name="statd"
rcvar=rpc_statd_enable
command="/usr/sbin/rpc.${name}"
load_rc_config $name
run_rc_command "$arg"
# rpc.lockd
#
name="lockd"
rcvar=rpc_lockd_enable
command="/usr/sbin/rpc.${name}"
load_rc_config $name
run_rc_command "$arg"
run_rc_command $1

View File

@ -7,7 +7,7 @@
# PROVIDE: nfslocking
# REQUIRE: nfsserver nfsclient nfsd rpcbind
# BEFORE: DAEMON
# KEYWORD: nojail
# KEYWORD: nojail nostart
. /etc/rc.subr

View File

@ -30,34 +30,9 @@ nfslocking_precmd()
then
force_depend rpcbind || ret=1
fi
if [ $name = "statd" ]
then
rc_flags=${rpc_statd_flags}
elif [ $name = "lockd" ]
then
rc_flags=${rpc_lockd_flags}
fi
rc_flags=${rpc_statd_flags}
return ${ret}
}
start_precmd="nfslocking_precmd"
stop_precmd='checkyesno nfs_server_enable || checkyesno nfs_client_enable'
status_precmd=$stop_precmd
# rpc.statd
#
name="statd"
rcvar=rpc_statd_enable
command="/usr/sbin/rpc.${name}"
load_rc_config $name
run_rc_command "$arg"
# rpc.lockd
#
name="lockd"
rcvar=rpc_lockd_enable
command="/usr/sbin/rpc.${name}"
load_rc_config $name
run_rc_command "$arg"
run_rc_command $1