exportfs: Update exportfs flush option list in usage message. Update exportfs flush option list in usage message. And sorted these cases in alphabetical order. Signed-off-by: Steve Dickson <steved@redhat.com>
exportfs: Removed warnings about routines not being prototyped Signed-off-by: Steve Dickson <steved@redhat.com>
exportfs: Stop racing exportfs on clusters This problem can occur when multiple cluster services fail over at the same time, causing missing high-available exports. Having a lot of nfs-exports will trigger this issue easier. https://bugzilla.linux-nfs.org/show_bug.cgi?id=224 Signed-off-by: Steve Dickson <steved@redhat.com>
exportfs: do not warn if /etc/exports.d/ does not exist It isn't uncommon for /etc/exports.d/ to not exist, and imo, it's not that big of a deal as often times, a simple /etc/exports is sufficient. So silently skip the case where the dir is missing. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Steve Dickson <steved@redhat.com>
exportfs: drop extra newline in xlog Since xlog() itself appends a newline, we don't want to add our own otherwise we get extra in the output. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Steve Dickson <steved@redhat.com>
exportfs: matchhostname() doesn't handle localhost properly Same change as statd_matchhostname() is necessary for the logic in exportfs. Recall that these are "separate but nearly equal" because the exportfs version requires extra expensive string checking that would be onerous for statd. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
Removed a warning from exportfs.c exportfs.c:280:29: warning: 'exp' may be used uninitialized in this function Signed-off-by: Steve Dickson <steved@redhat.com>
Read /etc/exports.d/*.export as extra export files This patch adding a capability to read /etc/exports.d/*.exports as extra export files to exportfs. If one wants to add or remove an export entry in a script, currently one may have to use sed or something tool for adding or removing the line for the entry in /etc/exports file. With the patch, adding and removing an entry from a script is much easier. cat<<EOF... or mv can be used for adding. rm can be used for removing. Signed-off-by: Masatake YAMATO <yamato@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
exportfs: Enable IPv6 support in matchhostname() To gain IPv6 support in matchhostname(), simply replace the socket address comparison helpers with the generic versions that can handle IPv4 and IPv6. host_addrinfo() (called by matchhostname()) returns IPv6 addresses only if IPv6 support is enabled. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
exportfs: Use xlog() for error reporting exportfs already invokes xlog_open() because libexport.a uses xlog() exclusively for error reporting and debugging messages. If we can use xlog() throughout exportfs itself, that enables xlog debugging messages everywhere in the code path. In addition, use xlog() instead of fprintf(stderr) for reporting errors in exportfs.c, to be consistent with libexport.a and other components of nfs-utils. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
exportfs: exportfs.c no longer needs #include "xmalloc.h" Clean up: No calls to xmalloc() or xstrdup() here. No need for the double #include of xmalloc.h. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
libexport.a: Replace matchhostname() So that exportfs can eventually support IPv6 addresses, copy statd's getaddrinfo(3)-based matchhostname to exportfs, with adjustments for dealing with export wildcards and netgroups. Until exportfs has full IPv6 support, however, we want to ensure that IPv6 addresses continue to remain blocked in the address comparison code used by exportfs. At a later point we'll replace much of this with the generic functions in sockaddr.h. Since it contains special logic for handling wildcard and netgroups, this function is specialized for exportfs, and does not belong in one of the shared libraries. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
mountd: Replace "struct hostent" with "struct addrinfo" struct hostent can store either IPv4 or IPv6 addresses, but it can't store both address families concurrently for the same host. Neither can hostent deal with parts of socket addresses that are outside of the sin{,6}_addr field. Replace the use of "struct hostent" everywhere in libexport.a, mountd, and exportfs with "struct addrinfo". This is a large change, but there are so many strong dependencies on struct hostent that this can't easily be broken into smaller pieces. One benefit of this change is that hostent_dup() is no longer required, since the results of getaddrinfo(3) are already dynamically allocated. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
exportfs: Add a common exit label in exportfs() Clean up: Reduce code duplication by introducing a goto label for freeing hp and exiting. This will make replacing "struct hostent *" with "struct addrinfo *" more straightforward in this code. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
libexport.a: Add helpers to manage DNS lookups Introduce DNS query helpers based on getaddrinfo(3) and getnameinfo(3). These will eventually replace the existing hostent-based functions in support/export/hostname.c. Put some of these new helpers to immediate use, where convenient. As they are part of libexport.a, I've added the forward declarations for these new functions in exportfs.h rather than misc.h, where the hostent-based forward declarations are currently. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
Added the sys/stat.h header file to a number of files which ensure the S_ISDIR() macro is defined. Signed-off-by: Steve Dickson <steved@redhat.com>
Exportfs and rpc.mountd optimalization There were some problems with exportfs and rpc.mountd for long export lists - see https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=76643 I do optimalization as my bachelors thesis (Facuulty of informatics, Masaryk's university Brno, Czech Republic), under lead of Yenya Kasprzak. Both exportfs and rpc.mount build linked list of exports (shared functions in export.c). Every time they are inserting new export into list, they search for same export in list. I replaced linked list by hash table and functions export_add and export_lookup by functions hash_export_add and hash_export_lookup (export.c). Because some other functions required exportlist as linked list, hash table has some implementation modification im comparison with ordinary hash table. It also keeps exports in linked list and has pointer to head of the list. So there's no need of implementation function <for_all_in_hash_table>. Signed-off-by: Tomas Richter <krik3t@gmail.com> Signed-off-by: Steve Dickson <steved@redhat.com>
Stop exportfs warning about needing fsid, when we actually have one Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Steve Dickson <steved@redhat.com>
Support sec= option to specify export security This adds support for reading sec= option and sending security data through cache via "... secinfo n flavor1 flag1 ... flavorN flagN". If sec= is missing, no secinfo option will be passed down. Signed-off-by: Fred Isaman <iisaman@citi.umich.edu> Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu> Signed-off-by: Neil Brown <neilb@suse.de>
exportfs - test exportability of filesystems when exportfs is run. When exporting a filesystem test to see if the kernel is likely to accept the export and print suitable warning message if not. Don't actually fail the 'exportfs' as by the time a MOUNT request arrives, the filesystem might be exportable. Signed-off-by: Neil Brown <neilb@suse.de>