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

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