autofs-5.0.4 - always read file maps multi map fix From: Ian Kent 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. --- CHANGELOG | 1 + daemon/lookup.c | 14 -------------- modules/lookup_hosts.c | 8 ++++++++ modules/lookup_ldap.c | 8 ++++++++ modules/lookup_nisplus.c | 8 ++++++++ modules/lookup_yp.c | 8 ++++++++ 6 files changed, 33 insertions(+), 14 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 7e1012f..972ef63 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -47,6 +47,7 @@ - fix incorrect shutdown introduced by library relaod fixes. - improve manual umount recovery. - dont fail on ipv6 address when adding host. +- always read file maps multi map fix. 4/11/2008 autofs-5.0.4 ----------------------- diff --git a/daemon/lookup.c b/daemon/lookup.c index bc94655..9d5a5c8 100644 --- a/daemon/lookup.c +++ b/daemon/lookup.c @@ -278,20 +278,6 @@ static int do_read_map(struct autofs_point *ap, struct map_source *map, time_t a 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; diff --git a/modules/lookup_hosts.c b/modules/lookup_hosts.c index d3ae0e2..a213780 100644 --- a/modules/lookup_hosts.c +++ b/modules/lookup_hosts.c @@ -89,6 +89,14 @@ int lookup_read_map(struct autofs_point *ap, time_t age, void *context) 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); diff --git a/modules/lookup_ldap.c b/modules/lookup_ldap.c index 8c6a8f2..a847622 100644 --- a/modules/lookup_ldap.c +++ b/modules/lookup_ldap.c @@ -2236,6 +2236,14 @@ static int read_one_map(struct autofs_point *ap, 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; + sp.ap = ap; sp.age = age; diff --git a/modules/lookup_nisplus.c b/modules/lookup_nisplus.c index 0c75905..ae53481 100644 --- a/modules/lookup_nisplus.c +++ b/modules/lookup_nisplus.c @@ -180,6 +180,14 @@ int lookup_read_map(struct autofs_point *ap, time_t age, void *context) 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); diff --git a/modules/lookup_yp.c b/modules/lookup_yp.c index ce438e8..208f95e 100644 --- a/modules/lookup_yp.c +++ b/modules/lookup_yp.c @@ -322,6 +322,14 @@ int lookup_read_map(struct autofs_point *ap, time_t age, void *context) 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;