summaryrefslogtreecommitdiffstats
path: root/support/include
Commit message (Collapse)AuthorAgeFilesLines
* nfs-utils: Restore ABI compat with pre-merge libnfsidmapJustin Mitchell2017-11-071-1/+1
| | | | | | | | | Prior to merge libnfsidmap leaked many private symbols that were not defined in its API, creating an accidental ABI. This patch renames and unhides symbols in order to match that ABI until a cleaned up API can be established and released. Signed-off-by: Steve Dickson <steved@redhat.com>
* conffile: Add get_str with default valueJustin Mitchell2017-10-261-0/+1
| | | | | | | | | The similar config code in libnfsidmap had one additional feature of a get_str function with a default value option, include an equivalent function here to maintain compatibility. Signed-off-by: Justin Mitchell <jumitche@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* conffile: const-ify the config handling functionsJustin Mitchell2017-10-261-11/+11
| | | | | | | | Tighten up the conffile interface by switching to const arguments where appropriate. Signed-off-by: Justin Mitchell <jumitche@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs.conf: Add function to cleanup and free the loaded configJustin Mitchell2017-06-061-0/+1
| | | | | Signed-off-by: Justin Mitchell <jumitche@rehat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* config: Remove the conf_path globalJustin Mitchell2017-05-051-4/+1
| | | | | | | | Working towards an nfs.conf library and API for system config tools, first step, replace the conf_path global with a parameter to conf_init Signed-off-by: Justin Mitchell <jumitche@rehat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsd: don't enable a UDP socket by defaultJeff Layton2017-04-051-1/+1
| | | | | | | | | | | | | | | | | | | Most major NFS clients have supported TCP for at least a decade now, and v4-only shops are becoming more prevalent. It seems reasonable that serving over UDP should be something that is "opt-in". I've always hesitated to do this in the past, but now that we have nfs.conf, it seems like the time may be right to disable UDP in default configurations. In particular, it would be good to try this in the more bleeding edge distros (Fedora, Ubuntu, SuSE, etc...) and see how problematic it is. Change the default in rpc.nfsd to just open TCP ports by default. Add new -u and -t options that allow users to explicitly override what's in the config file, and update the usage message and manpage. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsd: Allow the caller to turn off NFSv4.0 without turning off NFSv4.xTrond Myklebust2017-04-051-2/+5
| | | | | | | | | | | | The new semantic is that '-N4' turns off all NFSv4 minor versions, while '-V4' turns them all on. In order to turn off just minor version x (x >= 0), use -N4.x, and to turn it back on. '-V4.x'. Note that on older kernels, attempting to use -N4.0 and -V4.0 is equivalent to specifying -N4 or -V4. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd/exportfs: implement the -s/--state-directory-path optionScott Mayhew2017-02-151-18/+17
| | | | | | Reviewed-by: NeilBrown <neilb@suse.com> Signed-off-by: Scott Mayhew <smayhew@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libnsm.a: refactor nsm_setup_pathnames() and nsm_make_pathname()Scott Mayhew2017-02-151-0/+3
| | | | | | | | | | Move the logic in nsm_setup_pathnames() and nsm_make_pathname() to similar generic functions in libmisc.a so that the exportfs and rpc.mountd programs can make use of them later. Reviewed-by: NeilBrown <neilb@suse.com> Signed-off-by: Scott Mayhew <smayhew@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* exportfs: support "security_label" export optionJ. Bruce Fields2017-01-121-1/+2
| | | | | | | | On recent kernels only exports with NFSEXP_SECURITY_LABEL set will export security labels. Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* xlog: Add common support for "debug=??" in /etc/nfs.confNeilBrown2016-12-201-0/+1
| | | | | | | | The value is from the list general, call, auth, parse, all. Most daemons recognise this in their dedicated section. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* conffile: add bool supportNeilBrown2016-12-201-0/+2
| | | | | | | | conf_get_bool() interprets various strings as 'true' or 'false'. If no suitable value is found, the default is returned. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Remove all use of the nfsctl system call.NeilBrown2016-12-063-143/+0
| | | | | | | | | | | | | | | | | | | | This systemcall was deprecated early in the 2.6 series as it was replaced by an in-kernel cache which was refilled using an upcall. All communication to kernel is now through the nfsd filesystem. The nfsctl systemcall itself was removed in 3.1. It is unlikely to have been used for over a decade. To remove all uses for the nfsctl systemcall, and call code that only runs when "new_cache" is false. We now assume "new_cache" is always true. This allows the removal of several files as well as assorted functions. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Remove all use of /var/lib/nfs/xtabNeilBrown2016-11-152-12/+1
| | | | | | | | | | | | | | | /var/lib/nfs/xtab is only used to find out what has been exported to the kernel. This is more reliably done by reading /proc/fs/nfs{,d}/export and nfs-utils uses that file if is available. So xtab is only need if you have an incredibly ancient kernel which doesn't have /proc/fs/nfs/export (and so which only supports NFSv2) or if /proc is not mounted. Neither of these are credible contexts to run a modern nfs-utils, so stop creating or reading the xtab file. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-server-generator: avoid using external services.NeilBrown2016-11-071-2/+2
| | | | | | | | | | | | | | | | | | | nfs-server-generator is run very early when a lot of services are not yet started, so it mustn't depend on them. Currently it can try to use hostname lookup and syslog. Using hostname lookup can cause errors and when these are logged via syslog, it can cause the generator to block indefinitely Hostname-lookup is not needed, as we don't use the host issue, and sending message to stderr is sufficient for the generator. Disabling syslog is easy - call a function that sets a static variable. Disabling hostname lookup requires adding an "ignore_hosts" flags to export_read and export_d_read(). Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Move export_d_read() to support/export/export.cNeilBrown2016-08-201-0/+1
| | | | | | | | This places it in the same place as the similar export_read(), and allows it to be called from other programs. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* statd: suppress a benign log message in nsm_delete_host()Scott Mayhew2016-06-211-1/+2
| | | | | | | | | | | | | | | | | | Commit 76f8ce8c (statd: Update existing record if we receive SM_MON with new cookie) added some logic to unconditionally delete some existing on-disk monitor records. That works fine in an HA-NFS setup where there's a good chance of monitor files being left around after service failovers, but in the case where there isn't an existing monitor file statd emits a scary looking message like this: Jun 15 14:14:59 hostname rpc.statd[1368]: Failed to delete: could not stat original file /var/lib/nfs/statd/sm/nfs.smayhew.test: No such file or directory That message can be suppressed. Signed-off-by: Scott Mayhew <smayhew@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* fix building w/newer C librariesMike Frysinger2016-04-271-0/+6
| | | | | | | | | | | | | | Linux C libraries are moving away from implicitly including the header sys/sysmacros.h via sys/types.h. We would like to do this for glibc now, but others (musl/etc...) have been doing it already. This means any code using major/minor/makedevs functions will fail to build when they don't include that header. Leverage the AC_HEADER_MAJOR macro that configure is already using to pull in the right header. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Steve Dickson <steved@redhat.com>
* statd: Don't unregister statd service on failing to execute calloutToshiaki Makita2016-03-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | statd calls atexit(statd_unregister) to unregister statd service on exit, which actually has a side-effect that ha_callout() unregisters statd service even when the child callout process exits on execl() failure. Certain clustering software's deployment script adds -H option with its specified file non-existent, when it is configured not to use callout. In other words, -H seems to be used no matter if callout is needed or not, but when callout is unnecessary, the specified callout program is not deployed. This causes statd not to work once a lock is requested by its NFS client, as execl() in ha_callout() results in ENOENT and exit() of the child process calls exit-handler statd_unregister(). Eventually, the NFS client gets stuck with messages "lockd: cannot monitor xxx" on the NFS server. Also, execl() could fail for other reasons like ENFILE or EIO as well. A forked child must not unregister the statd RPC server, so use _exit(), which does not call any exit-handlers, instead of exit(). Reviewed-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp> Signed-off-by: Steve Dickson <steved@redhat.com>
* Allow gssd and svcgssd to set the libtirpc debug levelScott Mayhew2015-11-021-0/+3
| | | | | | | | The interface for controlling the debug level in libtirpc was added over a year ago, but nothing's taking advantage of it. Signed-off-by: Scott Mayhew <smayhew@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: add support for the "pnfs" export optionChristoph Hellwig2015-04-021-0/+1
| | | | | | | | This goes along with the patch just sent to Bruce to make pnfs support conditional. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* cleanup daemonization codeDavid Hardeman2015-01-231-2/+3
| | | | | | | | | | | | | | | The daemonization init/ready functions have parameters that are never used, require the caller to keep track of some pipefds that it has no interest in and which might not be used in some scenarios. Cleanup both functions a bit. The idea here is also that these two functions might be good points to insert more systemd init code later (sd_notify()). Also, statd had a private copy of the daemonization code for unknown reasons...so make it use the generic version instead. Signed-off-by: David H?rdeman <david@hardeman.nu> Signed-off-by: Steve Dickson <steved@redhat.com>
* Fix up issue with "make dist"NeilBrown2014-12-071-0/+5
| | | | | | | | | | | | | Add mention of new files, remove mention of old files, and cause "make dist" to create something very similar to the current distributions. systemd files are not currently included in "make dist" and some files generated by "rpcgen" are (though they aren't in official distribution). Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfslib: remove now unused FILE helpersTimo Teräs2014-12-071-7/+0
| | | | | | | All access to kernel is now done using file descriptors. Signed-off-by: Timo Ter?s <timo.teras@iki.fi> Signed-off-by: Steve Dickson <steved@redhat.com>
* Add string.h to source files that need itTimo Teräs2014-12-072-0/+2
| | | | Signed-off-by: Steve Dickson <steved@redhat.com>
* exportfs: warn when really nothing is exportedPavel Raiskup2014-12-031-1/+1
| | | | | | | | | | | | Throw 'No file systems exported!' iff no volume is exported rather then if some exports file is empty. Typically this can happen if the default /etc/exports file is empty and admin installed configuration into /etc/exports.d directory. This is follow-up for e725def62c73b4 commit. Signed-off-by: Pavel Raiskup <praiskup@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* exportfs: Do not fail on empty exports file.Steve Dickson2014-11-171-1/+1
| | | | | | | | | | Commit 076dd80 introduced a regression that causes exportfs to fail when there is an empty /etc/exports file. A empty /etc/exports file is valid and should not cause exportfs to fail. Signed-off-by: Steve Dickson <steved@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* rpc.mountd: set nonblocking mode if no libtirpcBodo Stroesser2014-11-121-0/+1
| | | | | | | | | | | | | If mountd is built without libtirpc and it is started using "-p XXX" option, the tcp listeners and the sockets waiting for UDP messages are not in non-blocking mode. Thus if running with multiple threads (-t XX), all threads will wake up from select on a connection request or a UDP message, but only one thread will succeed. All others will wait on accept() or read() for the next event. Reviewed-by: NeilBrown <neilb@suse.de> Signed-off-by: Bodo Stroesser <bstroesser@ts.fujitsu.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* replace __attribute_malloc__ with the more portable __attribute__((__malloc__))Natanael Copa2014-09-151-5/+5
| | | | | Signed-off-by: Natanael Copa <ncopa@alpinelinux.org> Signed-off-by: Steve Dickson <steved@redhat.com>
* Fix header include for definition of NULLNatanael Copa2014-09-151-0/+1
| | | | | | | NULL is defined in stdlib.h so we need to include that. Signed-off-by: Natanael Copa <ncopa@alpinelinux.org> Signed-off-by: Steve Dickson <steved@redhat.com>
* conffile: use standard uint*_t and unsigned charNatanael Copa2014-09-151-1/+2
| | | | | | | Use the standard integer types. This fixes compiling errors with musl libc. Signed-off-by: Natanael Copa <ncopa@alpinelinux.org> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: Allow turning off nfsv3 readdir_plusRajesh Ghanekar2014-08-201-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | One of our customer's application only needs file names, not file attributes. With directories having 10K+ inodes (assuming buffer cache has directory blocks cached having file names, but inode cache is limited and hence need eviction of older cached inodes), older inodes are evicted periodically. So if they keep on doing readdir(2) from NSF client on multiple directories, some directory's files are periodically removed from inode cache and hence new readdir(2) on same directory requires disk access to bring back inodes again to inode cache. As READDIRPLUS request fetches attributes also, doing getattr on each file on server, it causes unnecessary disk accesses. If READDIRPLUS on NFS client is returned with -ENOTSUPP, NFS client uses READDIR request which just gets the names of the files in a directory, not attributes, hence avoiding disk accesses on server. There's already a corresponding client-side mount option, but an export option reduces the need for configuration across multiple clients. This flag affects NFSv3 only. If it turns out it's needed for NFSv4 as well then we may have to figure out how to extend the behavior to NFSv4, but it's not currently obvious how to do that. Signed-off-by: Rajesh Ghanekar <rajesh_ghanekar@symantec.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsidmap: fix error reporting for nfs4_* family of functionsMateusz Guzik2014-03-111-0/+1
| | | | | | | | | | Errors were logged with xlog_err function relying on errno, but these functions don't set it. Fix the problem by introducing xlog_errno which set errno Signed-off-by: Mateusz Guzik <mguzik@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsd: support NFS4_MAXMINOR up to the number an unsigned int can keepSteve Dickson2014-02-131-1/+2
| | | | | | | | | | | | | | | | | | | This implementation allows specifying NFS4 minor version numbers up to the number of bits available in int data type (typically 32 on Linux) This is based on an idea mentioned by J. Bruce Fields <bfields@fieldses.org> mentioned on the linux-nfs mailing list. I changed the data type back from an array to two bit fields, one for storing whether the minor version was specified on the command line and the second one for storing whether it was set or unset. This change was done to prevent blowing up the allocated stack space in an unnecessary fashion. Acked-by: J. Bruce Fields <bfields@fieldses.org> Signed-off-by: Robert Schiele <rschiele@gmail.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsd: fix minorversion-choosing interfaceJ. Bruce Fields2014-01-071-1/+0
| | | | | | | | | | | | | | | | | | | | From: "J. Bruce Fields" <bfields@redhat.com> By unconditionally adding ?4.2 to the version string written to the kernel we make nfs-utils incompatible with pre-4.2-supporting kernels. Ditto for 4.1. This problem was introduced by 12a590f8d556c00a9502eeebaa763d906222d521 "rpc.nfsd: Allow v4.2 server support with the -V option", which also change nfsd to unconditionally pass ?4.2. Instead, just don't mention 4.1 or 4.2 unless the commandline has specifically requested that one or the other be turned on or off. Tested-by: Joakim Tjernlund <joakim.tjernlund@transmode.se> Reported-by: Joakim Tjernlund <joakim.tjernlund@transmode.se> Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: consolidate mydaemon() and release_parent() implementationsJeff Layton2013-11-201-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | We currently have 2 cut-and-paste versions of this code. One for idmapd and one for svcgssd.[1] The two are basically equivalent but there are some small differences, mostly related to how errors in that function are logged. svcgssd uses printerr() with a priority of 1, which only prints errors if -v was specified. That doesn't seem to be quite right. Daemonizing errors are necessarily fatal and should be logged as such. The one for idmapd uses err(), which always prints to stderr even though we have the xlog facility set up. Since both have xlog configured at this point, log the errors using xlog_err() instead. The only other significant difference I see is that the idmapd version will open "/" if it's unable to open "/dev/null". I believe that however was a holdover from an earlier version of that function that did not error out when we were unable to open a file descriptor. Since the function does that now, I don't believe we need that fallback anymore. [1]: technically, we have a third in statd too, but it's different enough that I don't want to touch it here. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Use protocol bit fields to turn protocols off.Steve Dickson2013-11-051-1/+1
| | | | | | | Convert the current code to used the NFSCTL_XXX macros to turn off the TCP listener. Signed-off-by: Steve Dickson <steved@redhat.com>
* exportfs: exit with error code if there was any error (take 2).NeilBrown2013-11-052-3/+1
| | | | | | | | | | | | | | | | | exportfs currently exits with a non-zero error for some errors, but not for others. It does this by having various support routines set the global variable "export_errno". Change this to have 'xlog' set export_errno if an ERROR is reported. That way all errors will be caught. Note that the exit error code is changed from 22 (EINVAL) to the more traditional '1'. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: dont pass options from configuration sections that are not relevantScott Mayhew2013-08-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | The nfsmount.conf file has the following format: [ section "arg" ] tag = value conf_get_tag_list() currently doesn't check the arg field so we wind up getting all the options that fall under a particular section value, instead of just the ones that match the specific "arg" field. As a result, we wind up passing options to the mount syscall from sections that aren't even relevant to the mount operation that is being performed. For example, if we have three different server sections, and each section has an Nfsvers tag, then the string we pass to the mount syscall will have two extra occurrences of the nfsvers option. Each option should appear at most 4 times -- once for the system section, once for the server-specific section, once for the mount-specific section, and once for the command line mount options. Acked-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Scott Mayhew <smayhew@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* rpc.nfsd: Allow v4.2 server support with the -V optionSteve Dickson2013-08-191-0/+4
| | | | Signed-off-by: Steve Dickson <steved@redhat.com>
* rpc.nfsd: No longer advertise NFS v2 support.Steve Dickson2013-08-191-0/+1
| | | | | | | | | Changed the default protocol versions that rpc.nfsd register with rpcbind to just 3 and 4. Version 2 can still be enabled with the '-V' flag, but it will not be on by default. Signed-off-by: Steve Dickson <steved@redhat.com>
* statd: exit if a statd is already runningWeston Andros Adamson2013-05-071-0/+5
| | | | | | | | Moves nfs_probe_statd from mount to nfs support lib to share with statd. Acked-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Weston Andros Adamson <dros@netapp.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: fix exporting of "/" with sec= setting.NeilBrown2013-04-221-0/+1
| | | | | | | | | | | | | | | | Commit 91bb95f2689e84856ecdf6fac365489d36709cf9 4set_root: force "fsid=0" for all exports of '/' set NFSEXP_FSID for the export of "/" if nothing else had any fsid set, however it didn't also set the flag for all security flavours. So the kernel complains that the flags on the security flavours don't match and it rejects the export. So call fix_pseudoflavor_flags() in write_secinfo() to make sure that any fiddling that has been done to e_flags gets copied to e_secinfo. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsd: Add support for the -V and --nfs-version optional argumentsTrond Myklebust2013-03-251-0/+1
| | | | | | | | | | Add command line options to enable those NFS versions that are currently disabled by default. We choose to use the options '-V' and '--nfs-version' for compatibility with rpc.mountd. Acked-by: J. Bruce Fields <bfields@fieldses.org> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* configure: check for libio.h availabilityMike Frysinger2013-03-251-0/+6
| | | | | | | | On some systems (like uClibc), there isn't a libio.h header. But it isn't also needed on them. So check for the header first. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Avoid unnecessary type conversionsChuck Lever2012-10-301-0/+1
| | | | | | | | | Removed a number of Wconversion warnings in the mountd code. Took the opportunity to eliminate some code duplication. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: Eliminate dereferencing type punned pointersChuck Lever2012-10-301-6/+4
| | | | | | | | | | Removed a number of Wstrict-aliasing warnings Note also that site-local IPv6 addresses are deprecated, and thus are no longer encountered. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Add exportent_release()Chuck Lever2012-10-221-0/+1
| | | | | | | | | Split out the logic that releases dynamically allocated data in an exportent. The junction resolution code will invoke this to clean up the junction exportent once it has been dumped to the kernel. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* rpcdebug: Add new "state" flag for the nfs moduleChuck Lever2012-06-191-0/+1
| | | | | | | | Kernel 3.5 adds a debugging flag for showing NFS client debugging messages having to do with NFSv4 state operations. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsdcld: add client tracking daemon stubJeff Layton2012-04-261-0/+56
| | | | | | | | | | | | This program opens and "listens" on the new nfsd/cld rpc_pipefs pipe. The code here doesn't actually do anything on stable storage yet. That will be added in a later patch. The patch also adds a autoconf enable switch for the new daemon that defaults to "no", and a test for the upcall description header file. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>