Switch the default NFS mount mode from UDP to TCP. UDP mounts are a

historical relic, and are no longer appropriate for either LAN or WAN
mounting.  At modern (gigabit and 10 gigabit) LAN speeds packet loss
from socket buffer fill events is common, and sequence numbers wrap
quickly enough that data corruption is possible.  TCP solves both of
these problems without imposing significant overhead.

MFC after:     1 month
This commit is contained in:
Kris Kennaway 2008-02-11 23:23:21 +00:00
parent 559921043b
commit 2427fa1998
4 changed files with 14 additions and 8 deletions

View File

@ -22,6 +22,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8.x IS SLOW:
to maximize performance. (To disable malloc debugging, run
ln -s aj /etc/malloc.conf.)
20080211:
The default NFS mount mode has changed from UDP to TCP for
increased reliability. If you rely on (insecurely) NFS
mounting across a firewall you may need to update your
firewall rules.
20080208:
Belatedly note the addition of m_collapse for compacting
mbuf chains.

View File

@ -142,11 +142,11 @@ The default is a retry count of zero, which means to keep retrying
forever.
There is a 60 second delay between each attempt.
.It Fl T
Use TCP transport instead of UDP.
This is recommended for servers that are not on the same LAN cable as
the client.
Not all NFS servers support this method, especially older ones;
caution should be observed in these cases.
Use TCP transport.
This is the default option, as it provides for increased reliability on both
LAN and WAN configurations compared to UDP.
Some old NFS servers do not support this method; UDP mounts may be required
for interoperability.
.It Fl U
Force the mount protocol to use UDP transport, even for TCP NFS mounts.
(Necessary for some old

View File

@ -155,7 +155,7 @@ struct nfs_args nfsdefargs = {
NFS_ARGSVERSION,
NULL,
sizeof (struct sockaddr_in),
SOCK_DGRAM,
SOCK_STREAM,
0,
NULL,
0,

View File

@ -204,8 +204,8 @@ nfs_setup_diskless(void)
/* set up root mount */
nd->root_args.rsize = 8192; /* XXX tunable? */
nd->root_args.wsize = 8192;
nd->root_args.sotype = SOCK_DGRAM;
nd->root_args.flags = (NFSMNT_WSIZE | NFSMNT_RSIZE | NFSMNT_RESVPORT);
nd->root_args.sotype = SOCK_STREAM;
nd->root_args.flags = (NFSMNT_NFSV3 | NFSMNT_WSIZE | NFSMNT_RSIZE | NFSMNT_RESVPORT);
if (inaddr_to_sockaddr("boot.nfsroot.server", &nd->root_saddr)) {
printf("nfs_diskless: no server\n");
return;