autofs-5.0.6 - report map not read when debug logging

From: Ian Kent <ikent@redhat.com>

When a map read is called automount will report that is is reading the
map when debug logging is set. If a map read is not actually needed the
lookup module read map function should also report that it didn't need
to read the map.
---

 CHANGELOG                |    1 +
 modules/lookup_hosts.c   |    4 +++-
 modules/lookup_ldap.c    |    4 +++-
 modules/lookup_nisplus.c |    4 +++-
 modules/lookup_sss.c     |    4 +++-
 modules/lookup_yp.c      |    4 +++-
 6 files changed, 16 insertions(+), 5 deletions(-)


diff --git a/CHANGELOG b/CHANGELOG
index f37b720..682848d 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -44,6 +44,7 @@
 - fix sss wildcard match.
 - fix dlopen() error handling in sss module.
 - fix configure string length tests for sss library.
+- report map not read when debug logging.
 
 28/06/2011 autofs-5.0.6
 -----------------------
diff --git a/modules/lookup_hosts.c b/modules/lookup_hosts.c
index cc259b2..321021c 100644
--- a/modules/lookup_hosts.c
+++ b/modules/lookup_hosts.c
@@ -94,8 +94,10 @@ int lookup_read_map(struct autofs_point *ap, time_t age, void *context)
 	 * reading the map. We always need to read the whole map for
 	 * direct mounts in order to mount the triggers.
 	 */
-	if (!(ap->flags & MOUNT_FLAG_GHOST) && ap->type != LKP_DIRECT)
+	if (!(ap->flags & MOUNT_FLAG_GHOST) && ap->type != LKP_DIRECT) {
+		debug(ap->logopt, "map read not needed, so not done");
 		return NSS_STATUS_SUCCESS;
+	}
 
 	mc = source->mc;
 
diff --git a/modules/lookup_ldap.c b/modules/lookup_ldap.c
index 8d12920..041120f 100644
--- a/modules/lookup_ldap.c
+++ b/modules/lookup_ldap.c
@@ -2326,8 +2326,10 @@ static int read_one_map(struct autofs_point *ap,
 	 * reading the map. We always need to read the whole map for
 	 * direct mounts in order to mount the triggers.
 	 */
-	if (!(ap->flags & MOUNT_FLAG_GHOST) && ap->type != LKP_DIRECT)
+	if (!(ap->flags & MOUNT_FLAG_GHOST) && ap->type != LKP_DIRECT) {
+		debug(ap->logopt, "map read not needed, so not done");
 		return NSS_STATUS_SUCCESS;
+	}
 
 	sp.ap = ap;
 	sp.age = age;
diff --git a/modules/lookup_nisplus.c b/modules/lookup_nisplus.c
index bcd5973..9fced96 100644
--- a/modules/lookup_nisplus.c
+++ b/modules/lookup_nisplus.c
@@ -185,8 +185,10 @@ int lookup_read_map(struct autofs_point *ap, time_t age, void *context)
 	 * reading the map. We always need to read the whole map for
 	 * direct mounts in order to mount the triggers.
 	 */
-	if (!(ap->flags & MOUNT_FLAG_GHOST) && ap->type != LKP_DIRECT)
+	if (!(ap->flags & MOUNT_FLAG_GHOST) && ap->type != LKP_DIRECT) {
+		debug(ap->logopt, "map read not needed, so not done");
 		return NSS_STATUS_SUCCESS;
+	}
 
 	mc = source->mc;
 
diff --git a/modules/lookup_sss.c b/modules/lookup_sss.c
index 9e7dc71..a1155c0 100644
--- a/modules/lookup_sss.c
+++ b/modules/lookup_sss.c
@@ -275,8 +275,10 @@ int lookup_read_map(struct autofs_point *ap, time_t age, void *context)
 	 * reading the map. We always need to read the whole map for
 	 * direct mounts in order to mount the triggers.
 	 */
-	if (!(ap->flags & MOUNT_FLAG_GHOST) && ap->type != LKP_DIRECT)
+	if (!(ap->flags & MOUNT_FLAG_GHOST) && ap->type != LKP_DIRECT) {
+		debug(ap->logopt, "map read not needed, so not done");
 		return NSS_STATUS_SUCCESS;
+	}
 
 	if (!setautomntent(ap->logopt, ctxt, ctxt->mapname, &sss_ctxt))
 		return NSS_STATUS_UNAVAIL;
diff --git a/modules/lookup_yp.c b/modules/lookup_yp.c
index 9d35be5..720df2e 100644
--- a/modules/lookup_yp.c
+++ b/modules/lookup_yp.c
@@ -327,8 +327,10 @@ int lookup_read_map(struct autofs_point *ap, time_t age, void *context)
 	 * reading the map. We always need to read the whole map for
 	 * direct mounts in order to mount the triggers.
 	 */
-	if (!(ap->flags & MOUNT_FLAG_GHOST) && ap->type != LKP_DIRECT)
+	if (!(ap->flags & MOUNT_FLAG_GHOST) && ap->type != LKP_DIRECT) {
+		debug(ap->logopt, "map read not needed, so not done");
 		return NSS_STATUS_SUCCESS;
+	}
 
 	ypcb_data.ap = ap;
 	ypcb_data.source = source;