rpms/autofs/devel autofs-5.0.4-always-read-file-maps-fix.patch, NONE, 1.1 autofs.spec, 1.274, 1.275

Ian Kent iankent at fedoraproject.org
Tue Mar 17 02:51:54 UTC 2009


Author: iankent

Update of /cvs/pkgs/rpms/autofs/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv7627

Modified Files:
	autofs.spec 
Added Files:
	autofs-5.0.4-always-read-file-maps-fix.patch 
Log Message:
* Tue Mar 17 2009 Ian Kent <ikent at redhat.com> - 1:5.0.4-21
- fix file map lookup when reading included or nsswitch sources.
  - a regression introduced by file map lookup optimisation in rev 9.


autofs-5.0.4-always-read-file-maps-fix.patch:

--- NEW FILE autofs-5.0.4-always-read-file-maps-fix.patch ---
autofs-5.0.4 - always read file maps fix

From: Ian Kent <raven at themaw.net>

If map instances are present for a map source then either we have
plus included entries or we are looking through a list of nsswitch
sources. In either case we cannot avoid reading through the map
because we must preserve the key lookup order over multiple sources.
But also, we can't know if a source instance has been changed since
the last time we checked it until we preform a lookup against it.
So, in this case a lookup within the internal cache cannot be relied
upon to find the key we're looking for. At least, when we get to the
file source instance itself, the lookup for the key will be done from
the cache.
---

 CHANGELOG             |    1 +
 modules/lookup_file.c |   17 ++++++++++++++---
 2 files changed, 15 insertions(+), 3 deletions(-)


diff --git a/CHANGELOG b/CHANGELOG
index aab3209..da7ecbf 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -31,6 +31,7 @@
 - fix double free in expire_proc().
 - another easy alloca replacements fix.
 - add LSB init script parameter block.
+- fix file map lookup when reading included or nsswitch sources.
 
 4/11/2008 autofs-5.0.4
 -----------------------
diff --git a/modules/lookup_file.c b/modules/lookup_file.c
index ec78090..bd30bc5 100644
--- a/modules/lookup_file.c
+++ b/modules/lookup_file.c
@@ -998,9 +998,20 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void *
 
 		cache_readlock(mc);
 		me = cache_lookup_first(mc);
-		if (me && st.st_mtime <= me->age)
-			goto do_cache_lookup;
-		else
+		if (me && st.st_mtime <= me->age) {
+			/*
+			 * If any map instances are present for this source
+			 * then either we have plus included entries or we
+			 * are looking through the list of nsswitch sources.
+			 * In either case we cannot avoid reading through the
+			 * map because we must preserve the key order over
+			 * multiple sources. But also, we can't know, at this
+			 * point, if a source instance has been changed since
+			 * the last time we checked it.
+			 */
+			if (!source->instance)
+				goto do_cache_lookup;
+		} else
 			source->stale = 1;
 
 		me = cache_lookup_distinct(mc, key);


Index: autofs.spec
===================================================================
RCS file: /cvs/pkgs/rpms/autofs/devel/autofs.spec,v
retrieving revision 1.274
retrieving revision 1.275
diff -u -r1.274 -r1.275
--- autofs.spec	13 Mar 2009 03:07:24 -0000	1.274
+++ autofs.spec	17 Mar 2009 02:51:24 -0000	1.275
@@ -4,7 +4,7 @@
 Summary: A tool for automatically mounting and unmounting filesystems
 Name: autofs
 Version: 5.0.4
-Release: 20
+Release: 21
 Epoch: 1
 License: GPLv2+
 Group: System Environment/Daemons
@@ -41,6 +41,7 @@
 Patch29: autofs-5.0.4-fix-double-free-in-expire_proc.patch
 Patch30: autofs-5.0.4-another-easy-alloca-replacements-fix.patch
 Patch31: autofs-5.0.4-add-lsb-init-script-parameter-block.patch
+Patch32: autofs-5.0.4-always-read-file-maps-fix.patch
 Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires: autoconf, hesiod-devel, openldap-devel, bison, flex, libxml2-devel, cyrus-sasl-devel, openssl-devel module-init-tools util-linux nfs-utils e2fsprogs libtirpc-devel
 Requires: kernel >= 2.6.17
@@ -113,6 +114,7 @@
 %patch29 -p1
 %patch30 -p1
 %patch31 -p1
+%patch32 -p1
 
 %build
 #CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --libdir=%{_libdir}
@@ -165,6 +167,10 @@
 %{_libdir}/autofs/
 
 %changelog
+* Tue Mar 17 2009 Ian Kent <ikent at redhat.com> - 1:5.0.4-21
+- fix file map lookup when reading included or nsswitch sources.
+  - a regression introduced by file map lookup optimisation in rev 9.
+
 * Fri Mar 13 2009 Ian Kent <ikent at redhat.com> - 1:5.0.4-20
 - add LSB init script parameter block.
 




More information about the fedora-extras-commits mailing list