summaryrefslogtreecommitdiffstats
path: root/utils/nfsd/nfssvc.c
Commit message (Collapse)AuthorAgeFilesLines
* nfsd: allow choosing server 41 support at runtimeJ. Bruce Fields2011-09-201-6/+4
| | | | | | | | | | | | | In the case where -N 4.1 is left off the commandline, the current code explicitly turns it on or off anyway, depending on configure options. Instead, just leave 4.1 support alone. This allows a user to add an "echo +4.1 >/proc/fs/nfsd/versions" to their init scripts, if they want. Otherwise they will get the kernel's default (currently to leave 4.1 off, as long as 4.1 support is experimental). Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Steve Dickson <steved@redhat.com>
* supress socket error when address family is not supportedNeilBrown2011-05-231-2/+7
| | | | | | | | | | | | | | | | | | | | From: Suresh Jayaraman <sjayaraman@suse.de> It was observed that when ipv6 module was not loaded and cannot be auto-loaded, when starting NFS server, the following error occurs: "rpc.nfsd: unable to create inet6 TCP socket: errno 97 (Address family not supported by protocol)" This is obviously a true message, but does not represent an "error" when ipv6 is not enabled. Rather, it is an expected condition. As such, it can be confusing / misleading / distracting to display it in this scenario. This patch instead of throwing error when a socket call fails with EAFNOSUPPORT, makes it as a NOTICE. Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de> Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsd: Enable IPv6 support in rpc.nfsd again.Chuck Lever2010-09-271-9/+0
| | | | | | | | Revert commit b2a3cd59 so that rpc.nfsd can create IPv6 listener sockets for the kernel. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* rpc.nfsd: mount up nfsdfs is it doesn't appear to be mounted yetJeff Layton2010-09-161-3/+49
| | | | | | | | | | | | | | | | | | | | | | | | | There's a bit of a chicken and egg problem when nfsd is run the first time. On Fedora/RHEL at least, /proc/fs/nfsd is mounted up whenever nfsd is plugged in via a modprobe.conf "install" directive. If someone runs rpc.nfsd without plugging in nfsd.ko first, /proc/fs/nfsd won't be mounted and rpc.nfsd will end up using the legacy nfsctl interface. After that, nfsd will be plugged in and subsequent rpc.nfsd invocations will use that instead. This is a problem as some nfsd command-line options are ignored when the legacy interface is used. It'll also be a problem for people who want IPv6 enabled servers. The upshot is that we really don't want to use the legacy interface unless there is no other option. To avoid this situation, have rpc.nfsd check to see if the "threads" file is already present. If it's not, then make an attempt to mount /proc/fs/nfsd. This is a "best-effort" sort of thing, however so we just ignore the return code from the mount attempt and fall back to using nfsctl() if it fails. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Removed warnings from nfssvc.cSteve Dickson2010-08-091-3/+3
| | | | | | | | | | nfssvc.c:184: warning: comparison between signed and unsigned integer expressions nfssvc.c: In function 'nfssvc_setvers': nfssvc.c:254: warning: comparison between signed and unsigned integer expressions nfssvc.c: In function 'nfssvc_threads': nfssvc.c:280: warning: comparison between signed and unsigned integer expressions Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsd: fix version-setting regression on old kernelsJ. Bruce Fields2010-02-041-5/+5
| | | | | | | | | | | | | | | | | /proc/fs/nfsd/versions was extended to allow turning on/off minor versions by echoing "+4.1" or "-4.1" to /proc/fs/nsfd/versions. Unfortunately, pre-2.6.30 kernels just stop parsing at first non-digit, so "-4.1" is interpreted as "-4". If new nfs-utils (on old kernel) writes "+2", "+3", "+4", then "-4.1", result therefore is to turn off 4.1. Given that historical behavior, it may have been a mistake to extend the interface the way we did; but at this point we're probably stuck with it. So, just reverse the order we write versions in. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Steve Dickson <steved@redhat.com>
* Remove the AI_ADDRCONFIG hint flag to getaddrinfo() when it'sSteve Dickson2009-11-121-1/+1
| | | | | | | | | call by nfsd to set up the file descriptors that are sent to the kernel. The flag causes the getaddrinfo() to fail, with EAI_NONAME, when there is not a non-loopback network interface configured. Signed-off-by: Steve Dickson <steved@redhat.com>
* IPv6 support for nfsd was finished before some of the other daemonsJeff Layton2009-09-141-0/+9
| | | | | | | | | (mountd and statd in particular). That could be a problem in the future if someone were to boot a kernel that supports IPv6 serving with an older nfs-utils. For now, hardcode the IPv6 switch into the off position until the other daemons are functional. Signed-off-by: Steve Dickson <steved@redhat.com>
* Allow nfssvc_setfds to properly deal with AF_INET6.Jeff Layton2009-08-141-0/+14
| | | | | | | | IPv6 sockets for knfsd can't be allowed to accept IPv4 packets. Set the correct option to prevent that from occurring on IPv6 sockets. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: convert nfssvc_setfds to use getaddrinfoJeff Layton2009-08-141-73/+140
| | | | | | | | | | | | | | | | | | | Convert nfssvc_setfds to use getaddrinfo. Change the args that it takes and fix up nfssvc function to pass in the proper args. The things that nfssvc has to do to call the new nfssvc_setfds is a little cumbersome for now, but that will eventually be cleaned up in a later patch. nfs-utils: break up the nfssvc interface Currently, the only public interface to the routines in nfssvc.c is nfssvc(). This means that we do an awful lot of work after closing stderr that could be done while it's still available. Add prototypes to the header so that more functions in nfssvc.c can be called individually, and change the nfsd program to call those routines individually. Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: move check for active knfsd to helper functionJeff Layton2009-08-011-14/+30
| | | | | | | | | nfssvc_setfds checks to see if knfsd is already running. Move this check to a helper function. Eventually the nfsd code will call this directly. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: declare a static common buffer for nfssvc.c routinesJeff Layton2009-08-011-11/+17
| | | | | | | | | | Several of the routines in nfssvc.c declare a buffer for strings. Use a shared static buffer instead to keep it off of the stack. Also, the buffer allocated in some places is *really* large. BUFSIZ is generally 8k. These routines don't need nearly that much. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: convert rpc.nfsd to use xlog()Jeff Layton2009-08-011-24/+23
| | | | | | | | | | | | | | | | | | ...and add --debug and --syslog options. With the switch to xlog(), it becomes trivial to add debug messages, so add an option to turn them on when requested. Also, rpc.nfsd isn't a proper daemon per-se, so it makes more sense to log errors to stderr where possible. Usually init scripts take care of redirecting stderr output to syslog anyway. For those that don't, add a --syslog option that forces all output to go to syslog instead. Note that even with this option, errors encountered during option processing will still go to stderr. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: move nfssvc.c to nfsd dir and clean up linking of nfsdJeff Layton2009-08-011-0/+187
rpc.nfsd is the only user of nfssvc.c, so we might as well move it out of libnfs.a. Also, don't link in libexport.a and libmisc.a, they aren't needed. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>