[autofs] - add some upstream fixes and add want target network-online target (bz1071591).

Ian Kent iankent at fedoraproject.org
Wed Jan 21 05:48:00 UTC 2015


commit eb691956de4d6080d05134b4e480f491c6c2f83b
Author: Ian Kent <ikent at redhat.com>
Date:   Wed Jan 21 13:47:31 2015 +0800

    - add some upstream fixes and add want target network-online target (bz1071591).

 ...5.1.0-dont-add-wildcard-to-negative-cache.patch |   54 ++++++++++
 ...re-negative-cache-isnt-updated-on-remount.patch |   53 ++++++++++
 ...-update-consistent-for-all-lookup-modules.patch |  108 ++++++++++++++++++++
 ...fs-5.1.0-make-service-want-network-online.patch |   42 ++++++++
 autofs.spec                                        |   16 +++-
 5 files changed, 272 insertions(+), 1 deletions(-)
---
diff --git a/autofs-5.1.0-dont-add-wildcard-to-negative-cache.patch b/autofs-5.1.0-dont-add-wildcard-to-negative-cache.patch
new file mode 100644
index 0000000..24bc7e1
--- /dev/null
+++ b/autofs-5.1.0-dont-add-wildcard-to-negative-cache.patch
@@ -0,0 +1,54 @@
+autofs-5.1.0 - dont add wildcard to negative cache
+
+From: Ian Kent <ikent at redhat.com>
+
+If the wilcard is added to the negative cache it prevents any
+further matching of the wildcard for the given map.
+---
+ CHANGELOG       |    1 +
+ daemon/lookup.c |    4 ++++
+ lib/cache.c     |    4 ++++
+ 3 files changed, 9 insertions(+)
+
+diff --git a/CHANGELOG b/CHANGELOG
+index 6903b5d..d09567a 100644
+--- a/CHANGELOG
++++ b/CHANGELOG
+@@ -39,6 +39,7 @@
+ - fix hosts map update on reload.
+ - make negative cache update consistent for all lookup modules.
+ - ensure negative cache isn't updated on remount.
++- dont add wildcard to negative cache.
+ 
+ 04/06/2014 autofs-5.1.0
+ =======================
+diff --git a/daemon/lookup.c b/daemon/lookup.c
+index 6444fa5..62071df 100644
+--- a/daemon/lookup.c
++++ b/daemon/lookup.c
+@@ -1057,6 +1057,10 @@ static void update_negative_cache(struct autofs_point *ap, struct map_source *so
+ 	if (source && source->depth)
+ 		return;
+ 
++	/* Don't update the wildcard */
++	if (strlen(name) == 1 && *name == '*')
++		return;
++
+ 	/* Have we recorded the lookup fail for negative caching? */
+ 	me = lookup_source_mapent(ap, name, LKP_DISTINCT);
+ 	if (me)
+diff --git a/lib/cache.c b/lib/cache.c
+index 4bab5a3..666c9bc 100644
+--- a/lib/cache.c
++++ b/lib/cache.c
+@@ -762,6 +762,10 @@ void cache_update_negative(struct mapent_cache *mc,
+ 	struct mapent *me;
+ 	int rv = CHE_OK;
+ 
++	if (strlen(key) == 1 && *key == '*')
++		return;
++
++	/* Don't update the wildcard */
+ 	me = cache_lookup_distinct(mc, key);
+ 	if (me)
+ 		rv = cache_push_mapent(me, NULL);
diff --git a/autofs-5.1.0-ensure-negative-cache-isnt-updated-on-remount.patch b/autofs-5.1.0-ensure-negative-cache-isnt-updated-on-remount.patch
new file mode 100644
index 0000000..1dce31a
--- /dev/null
+++ b/autofs-5.1.0-ensure-negative-cache-isnt-updated-on-remount.patch
@@ -0,0 +1,53 @@
+autofs-5.1.0 - ensure negative cache isn't updated on remount
+
+From: Ian Kent <ikent at redhat.com>
+
+The negative cache shouldn't be updated when re-connecting at
+startup but a couple of lookup modules didn't check for this
+case.
+---
+ CHANGELOG                |    1 +
+ modules/lookup_hosts.c   |    3 +++
+ modules/lookup_program.c |    3 +++
+ 3 files changed, 7 insertions(+)
+
+diff --git a/CHANGELOG b/CHANGELOG
+index 37b2cde..6903b5d 100644
+--- a/CHANGELOG
++++ b/CHANGELOG
+@@ -38,6 +38,7 @@
+ - fix typo in update_hosts_mounts().
+ - fix hosts map update on reload.
+ - make negative cache update consistent for all lookup modules.
++- ensure negative cache isn't updated on remount.
+ 
+ 04/06/2014 autofs-5.1.0
+ =======================
+diff --git a/modules/lookup_hosts.c b/modules/lookup_hosts.c
+index 02bf970..0d48356 100644
+--- a/modules/lookup_hosts.c
++++ b/modules/lookup_hosts.c
+@@ -151,6 +151,9 @@ static int do_parse_mount(struct autofs_point *ap, struct map_source *source,
+ 	if (ret) {
+ 		struct mapent_cache *mc = source->mc;
+ 
++		/* Don't update negative cache when re-connecting */
++		if (ap->flags & MOUNT_FLAG_REMOUNT)
++			return NSS_STATUS_TRYAGAIN;
+ 		cache_writelock(mc);
+ 		cache_update_negative(mc, source, name, ap->negative_timeout);
+ 		cache_unlock(mc);
+diff --git a/modules/lookup_program.c b/modules/lookup_program.c
+index bf0e350..8e8fd49 100644
+--- a/modules/lookup_program.c
++++ b/modules/lookup_program.c
+@@ -622,6 +622,9 @@ out_free:
+ 		free(mapent);
+ 
+ 	if (ret) {
++		/* Don't update negative cache when re-connecting */
++		if (ap->flags & MOUNT_FLAG_REMOUNT)
++			return NSS_STATUS_TRYAGAIN;
+ 		cache_writelock(mc);
+ 		cache_update_negative(mc, source, name, ap->negative_timeout);
+ 		cache_unlock(mc);
diff --git a/autofs-5.1.0-make-negative-cache-update-consistent-for-all-lookup-modules.patch b/autofs-5.1.0-make-negative-cache-update-consistent-for-all-lookup-modules.patch
new file mode 100644
index 0000000..4bdd167
--- /dev/null
+++ b/autofs-5.1.0-make-negative-cache-update-consistent-for-all-lookup-modules.patch
@@ -0,0 +1,108 @@
+autofs-5.1.0 - make negative cache update consistent for all lookup modules
+
+From: Ian Kent <ikent at redhat.com>
+
+Use common function for negative cache update everywhere to ensure consistency.
+---
+ CHANGELOG                |    1 +
+ modules/lookup_hosts.c   |   14 +-------------
+ modules/lookup_nisplus.c |   13 +------------
+ modules/lookup_program.c |   14 +-------------
+ 4 files changed, 4 insertions(+), 38 deletions(-)
+
+diff --git a/CHANGELOG b/CHANGELOG
+index 59f2906..37b2cde 100644
+--- a/CHANGELOG
++++ b/CHANGELOG
+@@ -37,6 +37,7 @@
+ - init qdn before use in get_query_dn().
+ - fix typo in update_hosts_mounts().
+ - fix hosts map update on reload.
++- make negative cache update consistent for all lookup modules.
+ 
+ 04/06/2014 autofs-5.1.0
+ =======================
+diff --git a/modules/lookup_hosts.c b/modules/lookup_hosts.c
+index 407cf31..02bf970 100644
+--- a/modules/lookup_hosts.c
++++ b/modules/lookup_hosts.c
+@@ -149,22 +149,10 @@ static int do_parse_mount(struct autofs_point *ap, struct map_source *source,
+ 	ret = ctxt->parse->parse_mount(ap, name, name_len,
+ 				 mapent, ctxt->parse->context);
+ 	if (ret) {
+-		time_t now = time(NULL);
+ 		struct mapent_cache *mc = source->mc;
+-		struct mapent *me;
+-		int rv = CHE_OK;
+ 
+ 		cache_writelock(mc);
+-		me = cache_lookup_distinct(mc, name);
+-		if (me)
+-			rv = cache_push_mapent(me, NULL);
+-		else
+-			rv = cache_update(mc, source, name, NULL, now);
+-		if (rv != CHE_FAIL) {
+-			me = cache_lookup_distinct(mc, name);
+-			if (me)
+-				me->status = now + ap->negative_timeout;
+-		}
++		cache_update_negative(mc, source, name, ap->negative_timeout);
+ 		cache_unlock(mc);
+ 		return NSS_STATUS_TRYAGAIN;
+ 	}
+diff --git a/modules/lookup_nisplus.c b/modules/lookup_nisplus.c
+index db1b162..d5eba47 100644
+--- a/modules/lookup_nisplus.c
++++ b/modules/lookup_nisplus.c
+@@ -777,24 +777,13 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void *
+ 	ret = ctxt->parse->parse_mount(ap, key, key_len,
+ 				       mapent, ctxt->parse->context);
+ 	if (ret) {
+-		time_t now = time(NULL);
+-		int rv = CHE_OK;
+-
+ 		free(mapent);
+ 
+ 		/* Don't update negative cache when re-connecting */
+ 		if (ap->flags & MOUNT_FLAG_REMOUNT)
+ 			return NSS_STATUS_TRYAGAIN;
+ 		cache_writelock(mc);
+-		me = cache_lookup_distinct(mc, key);
+-		if (me)
+-			rv = cache_push_mapent(me, NULL);
+-		else
+-			rv = cache_update(mc, source, key, NULL, now);
+-		if (rv != CHE_FAIL) {
+-			me = cache_lookup_distinct(mc, key);
+-			me->status = time(NULL) + ap->negative_timeout;
+-		}
++		cache_update_negative(mc, source, key, ap->negative_timeout);
+ 		cache_unlock(mc);
+ 		return NSS_STATUS_TRYAGAIN;
+ 	}
+diff --git a/modules/lookup_program.c b/modules/lookup_program.c
+index aae0ec0..bf0e350 100644
+--- a/modules/lookup_program.c
++++ b/modules/lookup_program.c
+@@ -622,20 +622,8 @@ out_free:
+ 		free(mapent);
+ 
+ 	if (ret) {
+-		time_t now = time(NULL);
+-		int rv = CHE_OK;
+-
+ 		cache_writelock(mc);
+-		me = cache_lookup_distinct(mc, name);
+-		if (me)
+-			rv = cache_push_mapent(me, NULL);
+-		else
+-			rv = cache_update(mc, source, name, NULL, now);
+-		if (rv != CHE_FAIL) {
+-			me = cache_lookup_distinct(mc, name);
+-			if (me)
+-				me->status = now + ap->negative_timeout;
+-		}
++		cache_update_negative(mc, source, name, ap->negative_timeout);
+ 		cache_unlock(mc);
+ 		return NSS_STATUS_TRYAGAIN;
+ 	}
diff --git a/autofs-5.1.0-make-service-want-network-online.patch b/autofs-5.1.0-make-service-want-network-online.patch
new file mode 100644
index 0000000..062ddd3
--- /dev/null
+++ b/autofs-5.1.0-make-service-want-network-online.patch
@@ -0,0 +1,42 @@
+autofs-5.1.0 - make service want network-online
+
+From: Ian Kent <ikent at redhat.com>
+
+autofs often fails to start properly in Fedora with recent systemd.
+
+Changing the systemd unit to Want the network-online target works
+around this.
+
+I'm not sure if this will cause problems for people that use file
+maps and expect autofs to start without the network up but I hope
+that's a small minority, if there are any at all.
+---
+ CHANGELOG                 |    1 +
+ samples/autofs.service.in |    3 ++-
+ 2 files changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/CHANGELOG b/CHANGELOG
+index d09567a..9b8de1c 100644
+--- a/CHANGELOG
++++ b/CHANGELOG
+@@ -40,6 +40,7 @@
+ - make negative cache update consistent for all lookup modules.
+ - ensure negative cache isn't updated on remount.
+ - dont add wildcard to negative cache.
++- make service want network-online.
+ 
+ 04/06/2014 autofs-5.1.0
+ =======================
+diff --git a/samples/autofs.service.in b/samples/autofs.service.in
+index 777463d..d4de6ff 100644
+--- a/samples/autofs.service.in
++++ b/samples/autofs.service.in
+@@ -1,6 +1,7 @@
+ [Unit]
+ Description=Automounts filesystems on demand
+-After=network.target ypbind.service sssd.service
++After=network.target ypbind.service sssd.service network-online.target
++Wants=network-online.target
+ 
+ [Service]
+ Type=forking
diff --git a/autofs.spec b/autofs.spec
index b4cc394..ded982d 100644
--- a/autofs.spec
+++ b/autofs.spec
@@ -8,7 +8,7 @@
 Summary: A tool for automatically mounting and unmounting filesystems
 Name: autofs
 Version: 5.1.0
-Release: 9%{?dist}
+Release: 10%{?dist}
 Epoch: 1
 License: GPLv2+
 Group: System Environment/Daemons
@@ -50,6 +50,10 @@ Patch34: autofs-5.1.0-fix-fix-master-map-type-check.patch
 Patch35: autofs-5.1.0-init-qdn-before-use.patch
 Patch36: autofs-5.1.0-fix-typo-in-update_hosts_mounts.patch
 Patch37: autofs-5.1.0-fix-hosts-map-update-on-reload.patch
+Patch38: autofs-5.1.0-make-negative-cache-update-consistent-for-all-lookup-modules.patch
+Patch39: autofs-5.1.0-ensure-negative-cache-isnt-updated-on-remount.patch
+Patch40: autofs-5.1.0-dont-add-wildcard-to-negative-cache.patch
+Patch41: autofs-5.1.0-make-service-want-network-online.patch
 Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 %if %{with_systemd}
 BuildRequires: systemd-units
@@ -143,6 +147,10 @@ echo %{version}-%{release} > .version
 %patch35 -p1
 %patch36 -p1
 %patch37 -p1
+%patch38 -p1
+%patch39 -p1
+%patch40 -p1
+%patch41 -p1
 
 %build
 LDFLAGS=-Wl,-z,now
@@ -236,6 +244,12 @@ fi
 %dir /etc/auto.master.d
 
 %changelog
+* Wed Jan 21 2015 Ian Kent <ikent at redhat.com> - 1:5.1.0-10
+- make negative cache update consistent for all lookup modules.
+- ensure negative cache isn't updated on remount.
+- dont add wildcard to negative cache.
+- make service want network-online (bz1071591).
+
 * Tue Nov 18 2014 Ian Kent <ikent at redhat.com> - 1:5.1.0-9
 - fix custom autofs.conf not being installed.
 - init qdn before use in get_query_dn().


More information about the scm-commits mailing list