Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 130701790bf2d95e902edf16031ff596 > files > 270

autofs-5.0.1-0.rc2.164.el5_8.src.rpm

autofs-5.0.3 - add configuration paramter UMOUNT_WAIT

From: Ian Kent <raven@themaw.net>

To try and prevent expire delays when trying to umount from a server
that is not available we limit the time that we wait for a response
from the spawned umount process before sending it a SIGTERM signal.
This patch adds a configuration parameter to allow this wait to be
changed if needed.
---

 daemon/spawn.c                 |    2 +-
 include/defaults.h             |    2 ++
 lib/defaults.c                 |   13 +++++++++++++
 man/auto.master.5.in           |    6 ++++++
 redhat/autofs.sysconfig.in     |    4 ++++
 samples/autofs.conf.default.in |    4 ++++
 6 files changed, 30 insertions(+), 1 deletions(-)


diff --git a/daemon/spawn.c b/daemon/spawn.c
index e3c355e..6b26c41 100644
--- a/daemon/spawn.c
+++ b/daemon/spawn.c
@@ -502,7 +502,7 @@ int spawn_umount(unsigned logopt, ...)
 	unsigned int options;
 	unsigned int retries = MTAB_LOCK_RETRIES;
 	int ret, printed = 0;
-	unsigned int wait = 12;
+	unsigned int wait = defaults_get_umount_wait();
 
 #ifdef ENABLE_MOUNT_LOCKING
 	options = SPAWN_OPT_LOCK;
diff --git a/include/defaults.h b/include/defaults.h
index 6e4f52a..12534ec 100644
--- a/include/defaults.h
+++ b/include/defaults.h
@@ -24,6 +24,7 @@
 
 #define DEFAULT_TIMEOUT			600
 #define DEFAULT_NEGATIVE_TIMEOUT	60
+#define DEFAULT_UMOUNT_WAIT		12
 #define DEFAULT_BROWSE_MODE		1
 #define DEFAULT_LOGGING			0
 
@@ -59,6 +60,7 @@ struct ldap_schema *defaults_get_schema(void);
 struct ldap_searchdn *defaults_get_searchdns(void);
 void defaults_free_searchdns(struct ldap_searchdn *);
 unsigned int defaults_get_append_options(void);
+unsigned int defaults_get_umount_wait(void);
 const char *defaults_get_auth_conf_file(void);
 
 #endif
diff --git a/lib/defaults.c b/lib/defaults.c
index 8149549..21d76d2 100644
--- a/lib/defaults.c
+++ b/lib/defaults.c
@@ -45,6 +45,7 @@
 #define ENV_NAME_VALUE_ATTR		"VALUE_ATTRIBUTE"
 
 #define ENV_APPEND_OPTIONS		"APPEND_OPTIONS"
+#define ENV_UMOUNT_WAIT			"UMOUNT_WAIT"
 #define ENV_AUTH_CONF_FILE		"AUTH_CONF_FILE"
 
 static const char *default_master_map_name = DEFAULT_MASTER_MAP_NAME;
@@ -320,6 +321,7 @@ unsigned int defaults_read_config(unsigned int to_syslog)
 		    check_set_config_value(key, ENV_NAME_ENTRY_ATTR, value, to_syslog) ||
 		    check_set_config_value(key, ENV_NAME_VALUE_ATTR, value, to_syslog) ||
 		    check_set_config_value(key, ENV_APPEND_OPTIONS, value, to_syslog) ||
+		    check_set_config_value(key, ENV_UMOUNT_WAIT, value, to_syslog) ||
 		    check_set_config_value(key, ENV_AUTH_CONF_FILE, value, to_syslog))
 			;
 	}
@@ -647,6 +649,17 @@ unsigned int defaults_get_append_options(void)
 	return res;
 }
 
+unsigned int defaults_get_umount_wait(void)
+{
+	long wait;
+
+	wait = get_env_number(ENV_UMOUNT_WAIT);
+	if (wait < 0)
+		wait = DEFAULT_UMOUNT_WAIT;
+
+	return (unsigned int) wait;
+}
+
 const char *defaults_get_auth_conf_file(void)
 {
 	char *cf;
diff --git a/man/auto.master.5.in b/man/auto.master.5.in
index 49a711c..9cc5f02 100644
--- a/man/auto.master.5.in
+++ b/man/auto.master.5.in
@@ -174,6 +174,12 @@ Set the default timeout for caching failed key lookups (program default
 60). If the equivalent command line option is given it will override this
 setting.
 .TP
+.B UMOUNT_WAIT
+Set the default time to wait for a response from a spawned umount(8)
+before sending it a SIGTERM. Note that we still need to wait for the
+RPC layer to timeout before the sub-process exits so this isn't ideal
+but it is the best we can do.
+.TP
 .B BROWSE_MODE
 Maps are browsable by default (program default "yes").
 .TP
diff --git a/redhat/autofs.sysconfig.in b/redhat/autofs.sysconfig.in
index 636763a..ce64feb 100644
--- a/redhat/autofs.sysconfig.in
+++ b/redhat/autofs.sysconfig.in
@@ -14,6 +14,10 @@ TIMEOUT=300
 #
 #NEGATIVE_TIMEOUT=60
 #
+# UMOUNT_WAIT - time to wait for a response from umount(8).
+#
+#UMOUNT_WAIT=12
+#
 # BROWSE_MODE - maps are browsable by default.
 #
 BROWSE_MODE="no"
diff --git a/samples/autofs.conf.default.in b/samples/autofs.conf.default.in
index 086ba4f..0231e1d 100644
--- a/samples/autofs.conf.default.in
+++ b/samples/autofs.conf.default.in
@@ -14,6 +14,10 @@ TIMEOUT=300
 #
 #NEGATIVE_TIMEOUT=60
 #
+# UMOUNT_WAIT - time to wait for a response from umount(8).
+#
+#UMOUNT_WAIT=12
+#
 # BROWSE_MODE - maps are browsable by default.
 #
 BROWSE_MODE="no"