freebsd-dev/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 Fix the experimental NFS client so that it does not bogusly 2011-04-25 22:22:51 +00:00
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 Implemented a mount option "nocto" that disables cache coherency 2011-05-04 13:27:45 +00:00
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 Move sys/nfsclient/nfs_kdtrace.h to sys/nfs/nfs_kdtrace.h so 2011-05-06 20:02:19 +00:00
nfs_lock.c Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs. 2011-11-07 06:44:47 +00:00
nfs_lock.h Modify the NFS clients and the NLM so that the NLM can be used 2010-10-19 00:20:00 +00:00
nfs_mountcommon.h Fix the nlm so that it no longer depends on the regular 2011-01-03 20:37:31 +00:00
nfs_nfssvc.c Add an nfssvc() option to the kernel for the new NFS client 2012-12-02 01:16:04 +00:00
nfsdiskless.h Fix the experimental NFS client so that it does not bogusly 2011-04-25 22:22:51 +00:00
nfsproto.h
nfssvc.h Add an nfssvc() option to the kernel for the new NFS client 2012-12-02 01:16:04 +00:00
xdr_subs.h