autofs-5.1.9 - dont auto readmap for hosts map

From: Ian Kent <raven@themaw.net>

The internal hosts map can have a large number of hosts but also each
host can have a large number of exports. In addition the auto-readmap
has universal way to work out if a map read is needed.

Becuase of this the auto-readmap can introduce an unnessesarily large
overhead so change to requiring a HUP signal to update the hosts map.

Signed-off-by: Ian Kent <raven@themaw.net>
---
 CHANGELOG       |    1 +
 daemon/master.c |   15 +++++++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 20c076172..cc7fb477e 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -111,6 +111,7 @@
 - fix thinko in __mnt_find_submount_by_devid().
 - fix setting submount autofs_point in mnts_add_submount().
 - improve function mnt_find_submount_by_devid().
+- dont auto readmap for hosts map.
 
 02/11/2023 autofs-5.1.9
 - fix kernel mount status notification.
diff --git a/daemon/master.c b/daemon/master.c
index 2734996f9..f1df80731 100644
--- a/daemon/master.c
+++ b/daemon/master.c
@@ -613,6 +613,12 @@ void send_map_update_request(struct autofs_point *ap)
 	struct map_source *map;
 	int status, need_update = 0;
 
+	/* Don't send an update request if the primary map is the
+	 * "hosts" map.
+	 */
+	if (!strcmp(ap->entry->maps->type, "hosts"))
+		return;
+
 	status = pthread_mutex_lock(&instance_mutex);
 	if (status)
 		fatal(status);
@@ -1503,8 +1509,13 @@ void check_update_map_sources(struct master_mapent *entry, int readall)
 	master_source_unlock(entry);
 
 	/* The map sources have changed */
-	if (map_stale)
-		st_add_task(ap, ST_READMAP);
+	if (map_stale) {
+		/* Don't send an update request if the primary map is
+		 * the "hosts" map.
+		 */
+		if (strcmp(ap->entry->maps->type, "hosts"))
+			st_add_task(ap, ST_READMAP);
+	}
 
 	return;
 }
