diff options
-rw-r--r-- | support/export/export.c | 13 | ||||
-rw-r--r-- | support/include/exportfs.h | 4 | ||||
-rw-r--r-- | systemd/nfs-server-generator.c | 4 | ||||
-rw-r--r-- | utils/exportfs/exportfs.c | 4 |
4 files changed, 15 insertions, 10 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++) diff --git a/support/include/exportfs.h b/support/include/exportfs.h index f033329..32d4fe9 100644 --- a/support/include/exportfs.h +++ b/support/include/exportfs.h @@ -134,8 +134,8 @@ struct addrinfo * client_resolve(const struct sockaddr *sap); int client_member(const char *client, const char *name); -int export_read(char *fname); -int export_d_read(const char *dname); +int export_read(char *fname, int ignore_hosts); +int export_d_read(const char *dname, int ignore_hosts); void export_reset(nfs_export *); nfs_export * export_lookup(char *hname, char *path, int caconical); nfs_export * export_find(const struct addrinfo *ai, diff --git a/systemd/nfs-server-generator.c b/systemd/nfs-server-generator.c index f47718e..7c40b3f 100644 --- a/systemd/nfs-server-generator.c +++ b/systemd/nfs-server-generator.c @@ -104,8 +104,8 @@ int main(int argc, char *argv[]) path = malloc(strlen(argv[1]) + sizeof(dirbase) + sizeof(filebase)); if (!path) exit(2); - if (export_read(_PATH_EXPORTS) + - export_d_read(_PATH_EXPORTS_D) == 0) + if (export_read(_PATH_EXPORTS, 1) + + export_d_read(_PATH_EXPORTS_D, 1) == 0) /* Nothing is exported, so nothing to do */ exit(0); diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c index 4ac2c15..5136810 100644 --- a/utils/exportfs/exportfs.c +++ b/utils/exportfs/exportfs.c @@ -183,8 +183,8 @@ main(int argc, char **argv) atexit(release_lockfile); if (f_export && ! f_ignore) { - if (! (export_read(_PATH_EXPORTS) + - export_d_read(_PATH_EXPORTS_D))) { + if (! (export_read(_PATH_EXPORTS, 0) + + export_d_read(_PATH_EXPORTS_D, 0))) { if (f_verbose) xlog(L_WARNING, "No file systems exported!"); } |