public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Henrique Martins <linux@martins.cc>
To: linux-nfs@vger.kernel.org
Cc: Steve Dickson <steved@redhat.com>
Subject: [PATCH 1/1] nfsd/exportfs: allow empty exports file
Date: Fri, 14 Nov 2014 10:05:13 -0800	[thread overview]
Message-ID: <17903.1415988313@monster.martins.cc> (raw)

Attaching patch to nfs/exportfs to allow nfsd to start when
/etc/exports is empty, which broke with previous patch
(bugzilla 1115179).

Files changed:
- in export.c/export_read:
    counts the number of good (resolvable) and bad
    (unresolvable) volume entries and generates a (x)log
    L_ERROR if no resolvable entries are exported AND there
    are some unresolvable entries.

Built and tested on a Fedora 20 (fully updated) system.

(And yes, if I need to add the patch inline, my mailer may
screw up the indentation, blanks vs tabs.)

Signed-off-by: Henrique Martins <linux@xxxxxxxxxx>
---

diff -upN nfs-utils-1.3.0/support/export/export.c.orig
nfs-utils-1.3.0/support/export/export.c
--- nfs-utils-1.3.0/support/export/export.c.orig
    2014-11-14 08:46:58.284175535 -0800
+++ nfs-utils-1.3.0/support/export/export.c	2014-11-14
    08:47:52.079349910 -0800
@@ -76,7 +76,8 @@ export_read(char *fname)
 	struct exportent	*eep;
 	nfs_export		*exp;

-	int volumes = 0;
+	int good = 0;
+	int bad = 0;

 	setexportent(fname, "r");
 	while ((eep = getexportent(0,1)) != NULL) {
@@ -84,13 +85,15 @@ export_read(char *fname)
 		if (!exp) {
 			exp = export_create(eep, 0);
 			if (exp)
-				volumes++;
+				good++;
+			else
+				bad++;
 		}
 		else
 			warn_duplicated_exports(exp, eep);
 	}
 	endexportent();
-	if (volumes == 0)
+	if (good == 0 && bad > 0)
 		xlog(L_ERROR, "No file systems exported!");
 }

             reply	other threads:[~2014-11-14 18:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-14 18:05 Henrique Martins [this message]
2014-11-17 13:09 ` [PATCH 1/1] nfsd/exportfs: allow empty exports file Steve Dickson
2014-11-17 15:53   ` Henrique Martins
2014-11-17 19:09     ` Steve Dickson
2014-11-17 20:27       ` Henrique Martins
2014-11-17 21:31         ` Steve Dickson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=17903.1415988313@monster.martins.cc \
    --to=linux@martins.cc \
    --cc=linux-nfs@vger.kernel.org \
    --cc=steved@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox