Blame SOURCES/autofs-5.1.2-delay-submount-exit-for-amd-submounts.patch

304803
autofs-5.1.2 - delay submount exit for amd submounts
304803
304803
From: Ian Kent <raven@themaw.net>
304803
304803
For amd format maps it's better to not expire away submounts (amd
304803
type "auto" mounts) straight way.
304803
304803
This is because of the common heavy reuse of maps in amd maps and
304803
we want to try and avoid constantly re-reading large maps.
304803
304803
Signed-off-by: Ian Kent <raven@themaw.net>
304803
---
304803
 CHANGELOG      |    1 +
304803
 daemon/state.c |   18 +++++++++++++++---
304803
 2 files changed, 16 insertions(+), 3 deletions(-)
304803
304803
--- autofs-5.0.7.orig/CHANGELOG
304803
+++ autofs-5.0.7/CHANGELOG
304803
@@ -234,6 +234,7 @@
304803
 - handle map_option cache for top level mounts.
304803
 - handle amd cache option all in amd type auto mounts.
304803
 - fix bogus check in expire_cleanup().
304803
+- delay submount exit for amd submounts.
304803
 
304803
 25/07/2012 autofs-5.0.7
304803
 =======================
304803
--- autofs-5.0.7.orig/daemon/state.c
304803
+++ autofs-5.0.7/daemon/state.c
304803
@@ -132,15 +132,27 @@ void expire_cleanup(void *arg)
304803
 			 * mount expires in a reasonable time. Just skip
304803
 			 * one expire check after it's no longer busy before
304803
 			 * allowing it to shutdown.
304803
+			 *
304803
+			 * But if this mount point is an amd format map it
304803
+			 * is better to keep the mount around longer. This
304803
+			 * is because of the common heavy reuse of maps in
304803
+			 * amd maps and we want to try and avoid constantly
304803
+			 * re-reading large maps.
304803
 			 */
304803
 			if (ap->submount && !success) {
304803
 				rv = ops->askumount(ap->logopt, ap->ioctlfd, &idle);
304803
 				if (!rv && idle && ap->submount > 1) {
304803
-					next = ST_SHUTDOWN_PENDING;
304803
-					break;
304803
+					struct map_source *map = ap->entry->maps;
304803
+
304803
+					if (ap->submount > 4 ||
304803
+					   !(map->flags & MAP_FLAG_FORMAT_AMD)) {
304803
+						next = ST_SHUTDOWN_PENDING;
304803
+						break;
304803
+					}
304803
 				}
304803
 				ap->submount++;
304803
-			}
304803
+			} else if (ap->submount > 1)
304803
+				ap->submount = 1;
304803
 
304803
 			if (ap->state == ST_EXPIRE && !ap->submount)
304803
 				alarm_add(ap, ap->exp_runfreq);