SGI 904217 (2/2): allow enabling TCP without recompile
Subsystems (2)
PATCH 1/1 SGI 904217 (2/2): allow enabling TCP without recompile
G'day,
These two patches Linux systems to be shipped with CONFIG_NFSD_TCP=y but TCP support disabled at runtime until the sysadmin edits the /etc/sysconfig/nfs file and restarts NFS. The idea is that TCP support is still disabled by default, but can be enabled with less pain than currently is the case (we have customers who want to try it).
The second patch is for nfs-utils and adds a -t option to nfsd which uses the new nfsctl (added in the first patch) to enable specific transports, and the infrastructure to allow the sysadmin to specify it easily. Default is to enable UDP only for compatibility.
A word about the syntax of the -t option: yes it's verbose specifying the transport names in full, but the idea is to allow it to grow to handle NFS over IPv6 in the distant future.
diff -Naur --exclude-from=nfs-utils.exclude nfs-utils-1.0.6.orig/etc/redhat/nfs nfs-utils-1.0.6.work/etc/redhat/nfs
etc/redhat/nfs +5 -0
@@ -23,6 +23,11 @@ # might be needed to handle heavy client traffic) # NFSDCOUNT=8 +# Enable UDP and TCP transports for NFS. Uncomment if you +# want to enable TCP (as UDP is enabled by default). Note +# that TCP support is still considered EXPERIMENTAL. +# NFSD_TRANSPORTS="udp,tcp" + # Increase the memory limits on the socket input queues for # the nfs processes .. NFS benchmark SPECsfs demonstrate a # need for a larger than default size (64kb) .. setting
diff -Naur --exclude-from=nfs-utils.exclude nfs-utils-1.0.6.orig/etc/redhat/nfs.init nfs-utils-1.0.6.work/etc/redhat/nfs.init
etc/redhat/nfs.init +5 -1
@@ -38,6 +38,10 @@ # Number of servers to be started by default [ -z "$NFSDCOUNT" ] && NFSDCOUNT=8 +# NFS transports to be enabled +TRANSP= +[ -n "$NFSD_TRANSPORTS" ] && TRANSP="-t $NFSD_TRANSPORTS" + # Remote quota server [ -z "$RQUOTAD" ] && RQUOTAD=`type -path rpc.rquotad`
@@ -66,7 +70,7 @@ echo fi echo -n "Starting NFS daemon: " - daemon rpc.nfsd $NFSDCOUNT + daemon rpc.nfsd $TRANSP $NFSDCOUNT echo [ -n "$MOUNTD_PORT" ] \
diff -Naur --exclude-from=nfs-utils.excludenfs-utils-1.0.6.orig/support/include/nfs/nfs.hnfs-utils-1.0.6.work/support/include/nfs/nfs.h
support/include/nfs/nfs.h +9 -0
@@ -35,6 +35,7 @@#define NFSCTL_GETFH 6/* get an fh (used by mountd) */ #define NFSCTL_GETFD 7/* get an fh by path (used by mountd) */ #define NFSCTL_GETFS 8/* get an fh by path with max size (used by mountd) */ +#define NFSCTL_TRANSPORT 9/* {en,dis}able transport(s) */ /* Above this is for lockd. */ #define NFSCTL_LOCKD 0x10000
@@ -113,6 +114,12 @@int gd_maxlen; }; +/* TRANSPORT - enable or disable one or all transports */ +struct nfsctl_transport { +int tr_enable;/* 1=enable 0=disable */ +char tr_name[32 ];/* name or "" for all transports */ +}; +/* * This is the argument union. */
@@ -126,6 +133,7 @@struct nfsctl_fhparm u_getfh;struct nfsctl_fdparm u_getfd;struct nfsctl_fsparm u_getfs; +struct nfsctl_transport u_transport; } u;#define ca_svc u.u_svc#define ca_client u.u_client
@@ -135,6 +143,7 @@#define ca_getfd u.u_getfd#define ca_getfs u.u_getfs#define ca_authd u.u_authd +#define ca_transport u.u_transport };union nfsctl_res {
diff -Naur --exclude-from=nfs-utils.excludenfs-utils-1.0.6.orig/support/include/nfslib.hnfs-utils-1.0.6.work/support/include/nfslib.h
support/include/nfslib.h +1 -0
@@ -123,6 +123,7 @@struct nfs_fh_len *getfh_old (struct sockaddr *addr,dev_t dev,ino_t ino);struct nfs_fh_len *getfh (struct sockaddr *addr,const char *);struct nfs_fh_len *getfh_size (struct sockaddr *addr,const char *,int size); +int nfstransport (const char *name,int enable);void qword_print (FILE *f,char *str);void qword_printhex (FILE *f,char *str,int slen);
diff -Naur --exclude-from=nfs-utils.exclude nfs-utils-1.0.6.orig/support/nfs/Makefile nfs-utils-1.0.6.work/support/nfs/Makefile
support/nfs/Makefile +1 -1
@@ -6,7 +6,7 @@ OBJS = exports.o rmtab.o xio.o \ rpcmisc.o rpcdispatch.o xlog.o xmalloc.o wildmat.o \ nfssvc.o nfsclient.o nfsexport.o getfh.o nfsctl.o \ - lockdsvc.o svc_socket.o cacheio.o + lockdsvc.o svc_socket.o cacheio.o nfstransport.o include $(TOP)rules.mk
diff -Naur --exclude-from=nfs-utils.excludenfs-utils-1.0.6.orig/support/nfs/nfstransport.cnfs-utils-1.0.6.work/support/nfs/nfstransport.c
support/nfs/nfstransport.c +33 -0
@@ -0,0 +1,33 @@ +/* +* support/nfs/nfstransport.c +* +* Enable or disable one or all RPC transports. +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2003 Silicon Graphics Inc. All rights reserved. +* +* Derived from nfssvc.c which bore the message: +* Copyright (C) 1995, 1996 Olaf Kirch <[email protected]> +*/ + +#include "config.h" + +#include "nfslib.h" + +int +nfstransport (const char *name,int enable) +{ +struct nfsctl_arg arg; + +memset (&arg,0 ,sizeof (arg)); + arg.ca_version =NFSCTL_VERSION ; + arg.ca_transport.tr_enable = enable; +if (name !=NULL ) +strncpy (arg.ca_transport.tr_name, name, +sizeof (arg.ca_transport.tr_name)); +return nfsctl (NFSCTL_TRANSPORT , &arg,NULL ); +} +
diff -Naur --exclude-from=nfs-utils.exclude nfs-utils-1.0.6.orig/utils/nfsd/nfsd.c nfs-utils-1.0.6.work/utils/nfsd/nfsd.c
utils/nfsd/nfsd.c +55 -2
91 lines not on this page · raw message
diff -Naur --exclude-from=nfs-utils.exclude nfs-utils-1.0.6.orig/utils/nfsd/nfsd.man nfs-utils-1.0.6.work/utils/nfsd/nfsd.man
utils/nfsd/nfsd.man +11 -1
@@ -6,7 +6,7 @@ .SH NAME rpc.nfsd \- NFS server process .SH SYNOPSIS -.BI "/usr/sbin/rpc.nfsd [-p " port "] " nproc +.BI "/usr/sbin/rpc.nfsd [-p " port "] [-t " transport "] " nproc .SH DESCRIPTION The .B rpc.nfsd
@@ -27,6 +27,16 @@ .B rpc.nfsd will listen on port 2049. .TP +.BI \-t " transport" +specify a comma-separated list of transports to listen on for NFS +requests. Possible transport names are +.B udp +and +.B tcp +(if the kernel is configured to support NFS over TCP). By default, +.B rpc.nfsd +will listen on UDP only. +.TP .I nproc specify the number of NFS server threads. By default, just one thread is started. However, for optimum performance several threads
Greg.
Signature · 12 lines
Greg Banks, R&D Software Engineer, SGI Australian Software Group. I don't speak for SGI. ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ NFS maillist - [email protected] https://lists.sourceforge.net/lists/listinfo/nfs
Quoted 8 lines · Greg Banks
These two patches Linux systems to be shipped with
CONFIG_NFSD_TCP=ybut TCP support disabled at runtime until the sysadmin edits the/etc/sysconfig/nfsfile and restarts NFS. The idea is that TCP support is still disabled by default, but can be enabled with less pain than currently is the case (we have customers who want to try it).
Why disable it? Since UPD is still mountd's default transport..
Quoted 6 lines
The second patch is for nfs-utils and adds a -t option to nfsd which uses the new nfsctl (added in the first patch) to enable specific transports, and the infrastructure to allow the sysadmin to specify it easily. Default is to enable UDP only for compatibility.
This seems a bit messy.... Why not just turn on TCP and have nfsd listen on both types of transports?
SteveD.
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
Quoted 11 lines · Steve Dickson
Quoted 8 lines · Greg Banks
These two patches Linux systems to be shipped with
CONFIG_NFSD_TCP=ybut TCP support disabled at runtime until the sysadmin edits the/etc/sysconfig/nfsfile and restarts NFS. The idea is that TCP support is still disabled by default, but can be enabled with less pain than currently is the case (we have customers who want to try it).
Quoted 1 line
Why disable it? Since UPD is still mountd's default transport..
This depends on client options outside the scope of the patch, e.g. how the client's fstab or autofs is configured. Some clients will try TCP first and then fall back to UDP when it fails; if the TCP mount suddenly starts working, that's a visible change.
Quoted 8 lines
Quoted 6 lines
The second patch is for nfs-utils and adds a -t option to nfsd which uses the new nfsctl (added in the first patch) to enable specific transports, and the infrastructure to allow the sysadmin to specify it easily. Default is to enable UDP only for compatibility.
This seems a bit messy.... Why not just turn on TCP and have nfsd listen on both types of transports?
I don't want to perturb the way in which bits flow across the wire without the sysadmin's explicit intervention. This is purely a support issue, not a technical one.
Greg.
Signature · 12 lines
Greg Banks, R&D Software Engineer, SGI Australian Software Group. I don't speak for SGI. ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ NFS maillist - [email protected] https://lists.sourceforge.net/lists/listinfo/nfs