|
Ian Kent |
a3a09e |
autofs-5.0.4 - add mount wait parameter
|
|
Ian Kent |
a3a09e |
|
|
Ian Kent |
a3a09e |
From: Ian Kent <raven@themaw.net>
|
|
Ian Kent |
a3a09e |
|
|
Ian Kent |
a3a09e |
Often delays when trying to mount from a server that is not reponding
|
|
Ian Kent |
a3a09e |
for some reason are undesirable. To try and prevent these delays we
|
|
Ian Kent |
a3a09e |
provide a configuration setting to limit the time that we wait for
|
|
Ian Kent |
a3a09e |
our spawned mount(8) process to complete before sending it a SIGTERM
|
|
Ian Kent |
a3a09e |
signal. This patch adds a configuration parameter to allow us to
|
|
Ian Kent |
a3a09e |
request we limit the time we wait for mount(8) to complete before
|
|
Ian Kent |
a3a09e |
send it a TERM signal.
|
|
Ian Kent |
a3a09e |
---
|
|
Ian Kent |
a3a09e |
|
|
Ian Kent |
a3a09e |
CHANGELOG | 1 +
|
|
Ian Kent |
a3a09e |
daemon/spawn.c | 3 ++-
|
|
Ian Kent |
a3a09e |
include/defaults.h | 2 ++
|
|
Ian Kent |
a3a09e |
lib/defaults.c | 13 +++++++++++++
|
|
Ian Kent |
a3a09e |
man/auto.master.5.in | 7 +++++++
|
|
Ian Kent |
a3a09e |
redhat/autofs.sysconfig.in | 9 +++++++++
|
|
Ian Kent |
a3a09e |
samples/autofs.conf.default.in | 9 +++++++++
|
|
Ian Kent |
a3a09e |
7 files changed, 43 insertions(+), 1 deletions(-)
|
|
Ian Kent |
a3a09e |
|
|
Ian Kent |
a3a09e |
|
|
Ian Kent |
a3a09e |
diff --git a/CHANGELOG b/CHANGELOG
|
|
Ian Kent |
a3a09e |
index 5adcca5..fadb229 100644
|
|
Ian Kent |
a3a09e |
--- a/CHANGELOG
|
|
Ian Kent |
a3a09e |
+++ b/CHANGELOG
|
|
Ian Kent |
a3a09e |
@@ -2,6 +2,7 @@
|
|
Ian Kent |
a3a09e |
-----------------------
|
|
Ian Kent |
a3a09e |
- fix included map read fail handling.
|
|
Ian Kent |
a3a09e |
- refactor ldap sasl bind handling.
|
|
Ian Kent |
a3a09e |
+- add mount wait timeout parameter.
|
|
Ian Kent |
a3a09e |
|
|
Ian Kent |
a3a09e |
03/09/2009 autofs-5.0.5
|
|
Ian Kent |
a3a09e |
-----------------------
|
|
Ian Kent |
a3a09e |
diff --git a/daemon/spawn.c b/daemon/spawn.c
|
|
Ian Kent |
a3a09e |
index e02d926..db356d4 100644
|
|
Ian Kent |
a3a09e |
--- a/daemon/spawn.c
|
|
Ian Kent |
a3a09e |
+++ b/daemon/spawn.c
|
|
Ian Kent |
a3a09e |
@@ -305,6 +305,7 @@ int spawn_mount(unsigned logopt, ...)
|
|
Ian Kent |
a3a09e |
unsigned int options;
|
|
Ian Kent |
a3a09e |
unsigned int retries = MTAB_LOCK_RETRIES;
|
|
Ian Kent |
a3a09e |
int update_mtab = 1, ret, printed = 0;
|
|
Ian Kent |
a3a09e |
+ unsigned int wait = defaults_get_mount_wait();
|
|
Ian Kent |
a3a09e |
char buf[PATH_MAX];
|
|
Ian Kent |
a3a09e |
|
|
Ian Kent |
a3a09e |
/* If we use mount locking we can't validate the location */
|
|
Ian Kent |
a3a09e |
@@ -355,7 +356,7 @@ int spawn_mount(unsigned logopt, ...)
|
|
Ian Kent |
a3a09e |
va_end(arg);
|
|
Ian Kent |
a3a09e |
|
|
Ian Kent |
a3a09e |
while (retries--) {
|
|
Ian Kent |
a3a09e |
- ret = do_spawn(logopt, -1, options, prog, (const char **) argv);
|
|
Ian Kent |
a3a09e |
+ ret = do_spawn(logopt, wait, options, prog, (const char **) argv);
|
|
Ian Kent |
a3a09e |
if (ret & MTAB_NOTUPDATED) {
|
|
Ian Kent |
a3a09e |
struct timespec tm = {3, 0};
|
|
Ian Kent |
a3a09e |
|
|
Ian Kent |
a3a09e |
diff --git a/include/defaults.h b/include/defaults.h
|
|
Ian Kent |
a3a09e |
index 9bf16e5..cda2174 100644
|
|
Ian Kent |
a3a09e |
--- a/include/defaults.h
|
|
Ian Kent |
a3a09e |
+++ b/include/defaults.h
|
|
Ian Kent |
a3a09e |
@@ -24,6 +24,7 @@
|
|
Ian Kent |
a3a09e |
|
|
Ian Kent |
a3a09e |
#define DEFAULT_TIMEOUT 600
|
|
Ian Kent |
a3a09e |
#define DEFAULT_NEGATIVE_TIMEOUT 60
|
|
Ian Kent |
a3a09e |
+#define DEFAULT_MOUNT_WAIT -1
|
|
Ian Kent |
a3a09e |
#define DEFAULT_UMOUNT_WAIT 12
|
|
Ian Kent |
a3a09e |
#define DEFAULT_BROWSE_MODE 1
|
|
Ian Kent |
a3a09e |
#define DEFAULT_LOGGING 0
|
|
Ian Kent |
a3a09e |
@@ -64,6 +65,7 @@ struct ldap_searchdn *defaults_get_searchdns(void);
|
|
Ian Kent |
a3a09e |
void defaults_free_searchdns(struct ldap_searchdn *);
|
|
Ian Kent |
a3a09e |
unsigned int defaults_get_mount_nfs_default_proto(void);
|
|
Ian Kent |
a3a09e |
unsigned int defaults_get_append_options(void);
|
|
Ian Kent |
a3a09e |
+unsigned int defaults_get_mount_wait(void);
|
|
Ian Kent |
a3a09e |
unsigned int defaults_get_umount_wait(void);
|
|
Ian Kent |
a3a09e |
const char *defaults_get_auth_conf_file(void);
|
|
Ian Kent |
a3a09e |
unsigned int defaults_get_map_hash_table_size(void);
|
|
Ian Kent |
a3a09e |
diff --git a/lib/defaults.c b/lib/defaults.c
|
|
Ian Kent |
a3a09e |
index 17164bd..2204b18 100644
|
|
Ian Kent |
a3a09e |
--- a/lib/defaults.c
|
|
Ian Kent |
a3a09e |
+++ b/lib/defaults.c
|
|
Ian Kent |
a3a09e |
@@ -47,6 +47,7 @@
|
|
Ian Kent |
a3a09e |
|
|
Ian Kent |
a3a09e |
#define ENV_MOUNT_NFS_DEFAULT_PROTOCOL "MOUNT_NFS_DEFAULT_PROTOCOL"
|
|
Ian Kent |
a3a09e |
#define ENV_APPEND_OPTIONS "APPEND_OPTIONS"
|
|
Ian Kent |
a3a09e |
+#define ENV_MOUNT_WAIT "MOUNT_WAIT"
|
|
Ian Kent |
a3a09e |
#define ENV_UMOUNT_WAIT "UMOUNT_WAIT"
|
|
Ian Kent |
a3a09e |
#define ENV_AUTH_CONF_FILE "AUTH_CONF_FILE"
|
|
Ian Kent |
a3a09e |
|
|
Ian Kent |
a3a09e |
@@ -325,6 +326,7 @@ unsigned int defaults_read_config(unsigned int to_syslog)
|
|
Ian Kent |
a3a09e |
check_set_config_value(key, ENV_NAME_ENTRY_ATTR, value, to_syslog) ||
|
|
Ian Kent |
a3a09e |
check_set_config_value(key, ENV_NAME_VALUE_ATTR, value, to_syslog) ||
|
|
Ian Kent |
a3a09e |
check_set_config_value(key, ENV_APPEND_OPTIONS, value, to_syslog) ||
|
|
Ian Kent |
a3a09e |
+ check_set_config_value(key, ENV_MOUNT_WAIT, value, to_syslog) ||
|
|
Ian Kent |
a3a09e |
check_set_config_value(key, ENV_UMOUNT_WAIT, value, to_syslog) ||
|
|
Ian Kent |
a3a09e |
check_set_config_value(key, ENV_AUTH_CONF_FILE, value, to_syslog) ||
|
|
Ian Kent |
a3a09e |
check_set_config_value(key, ENV_MAP_HASH_TABLE_SIZE, value, to_syslog) ||
|
|
Ian Kent |
a3a09e |
@@ -667,6 +669,17 @@ unsigned int defaults_get_append_options(void)
|
|
Ian Kent |
a3a09e |
return res;
|
|
Ian Kent |
a3a09e |
}
|
|
Ian Kent |
a3a09e |
|
|
Ian Kent |
a3a09e |
+unsigned int defaults_get_mount_wait(void)
|
|
Ian Kent |
a3a09e |
+{
|
|
Ian Kent |
a3a09e |
+ long wait;
|
|
Ian Kent |
a3a09e |
+
|
|
Ian Kent |
a3a09e |
+ wait = get_env_number(ENV_MOUNT_WAIT);
|
|
Ian Kent |
a3a09e |
+ if (wait < 0)
|
|
Ian Kent |
a3a09e |
+ wait = DEFAULT_MOUNT_WAIT;
|
|
Ian Kent |
a3a09e |
+
|
|
Ian Kent |
a3a09e |
+ return (unsigned int) wait;
|
|
Ian Kent |
a3a09e |
+}
|
|
Ian Kent |
a3a09e |
+
|
|
Ian Kent |
a3a09e |
unsigned int defaults_get_umount_wait(void)
|
|
Ian Kent |
a3a09e |
{
|
|
Ian Kent |
a3a09e |
long wait;
|
|
Ian Kent |
a3a09e |
diff --git a/man/auto.master.5.in b/man/auto.master.5.in
|
|
Ian Kent |
a3a09e |
index 71c4402..792035f 100644
|
|
Ian Kent |
a3a09e |
--- a/man/auto.master.5.in
|
|
Ian Kent |
a3a09e |
+++ b/man/auto.master.5.in
|
|
Ian Kent |
a3a09e |
@@ -174,6 +174,13 @@ Set the default timeout for caching failed key lookups (program default
|
|
Ian Kent |
a3a09e |
60). If the equivalent command line option is given it will override this
|
|
Ian Kent |
a3a09e |
setting.
|
|
Ian Kent |
a3a09e |
.TP
|
|
Ian Kent |
a3a09e |
+.B MOUNT_WAIT
|
|
Ian Kent |
a3a09e |
+Set the default time to wait for a response from a spawned mount(8)
|
|
Ian Kent |
a3a09e |
+before sending it a SIGTERM. Note that we still need to wait for the
|
|
Ian Kent |
a3a09e |
+RPC layer to timeout before the sub-process exits so this isn't ideal
|
|
Ian Kent |
a3a09e |
+but it is the best we can do. The default is to wait until mount(8)
|
|
Ian Kent |
a3a09e |
+returns without intervention.
|
|
Ian Kent |
a3a09e |
+.TP
|
|
Ian Kent |
a3a09e |
.B UMOUNT_WAIT
|
|
Ian Kent |
a3a09e |
Set the default time to wait for a response from a spawned umount(8)
|
|
Ian Kent |
a3a09e |
before sending it a SIGTERM. Note that we still need to wait for the
|
|
Ian Kent |
a3a09e |
diff --git a/redhat/autofs.sysconfig.in b/redhat/autofs.sysconfig.in
|
|
Ian Kent |
a3a09e |
index 37448ea..c72cd2b 100644
|
|
Ian Kent |
a3a09e |
--- a/redhat/autofs.sysconfig.in
|
|
Ian Kent |
a3a09e |
+++ b/redhat/autofs.sysconfig.in
|
|
Ian Kent |
a3a09e |
@@ -14,6 +14,15 @@ TIMEOUT=300
|
|
Ian Kent |
a3a09e |
#
|
|
Ian Kent |
a3a09e |
#NEGATIVE_TIMEOUT=60
|
|
Ian Kent |
a3a09e |
#
|
|
Ian Kent |
a3a09e |
+# MOUNT_WAIT - time to wait for a response from umount(8).
|
|
Ian Kent |
a3a09e |
+# Setting this timeout can cause problems when
|
|
Ian Kent |
a3a09e |
+# mount would otherwise wait for a server that
|
|
Ian Kent |
a3a09e |
+# is temporarily unavailable, such as when it's
|
|
Ian Kent |
a3a09e |
+# restarting. The defailt of waiting for mount(8)
|
|
Ian Kent |
a3a09e |
+# usually results in a wait of around 3 minutes.
|
|
Ian Kent |
a3a09e |
+#
|
|
Ian Kent |
a3a09e |
+#MOUNT_WAIT=-1
|
|
Ian Kent |
a3a09e |
+#
|
|
Ian Kent |
a3a09e |
# UMOUNT_WAIT - time to wait for a response from umount(8).
|
|
Ian Kent |
a3a09e |
#
|
|
Ian Kent |
a3a09e |
#UMOUNT_WAIT=12
|
|
Ian Kent |
a3a09e |
diff --git a/samples/autofs.conf.default.in b/samples/autofs.conf.default.in
|
|
Ian Kent |
a3a09e |
index 7dee5fd..b87c4d0 100644
|
|
Ian Kent |
a3a09e |
--- a/samples/autofs.conf.default.in
|
|
Ian Kent |
a3a09e |
+++ b/samples/autofs.conf.default.in
|
|
Ian Kent |
a3a09e |
@@ -14,6 +14,15 @@ TIMEOUT=300
|
|
Ian Kent |
a3a09e |
#
|
|
Ian Kent |
a3a09e |
#NEGATIVE_TIMEOUT=60
|
|
Ian Kent |
a3a09e |
#
|
|
Ian Kent |
a3a09e |
+# MOUNT_WAIT - time to wait for a response from umount(8).
|
|
Ian Kent |
a3a09e |
+# Setting this timeout can cause problems when
|
|
Ian Kent |
a3a09e |
+# mount would otherwise wait for a server that
|
|
Ian Kent |
a3a09e |
+# is temporarily unavailable, such as when it's
|
|
Ian Kent |
a3a09e |
+# restarting. The defailt of waiting for mount(8)
|
|
Ian Kent |
a3a09e |
+# usually results in a wait of around 3 minutes.
|
|
Ian Kent |
a3a09e |
+#
|
|
Ian Kent |
a3a09e |
+#MOUNT_WAIT=-1
|
|
Ian Kent |
a3a09e |
+#
|
|
Ian Kent |
a3a09e |
# UMOUNT_WAIT - time to wait for a response from umount(8).
|
|
Ian Kent |
a3a09e |
#
|
|
Ian Kent |
a3a09e |
#UMOUNT_WAIT=12
|