autofs-5.0.1 - fix map source check in file lookup From: Ian Kent <ikent@redhat.com> With the changes to reduce the scanning of file maps and fixes for other issues, such as too frequent map reads the key searching has become broken. For an automount that has a key present in a file map and the same key also present in another map source, if the file map entry is removed and a lookup is performed before a re-load is issued the map lookup fails. To fix this we need to check the map source, for indirect maps (since plus included direct maps are handled a little dirrefently), and continue looking if it doesn't match. --- modules/lookup_file.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) --- autofs-5.0.1.orig/modules/lookup_file.c +++ autofs-5.0.1/modules/lookup_file.c @@ -596,13 +596,14 @@ prepare_plus_include(struct autofs_point argv[1] = NULL; source = master_find_source_instance(current, type, fmt, argc, argv); - if (source) + if (source) { /* * Make sure included map age is in sync with its owner * or we could incorrectly wipe out its entries. */ source->age = age; - else { + source->stale = 1; + } else { source = master_add_source_instance(current, type, fmt, age, argc, argv); if (!source) { free(buf); @@ -1117,8 +1118,13 @@ int lookup_mount(struct autofs_point *ap cache_readlock(mc); do_cache_lookup: me = cache_lookup(mc, key); - /* Stale mapent => check for entry in alternate source or wildcard */ - if (me && !me->mapent) { + /* + * Stale mapent => check for entry in alternate source or wildcard. + * Note, plus included direct mount map entries are included as an + * instance (same map entry cache), not in a distinct source. + */ + if (me && (!me->mapent || + (ap->type == LKP_INDIRECT && me->source != source))) { while ((me = cache_lookup_key_next(me))) if (me->source == source) break;