* [PATCH] exportfs: Do not fail on empty exports file.
@ 2014-11-17 13:46 Steve Dickson
2014-11-17 18:32 ` Steve Dickson
0 siblings, 1 reply; 2+ messages in thread
From: Steve Dickson @ 2014-11-17 13:46 UTC (permalink / raw)
To: Linux NFS Mailing list
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>
---
support/export/export.c | 6 +++---
support/include/exportfs.h | 2 +-
utils/exportfs/exportfs.c | 10 +++++-----
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/support/export/export.c b/support/export/export.c
index ce714d4..376ca6d 100644
--- a/support/export/export.c
+++ b/support/export/export.c
@@ -71,7 +71,7 @@ static void warn_duplicated_exports(nfs_export *exp, struct exportent *eep)
*
*/
void
-export_read(char *fname)
+export_read(char *fname, int verbose)
{
struct exportent *eep;
nfs_export *exp;
@@ -90,8 +90,8 @@ export_read(char *fname)
warn_duplicated_exports(exp, eep);
}
endexportent();
- if (volumes == 0)
- xlog(L_ERROR, "No file systems exported!");
+ if (volumes == 0 && verbose)
+ xlog(L_WARNING, "No file systems exported!");
}
/**
diff --git a/support/include/exportfs.h b/support/include/exportfs.h
index 9021fae..3d89f12 100644
--- a/support/include/exportfs.h
+++ b/support/include/exportfs.h
@@ -133,7 +133,7 @@ struct addrinfo * client_resolve(const struct sockaddr *sap);
int client_member(const char *client,
const char *name);
-void export_read(char *fname);
+void export_read(char *fname, int verbose);
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/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c
index bdea12b..92fb9eb 100644
--- a/utils/exportfs/exportfs.c
+++ b/utils/exportfs/exportfs.c
@@ -47,7 +47,7 @@ static void error(nfs_export *exp, int err);
static void usage(const char *progname, int n);
static void validate_export(nfs_export *exp);
static int matchhostname(const char *hostname1, const char *hostname2);
-static void export_d_read(const char *dname);
+static void export_d_read(const char *dname, int verbose);
static void grab_lockfile(void);
static void release_lockfile(void);
@@ -182,8 +182,8 @@ main(int argc, char **argv)
atexit(release_lockfile);
if (f_export && ! f_ignore) {
- export_read(_PATH_EXPORTS);
- export_d_read(_PATH_EXPORTS_D);
+ export_read(_PATH_EXPORTS, f_verbose);
+ export_d_read(_PATH_EXPORTS_D, f_verbose);
}
if (f_export) {
if (f_all)
@@ -686,7 +686,7 @@ out:
/* Based on mnt_table_parse_dir() in
util-linux-ng/shlibs/mount/src/tab_parse.c */
static void
-export_d_read(const char *dname)
+export_d_read(const char *dname, int verbose)
{
int n = 0, i;
struct dirent **namelist = NULL;
@@ -729,7 +729,7 @@ export_d_read(const char *dname)
continue;
}
- export_read(fname);
+ export_read(fname, verbose);
}
for (i = 0; i < n; i++)
--
2.1.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] exportfs: Do not fail on empty exports file.
2014-11-17 13:46 [PATCH] exportfs: Do not fail on empty exports file Steve Dickson
@ 2014-11-17 18:32 ` Steve Dickson
0 siblings, 0 replies; 2+ messages in thread
From: Steve Dickson @ 2014-11-17 18:32 UTC (permalink / raw)
To: Linux NFS Mailing list
On 11/17/2014 08:46 AM, Steve Dickson wrote:
> 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>
A slightly modified version was committed...
steved.
> ---
> support/export/export.c | 6 +++---
> support/include/exportfs.h | 2 +-
> utils/exportfs/exportfs.c | 10 +++++-----
> 3 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/support/export/export.c b/support/export/export.c
> index ce714d4..376ca6d 100644
> --- a/support/export/export.c
> +++ b/support/export/export.c
> @@ -71,7 +71,7 @@ static void warn_duplicated_exports(nfs_export *exp, struct exportent *eep)
> *
> */
> void
> -export_read(char *fname)
> +export_read(char *fname, int verbose)
> {
> struct exportent *eep;
> nfs_export *exp;
> @@ -90,8 +90,8 @@ export_read(char *fname)
> warn_duplicated_exports(exp, eep);
> }
> endexportent();
> - if (volumes == 0)
> - xlog(L_ERROR, "No file systems exported!");
> + if (volumes == 0 && verbose)
> + xlog(L_WARNING, "No file systems exported!");
> }
>
> /**
> diff --git a/support/include/exportfs.h b/support/include/exportfs.h
> index 9021fae..3d89f12 100644
> --- a/support/include/exportfs.h
> +++ b/support/include/exportfs.h
> @@ -133,7 +133,7 @@ struct addrinfo * client_resolve(const struct sockaddr *sap);
> int client_member(const char *client,
> const char *name);
>
> -void export_read(char *fname);
> +void export_read(char *fname, int verbose);
> 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/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c
> index bdea12b..92fb9eb 100644
> --- a/utils/exportfs/exportfs.c
> +++ b/utils/exportfs/exportfs.c
> @@ -47,7 +47,7 @@ static void error(nfs_export *exp, int err);
> static void usage(const char *progname, int n);
> static void validate_export(nfs_export *exp);
> static int matchhostname(const char *hostname1, const char *hostname2);
> -static void export_d_read(const char *dname);
> +static void export_d_read(const char *dname, int verbose);
> static void grab_lockfile(void);
> static void release_lockfile(void);
>
> @@ -182,8 +182,8 @@ main(int argc, char **argv)
> atexit(release_lockfile);
>
> if (f_export && ! f_ignore) {
> - export_read(_PATH_EXPORTS);
> - export_d_read(_PATH_EXPORTS_D);
> + export_read(_PATH_EXPORTS, f_verbose);
> + export_d_read(_PATH_EXPORTS_D, f_verbose);
> }
> if (f_export) {
> if (f_all)
> @@ -686,7 +686,7 @@ out:
> /* Based on mnt_table_parse_dir() in
> util-linux-ng/shlibs/mount/src/tab_parse.c */
> static void
> -export_d_read(const char *dname)
> +export_d_read(const char *dname, int verbose)
> {
> int n = 0, i;
> struct dirent **namelist = NULL;
> @@ -729,7 +729,7 @@ export_d_read(const char *dname)
> continue;
> }
>
> - export_read(fname);
> + export_read(fname, verbose);
> }
>
> for (i = 0; i < n; i++)
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-11-17 18:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-17 13:46 [PATCH] exportfs: Do not fail on empty exports file Steve Dickson
2014-11-17 18:32 ` Steve Dickson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox