[PATCH 01/34] autofs-5.1.2 - fix included master map not found return

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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



[Index of Archives]     [Linux Filesystem Development]     [Linux Ext4]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux