1#!/bin/sh 2# 3# 4 5# PROVIDE: nfsclient 6# REQUIRE: NETWORKING mountcritremote rpcbind 7# KEYWORD: nojail shutdown 8 9. /etc/rc.subr 10 11name="nfsclient" 12desc="NFS client setup" 13rcvar="nfs_client_enable" 14start_cmd="nfsclient_start" 15stop_cmd="unmount_all" 16required_modules="nfscl:nfs" 17 18nfsclient_start() 19{ 20 # 21 # Set some nfs client related sysctls 22 # 23 24 if [ -n "${nfs_access_cache}" ]; then 25 startmsg "NFS access cache time=${nfs_access_cache}" 26 if ! sysctl vfs.nfs.access_cache_timeout=${nfs_access_cache} >/dev/null; then 27 warn "failed to set access cache timeout" 28 fi 29 fi 30 if [ -n "${nfs_bufpackets}" ]; then 31 if ! sysctl vfs.nfs.bufpackets=${nfs_bufpackets} > /dev/null; then 32 warn "failed to set vfs.nfs.bufpackets" 33 fi 34 fi 35 if checkyesno nfs_client_rdma_enable; then 36 load_kld nfsclrdma || err 1 "Cannot load nfsclrdma" 37 fi 38 39 unmount_all 40} 41 42unmount_all() 43{ 44 # If /var/db/mounttab exists, some nfs-server has not been 45 # successfully notified about a previous client shutdown. 46 # If there is no /var/db/mounttab, we do nothing. 47 if [ -f /var/db/mounttab ]; then 48 rpc.umntall -k 49 fi 50} 51load_rc_config $name 52 53# no unmounting in svcj 54nfsclient_svcj="NO" 55 56run_rc_command "$1" 57