autofs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ian Kent <raven@themaw.net>
To: autofs mailing list <autofs@vger.kernel.org>
Subject: [PATCH 01/34] autofs-5.1.2 - fix included master map not found return
Date: Mon, 24 Apr 2017 09:00:18 +0800	[thread overview]
Message-ID: <149299561814.23475.16968315102619391643.stgit@pluto.themaw.net> (raw)
In-Reply-To: <149299547753.23475.9924538846721477415.stgit@pluto.themaw.net>

When retrying the master map read at startup a not found return is needed
when there is no map rather than an unknown or unavailable for the retry
logic to work.

Signed-off-by: Ian Kent <raven@themaw.net>
---
 CHANGELOG             |    1 +
 daemon/lookup.c       |    6 ++++--
 modules/lookup_file.c |   18 ++++++++++++------
 3 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 38c4a2a..5822aeb 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -27,6 +27,7 @@ xx/xx/2016 autofs-5.1.3
 - work around sss startup delay.
 - add sss master map wait config option.
 - fix quoted key handling in sanitize_path().
+- fix included master map not found return.
 
 15/06/2016 autofs-5.1.2
 =======================
diff --git a/daemon/lookup.c b/daemon/lookup.c
index 0c2a01f..a46740e 100644
--- a/daemon/lookup.c
+++ b/daemon/lookup.c
@@ -241,7 +241,7 @@ int lookup_nss_read_master(struct master *master, time_t age)
 	}
 
 	/* First one gets it */
-	result = NSS_STATUS_UNKNOWN;
+	result = NSS_STATUS_SUCCESS;
 	head = &nsslist;
 	list_for_each(p, head) {
 		struct nss_source *this;
@@ -282,8 +282,10 @@ int lookup_nss_read_master(struct master *master, time_t age)
 			}
 		}
 
-		if (result == NSS_STATUS_UNKNOWN) {
+		if (result == NSS_STATUS_UNKNOWN ||
+		    result == NSS_STATUS_NOTFOUND) {
 			debug(logopt, "no map - continuing to next source");
+			result = NSS_STATUS_SUCCESS;
 			continue;
 		}
 
diff --git a/modules/lookup_file.c b/modules/lookup_file.c
index d5f8c9e..cb00ee5 100644
--- a/modules/lookup_file.c
+++ b/modules/lookup_file.c
@@ -464,6 +464,8 @@ int lookup_read_master(struct master *master, time_t age, void *context)
 
 	f = open_fopen_r(ctxt->mapname);
 	if (!f) {
+		if (errno == ENOENT)
+			return NSS_STATUS_NOTFOUND;
 		error(logopt,
 		      MODPREFIX "could not open master map file %s",
 		      ctxt->mapname);
@@ -507,12 +509,14 @@ int lookup_read_master(struct master *master, time_t age, void *context)
 				     MODPREFIX
 				     "failed to read included master map %s",
 				     master->name);
-				/*
-				 * If we're starting up wee need the whole
-				 * master map initially, so tell the upper
-				 * layer to retry.
-				 */
-				master->read_fail = 1;
+				if (status != NSS_STATUS_NOTFOUND) {
+					/*
+					 * If we're starting up wee need the whole
+					 * master map initially, so tell the upper
+					 * layer to retry.
+					 */
+					master->read_fail = 1;
+				}
 			}
 			master->depth--;
 			master->recurse = 0;
@@ -713,6 +717,8 @@ int lookup_read_map(struct autofs_point *ap, time_t age, void *context)
 
 	f = open_fopen_r(ctxt->mapname);
 	if (!f) {
+		if (errno == ENOENT)
+			return NSS_STATUS_NOTFOUND;
 		error(ap->logopt,
 		      MODPREFIX "could not open map file %s", ctxt->mapname);
 		return NSS_STATUS_UNAVAIL;

--
To unsubscribe from this list: send the line "unsubscribe autofs" in

  reply	other threads:[~2017-04-24  1:00 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-24  1:00 [PATCH 00/34] fyi ... current patch list Ian Kent
2017-04-24  1:00 ` Ian Kent [this message]
2017-04-24  1:00 ` [PATCH 02/34] autofs-5.1.2 - dont exit on master map read fail timeout Ian Kent
2017-04-24  1:00 ` [PATCH 03/34] autofs-5.1.2 - set sane default master read wait timeout Ian Kent
2017-04-24  1:00 ` [PATCH 04/34] autofs-5.1.2 - don't return until after master map retry read Ian Kent
2017-04-24  1:00 ` [PATCH 05/34] autofs-5.1.2 - make lookup_nss_read_master() return nss status Ian Kent
2017-04-24  1:00 ` [PATCH 06/34] autofs-5.1.2 - check NFS server availability on local mount fallback Ian Kent
2017-04-24  1:00 ` [PATCH 07/34] autofs-5.1.2 - make set_direct_mount_catatonic() more general Ian Kent
2017-04-24  1:00 ` [PATCH 08/34] autofs-5.1.2 - set autofs mounts catatonic at exit Ian Kent
2017-04-24  1:00 ` [PATCH 09/34] autofs-5.1.2 - honor last rw in mount options when doing a bind mount Ian Kent
2017-04-24  1:01 ` [PATCH 10/34] autofs-5.1.2 - fix typos in README.amd-maps Ian Kent
2017-04-24  1:01 ` [PATCH 11/34] autofs-5.1.2 - add ref counting to struct map_source Ian Kent
2017-04-24  1:01 ` [PATCH 12/34] autofs-5.1.2 - add support for amd browsable option Ian Kent
2017-04-24  1:01 ` [PATCH 13/34] autofs-5.1.2 - add function conf_amd_get_map_name() Ian Kent
2017-04-24  1:01 ` [PATCH 14/34] autofs-5.1.2 - add function conf_amd_get_mount_paths() Ian Kent
2017-04-24  1:01 ` [PATCH 15/34] autofs-5.1.2 - include amd mount section mounts in master mounts list Ian Kent
2017-04-24  1:01 ` [PATCH 16/34] autofs-5.1.2 - check for conflicting amd section mounts Ian Kent
2017-04-24  1:01 ` [PATCH 17/34] autofs-5.1.2 - add function conf_amd_get_map_options() Ian Kent
2017-04-24  1:01 ` [PATCH 18/34] autofs-5.1.2 - capture cache option and its settings during parsing Ian Kent
2017-04-24  1:01 ` [PATCH 19/34] autofs-5.1.2 - handle map_option cache for top level mounts Ian Kent
2017-04-24  1:01 ` [PATCH 20/34] autofs-5.1.2 - handle amd cache option all in amd type auto mounts Ian Kent
2017-04-24  1:02 ` [PATCH 21/34] autofs-5.1.2 - fix bogus check in expire_cleanup() Ian Kent
2017-04-24  1:02 ` [PATCH 22/34] autofs-5.1.2 - delay submount exit for amd submounts Ian Kent
2017-04-24  1:02 ` [PATCH 23/34] autofs-5.1.2 - add the mount requestor's pid to pending_args Ian Kent
2017-04-24  1:02 ` [PATCH 24/34] autofs-5.1.2 - create thread-local ID for mount attempts Ian Kent
2017-04-24  1:02 ` [PATCH 25/34] autofs-5.1.2 - log functions to prefix messages with attempt_id if available Ian Kent
2017-04-24  1:02 ` [PATCH 26/34] autofs-5.1.2 - factor out set_thread_mount_request_log_id() Ian Kent
2017-04-24  1:02 ` [PATCH 27/34] autofs-5.1.2 - add config option to use mount request log id Ian Kent
2017-04-24  1:02 ` [PATCH 28/34] autofs-5.1.2 - use autofs_point to store expire timeout where possibe Ian Kent
2017-04-24  1:02 ` [PATCH 29/34] autofs-5.1.2 - fix possible NULL derefernce Ian Kent
2017-04-24  1:02 ` [PATCH 30/34] autofs-5.1.2 - fix work around sss startup delay Ian Kent
2017-04-24  1:02 ` [PATCH 31/34] autofs-5.1.2 - fix invalid reference in remount_active_mount() Ian Kent
2017-04-24  1:02 ` [PATCH 32/34] autofs-5.1.2 - use malloc for expanded map location Ian Kent
2017-04-24  1:03 ` [PATCH 33/34] autofs-5.1.2 - fix offset mount location multiple expansion Ian Kent
2017-04-24  1:03 ` [PATCH 34/34] autofs-5.1.2 - increase worker thread per-thread stack size Ian Kent

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=149299561814.23475.16968315102619391643.stgit@pluto.themaw.net \
    --to=raven@themaw.net \
    --cc=autofs@vger.kernel.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).