freebsd-skq/sys/nfs
Ian Lepore 6cbd933b37 Changes to allow using BOOTP_NFSROOT and mounting an nfs root filesystem
other than the one specified by the BOOTP server.  This configures NFS
using the BOOTP protocol while also respecting other root-path options such
as setting vfs.root.mountfrom in the environment or using the RB_DFLTROOT
boot option.  It allows you to override the root path provided by the
server, or to supply a root path when the server provides IP configuration
but no root path info.

This maintains the historical BOOTP_NFSROOT behavior of panicking on a
failure to mount the root path provided by the server, unless you've
provided an alternative via the ROOTDEVNAME kernel option or by setting
vfs.root.mountfrom.  The behavior of panicking when given no other options
is preserved because it amounts to a bit of a retry loop that could
eventually recover from a transient network or server problem.

The user can now override the root path from loader(8) even if the
kernel is compiled with BOOTP_NFSROOT.  If vfs.root.mountfrom is set in
the environment it is used unconditionally -- it always overrides the
BOOTP info.  If it begins with [old]nfs: then the BOOTP code uses it
instead of the server-provided info.  If it specifies some other
filesystem then the bootp code will not panic like it used to and the code
in vfs_mountroot.c will invoke the right filesystem to do the mount.

If the kernel is compiled with the ROOTDEVNAME option, then that name is
used by the BOOTP code if either
      * The server doesn't provide a pathname.
      * The boothowto flags include RB_DFLTROOT.
The latter allows the user to compile in alternate path in ROOTDEVNAME
such as ufs:/dev/da0s1a and boot from that path by setting
boot_dftlroot=1 in loader(8) or using the '-r' option in boot(8).

The one thing not provided here is automatic failover from a
server-provided path to a compiled-in one without the user manually
requesting that.  The code just isn't currently structured in a way that
makes that possible with a lot of rewrite.  I think the ability to set
vfs.root.mountfrom and to use ROOTDEVNAME automatically when the server
doesn't provide a name covers the most common needs.

A set of patches submitted by Lars Eggert provided the part I couldn't
figure out by myself when I tried to do this last year; many thanks.

Reviewed by:	rodrigc
2013-07-31 19:14:00 +00:00
..
bootp_subr.c Changes to allow using BOOTP_NFSROOT and mounting an nfs root filesystem 2013-07-31 19:14:00 +00:00
krpc_subr.c Functions m_getm2() and m_get2() have different order of arguments, 2013-03-12 13:42:47 +00:00
krpc.h
nfs_common.c Use m_get() and m_getcl() instead of compat macros. 2013-03-15 10:21:18 +00:00
nfs_common.h Remove the unused nfs_curusec(). 2013-01-17 19:03:24 +00:00
nfs_diskless.c
nfs_fha.c Move the NFS FHA (File Handle Affinity) code from sys/nfsserver to 2013-04-17 22:42:43 +00:00
nfs_fha.h Move the NFS FHA (File Handle Affinity) code from sys/nfsserver to 2013-04-17 22:42:43 +00:00
nfs_kdtrace.h
nfs_lock.c
nfs_lock.h
nfs_mountcommon.h
nfs_nfssvc.c
nfsdiskless.h
nfsproto.h
nfssvc.h
xdr_subs.h