mirror of
https://github.com/opnsense/src.git
synced 2026-03-02 13:20:37 -05:00
PR#254282 reports a problem where nullfs mounts cannot be exported via mountd for FreeBSD 13.0. The problem seems to be that, to do the nullfs mounts in /etc/fstab, they require the "late" mount option, so that the underlying filesystem is mounted (ZFS for the PR). Adding "mountlate" to the REQUIRE list in /etc/rc.d/mountd fixes the problem, but that results in a dependency cycle because /etc/rc.d/lockd specifies: REQUIRE: nfsd BEFORE: DAEMON --> which forces mountd to preceed DAEMON. This patch removes "nfsd" from REQUIRE for lockd and statd, then adds mountlate to REQUIRE for mountd, to fix this problem. Having lockd REQUIRE nfsd was done in the NetBSD code when it was pulled into FreeBSD and there does not seem to be a need for this. In case this causes problems, a long MFC has been specified. PR: 254282 Differential Revision: https://reviews.freebsd.org/D33256 MFC after: 3 months
70 lines
1.6 KiB
Bash
Executable file
70 lines
1.6 KiB
Bash
Executable file
#!/bin/sh
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
|
|
# PROVIDE: mountd
|
|
# REQUIRE: NETWORKING rpcbind quota mountlate
|
|
# KEYWORD: nojail shutdown
|
|
|
|
. /etc/rc.subr
|
|
|
|
name="mountd"
|
|
desc="Service remote NFS mount requests"
|
|
rcvar="mountd_enable"
|
|
command="/usr/sbin/${name}"
|
|
pidfile="/var/run/${name}.pid"
|
|
required_files="/etc/exports"
|
|
start_precmd="mountd_precmd"
|
|
extra_commands="reload"
|
|
|
|
mountd_precmd()
|
|
{
|
|
|
|
# Load the modules now, so that the vfs.nfsd sysctl
|
|
# oids are available.
|
|
load_kld nfsd || return 1
|
|
|
|
# Do not force rpcbind to be running for an NFSv4 only server.
|
|
#
|
|
if checkyesno nfsv4_server_only; then
|
|
echo 'NFSv4 only server'
|
|
sysctl vfs.nfsd.server_min_nfsvers=4 > /dev/null
|
|
sysctl vfs.nfsd.server_max_nfsvers=4 > /dev/null
|
|
rc_flags="${rc_flags} -R"
|
|
else
|
|
force_depend rpcbind || return 1
|
|
if ! checkyesno nfsv4_server_enable; then
|
|
sysctl vfs.nfsd.server_max_nfsvers=3 > /dev/null
|
|
fi
|
|
fi
|
|
|
|
# mountd flags will differ depending on rc.conf settings
|
|
#
|
|
if checkyesno nfs_server_enable || checkyesno nfsv4_server_only; then
|
|
if checkyesno weak_mountd_authentication; then
|
|
if checkyesno nfsv4_server_only; then
|
|
echo -n 'weak_mountd_authentication '
|
|
echo -n 'incompatible with nfsv4_server_only, '
|
|
echo 'ignored'
|
|
else
|
|
rc_flags="${rc_flags} -n"
|
|
fi
|
|
fi
|
|
else
|
|
if checkyesno mountd_enable; then
|
|
checkyesno weak_mountd_authentication && rc_flags="-n"
|
|
fi
|
|
fi
|
|
|
|
if checkyesno zfs_enable; then
|
|
rc_flags="${rc_flags} /etc/exports /etc/zfs/exports"
|
|
fi
|
|
|
|
rm -f /var/db/mountdtab
|
|
( umask 022 ; > /var/db/mountdtab ) ||
|
|
err 1 'Cannot create /var/db/mountdtab'
|
|
}
|
|
|
|
load_rc_config $name
|
|
run_rc_command "$1"
|