summaryrefslogtreecommitdiff
path: root/support/export
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.com>2016-11-07 14:13:49 -0500
committerSteve Dickson <steved@redhat.com>2016-11-07 14:13:49 -0500
commit8f3d12ce1d156b8809dc936d9e452e14e2788b3e (patch)
treeea3a4ed01414bd84dc1a1753260708ade1f7db8b /support/export
parent3e2ab78a2cfbc2d11c31ced8d3f538d5aae757f1 (diff)
downloadnfs-utils-8f3d12ce1d156b8809dc936d9e452e14e2788b3e.tar.gz
nfs-server-generator: avoid using external services.
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>
Diffstat (limited to 'support/export')
-rw-r--r--support/export/export.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/support/export/export.c b/support/export/export.c
index 0b8a858..15e91cb 100644
--- a/support/export/export.c
+++ b/support/export/export.c
@@ -70,11 +70,15 @@ static void warn_duplicated_exports(nfs_export *exp, struct exportent *eep)
/**
* export_read - read entries from /etc/exports
* @fname: name of file to read from
+ * @ignore_hosts: don't check validity of host names
*
* Returns number of read entries.
+ * @ignore_hosts can be set when the host names won't be used
+ * and when getting delays or errors due to problems with
+ * hostname looking is not acceptable.
*/
int
-export_read(char *fname)
+export_read(char *fname, int ignore_hosts)
{
struct exportent *eep;
nfs_export *exp;
@@ -83,7 +87,7 @@ export_read(char *fname)
setexportent(fname, "r");
while ((eep = getexportent(0,1)) != NULL) {
- exp = export_lookup(eep->e_hostname, eep->e_path, 0);
+ exp = export_lookup(eep->e_hostname, eep->e_path, ignore_hosts);
if (!exp) {
if (export_create(eep, 0))
/* possible complaints already logged */
@@ -100,13 +104,14 @@ export_read(char *fname)
/**
* export_d_read - read entries from /etc/exports.
* @fname: name of directory to read from
+ * @ignore_hosts: don't check validity of host names
*
* Returns number of read entries.
* Based on mnt_table_parse_dir() in
* util-linux-ng/shlibs/mount/src/tab_parse.c
*/
int
-export_d_read(const char *dname)
+export_d_read(const char *dname, int ignore_hosts)
{
int n = 0, i;
struct dirent **namelist = NULL;
@@ -150,7 +155,7 @@ export_d_read(const char *dname)
continue;
}
- volumes += export_read(fname);
+ volumes += export_read(fname, ignore_hosts);
}
for (i = 0; i < n; i++)