autofs-5.0.1 - always read file maps multi map fix From: Ian Kent <raven@themaw.net> Since "multi" map entries may contain file maps themselves and we always want to read file maps we need to move the chack of whether to read the map from lookup_nss_read_map() into the individual map type lookup modules. --- daemon/lookup.c | 14 -------------- modules/lookup_hosts.c | 8 ++++++++ modules/lookup_ldap.c | 8 ++++++++ modules/lookup_nisplus.c | 8 ++++++++ modules/lookup_yp.c | 8 ++++++++ 5 files changed, 32 insertions(+), 14 deletions(-) --- autofs-5.0.1.orig/daemon/lookup.c +++ autofs-5.0.1/daemon/lookup.c @@ -279,20 +279,6 @@ static int do_read_map(struct autofs_poi map->lookup = lookup; master_source_unlock(ap->entry); - /* If we don't need to create directories then there's no use - * reading the map. We just need to test that the map is valid - * for the fail cases to function correctly and to cache the - * lookup handle. - * - * We always need to read the whole map for direct mounts in - * order to mount the triggers. We also want to read the whole - * map if it's a file map to avoid potentially lengthy linear - * file scanning. - */ - if (strcmp(map->type, "file") && - !(ap->flags & MOUNT_FLAG_GHOST) && ap->type != LKP_DIRECT) - return NSS_STATUS_SUCCESS; - if (!map->stale) return NSS_STATUS_SUCCESS; --- autofs-5.0.1.orig/modules/lookup_hosts.c +++ autofs-5.0.1/modules/lookup_hosts.c @@ -84,6 +84,14 @@ int lookup_read_map(struct autofs_point ap->entry->current = NULL; master_source_current_signal(ap->entry); + /* + * If we don't need to create directories then there's no use + * 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) + return NSS_STATUS_SUCCESS; + mc = source->mc; status = pthread_mutex_lock(&hostent_mutex); --- autofs-5.0.1.orig/modules/lookup_ldap.c +++ autofs-5.0.1/modules/lookup_ldap.c @@ -1813,6 +1813,14 @@ static int read_one_map(struct autofs_po ap->entry->current = NULL; master_source_current_signal(ap->entry); + /* + * If we don't need to create directories then there's no use + * 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) + return NSS_STATUS_SUCCESS; + mc = source->mc; class = ctxt->schema->entry_class; --- autofs-5.0.1.orig/modules/lookup_nisplus.c +++ autofs-5.0.1/modules/lookup_nisplus.c @@ -178,6 +178,14 @@ int lookup_read_map(struct autofs_point ap->entry->current = NULL; master_source_current_signal(ap->entry); + /* + * If we don't need to create directories then there's no use + * 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) + return NSS_STATUS_SUCCESS; + mc = source->mc; pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cur_state); --- autofs-5.0.1.orig/modules/lookup_yp.c +++ autofs-5.0.1/modules/lookup_yp.c @@ -322,6 +322,14 @@ int lookup_read_map(struct autofs_point ap->entry->current = NULL; master_source_current_signal(ap->entry); + /* + * If we don't need to create directories then there's no use + * 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) + return NSS_STATUS_SUCCESS; + ypcb_data.ap = ap; ypcb_data.source = source; ypcb_data.logopt = logopt;