|
|
4d476f |
autofs-5.1.2 - add master read wait option
|
|
|
4d476f |
|
|
|
4d476f |
From: Ian Kent <raven@themaw.net>
|
|
|
4d476f |
|
|
|
4d476f |
Add command line and configuration options to set the amount of time to
|
|
|
4d476f |
wait for the master map to become available at program start.
|
|
|
4d476f |
|
|
|
4d476f |
Signed-off-by: Ian Kent <raven@themaw.net>
|
|
|
4d476f |
---
|
|
|
4d476f |
CHANGELOG | 1 +
|
|
|
4d476f |
daemon/automount.c | 11 +++++++++--
|
|
|
4d476f |
include/defaults.h | 2 ++
|
|
|
4d476f |
lib/defaults.c | 17 +++++++++++++++++
|
|
|
4d476f |
man/autofs.conf.5.in | 5 +++++
|
|
|
4d476f |
man/automount.8 | 4 ++++
|
|
|
4d476f |
redhat/autofs.conf.default.in | 7 +++++++
|
|
|
4d476f |
samples/autofs.conf.default.in | 7 +++++++
|
|
|
4d476f |
8 files changed, 52 insertions(+), 2 deletions(-)
|
|
|
4d476f |
|
|
|
4d476f |
--- autofs-5.0.7.orig/CHANGELOG
|
|
|
4d476f |
+++ autofs-5.0.7/CHANGELOG
|
|
|
4d476f |
@@ -207,6 +207,7 @@
|
|
|
4d476f |
- fix use-after-free in st_queue_handler().
|
|
|
4d476f |
- add config option to supress not found log message.
|
|
|
4d476f |
- wait for master map available at start.
|
|
|
4d476f |
+- add master read wait option.
|
|
|
4d476f |
|
|
|
4d476f |
25/07/2012 autofs-5.0.7
|
|
|
4d476f |
=======================
|
|
|
4d476f |
--- autofs-5.0.7.orig/daemon/automount.c
|
|
|
4d476f |
+++ autofs-5.0.7/daemon/automount.c
|
|
|
4d476f |
@@ -2082,10 +2082,11 @@ int main(int argc, char *argv[])
|
|
|
4d476f |
unsigned ghost, logging, daemon_check;
|
|
|
4d476f |
unsigned dumpmaps, foreground, have_global_options;
|
|
|
4d476f |
unsigned master_read;
|
|
|
4d476f |
+ int master_wait;
|
|
|
4d476f |
time_t timeout;
|
|
|
4d476f |
time_t age = time(NULL);
|
|
|
4d476f |
struct rlimit rlim;
|
|
|
4d476f |
- const char *options = "+hp:t:vmdD:fVrO:l:n:CF";
|
|
|
4d476f |
+ const char *options = "+hp:t:vmdD:fVrO:l:n:CFM";
|
|
|
4d476f |
static const struct option long_options[] = {
|
|
|
4d476f |
{"help", 0, 0, 'h'},
|
|
|
4d476f |
{"pid-file", 1, 0, 'p'},
|
|
|
4d476f |
@@ -2102,6 +2103,7 @@ int main(int argc, char *argv[])
|
|
|
4d476f |
{"set-log-priority", 1, 0, 'l'},
|
|
|
4d476f |
{"dont-check-daemon", 0, 0, 'C'},
|
|
|
4d476f |
{"force", 0, 0, 'F'},
|
|
|
4d476f |
+ {"master-wait", 1, 0, 'M'},
|
|
|
4d476f |
{0, 0, 0, 0}
|
|
|
4d476f |
};
|
|
|
4d476f |
|
|
|
4d476f |
@@ -2122,6 +2124,7 @@ int main(int argc, char *argv[])
|
|
|
4d476f |
nfs_mount_uses_string_options = check_nfs_mount_version(&vers, &check);
|
|
|
4d476f |
|
|
|
4d476f |
kpkt_len = get_kpkt_len();
|
|
|
4d476f |
+ master_wait = defaults_get_master_wait();
|
|
|
4d476f |
timeout = defaults_get_timeout();
|
|
|
4d476f |
ghost = defaults_get_browse_mode();
|
|
|
4d476f |
logging = defaults_get_logging();
|
|
|
4d476f |
@@ -2181,6 +2184,10 @@ int main(int argc, char *argv[])
|
|
|
4d476f |
dumpmaps = 1;
|
|
|
4d476f |
break;
|
|
|
4d476f |
|
|
|
4d476f |
+ case 'M':
|
|
|
4d476f |
+ master_wait = getnumopt(optarg, opt);
|
|
|
4d476f |
+ break;
|
|
|
4d476f |
+
|
|
|
4d476f |
case 'O':
|
|
|
4d476f |
if (!have_global_options) {
|
|
|
4d476f |
global_options = strdup(optarg);
|
|
|
4d476f |
@@ -2502,7 +2509,7 @@ int main(int argc, char *argv[])
|
|
|
4d476f |
* a signal is received, in which case exit returning an
|
|
|
4d476f |
* error.
|
|
|
4d476f |
*/
|
|
|
4d476f |
- if (!do_master_read_master(master_list, -1)) {
|
|
|
4d476f |
+ if (!do_master_read_master(master_list, master_wait)) {
|
|
|
4d476f |
logerr("%s: failed to read master map!", program);
|
|
|
4d476f |
master_kill(master_list);
|
|
|
4d476f |
release_flag_file();
|
|
|
4d476f |
--- autofs-5.0.7.orig/include/defaults.h
|
|
|
4d476f |
+++ autofs-5.0.7/include/defaults.h
|
|
|
4d476f |
@@ -25,6 +25,7 @@
|
|
|
4d476f |
#define DEFAULT_MASTER_MAP_NAME "auto.master"
|
|
|
4d476f |
|
|
|
4d476f |
#define DEFAULT_TIMEOUT "600"
|
|
|
4d476f |
+#define DEFAULT_MASTER_WAIT "-1"
|
|
|
4d476f |
#define DEFAULT_NEGATIVE_TIMEOUT "60"
|
|
|
4d476f |
#define DEFAULT_MOUNT_WAIT "-1"
|
|
|
4d476f |
#define DEFAULT_UMOUNT_WAIT "12"
|
|
|
4d476f |
@@ -152,6 +153,7 @@ void defaults_conf_release(void);
|
|
|
4d476f |
const char *defaults_get_master_map(void);
|
|
|
4d476f |
int defaults_master_set(void);
|
|
|
4d476f |
unsigned int defaults_get_timeout(void);
|
|
|
4d476f |
+int defaults_get_master_wait(void);
|
|
|
4d476f |
unsigned int defaults_get_negative_timeout(void);
|
|
|
4d476f |
unsigned int defaults_get_browse_mode(void);
|
|
|
4d476f |
unsigned int defaults_get_logging(void);
|
|
|
4d476f |
--- autofs-5.0.7.orig/lib/defaults.c
|
|
|
4d476f |
+++ autofs-5.0.7/lib/defaults.c
|
|
|
4d476f |
@@ -47,6 +47,7 @@
|
|
|
4d476f |
#define NAME_MASTER_MAP "master_map_name"
|
|
|
4d476f |
|
|
|
4d476f |
#define NAME_TIMEOUT "timeout"
|
|
|
4d476f |
+#define NAME_MASTER_WAIT "master_wait"
|
|
|
4d476f |
#define NAME_NEGATIVE_TIMEOUT "negative_timeout"
|
|
|
4d476f |
#define NAME_BROWSE_MODE "browse_mode"
|
|
|
4d476f |
#define NAME_LOGGING "logging"
|
|
|
4d476f |
@@ -287,6 +288,11 @@ static int conf_load_autofs_defaults(voi
|
|
|
4d476f |
if (ret == CFG_FAIL)
|
|
|
4d476f |
goto error;
|
|
|
4d476f |
|
|
|
4d476f |
+ ret = conf_update(sec, NAME_MASTER_WAIT,
|
|
|
4d476f |
+ DEFAULT_MASTER_WAIT, CONF_ENV);
|
|
|
4d476f |
+ if (ret == CFG_FAIL)
|
|
|
4d476f |
+ goto error;
|
|
|
4d476f |
+
|
|
|
4d476f |
ret = conf_update(sec, NAME_NEGATIVE_TIMEOUT,
|
|
|
4d476f |
DEFAULT_NEGATIVE_TIMEOUT, CONF_ENV);
|
|
|
4d476f |
if (ret == CFG_FAIL)
|
|
|
4d476f |
@@ -1568,6 +1574,17 @@ unsigned int defaults_get_timeout(void)
|
|
|
4d476f |
return (unsigned int) timeout;
|
|
|
4d476f |
}
|
|
|
4d476f |
|
|
|
4d476f |
+int defaults_get_master_wait(void)
|
|
|
4d476f |
+{
|
|
|
4d476f |
+ long wait;
|
|
|
4d476f |
+
|
|
|
4d476f |
+ wait = conf_get_number(autofs_gbl_sec, NAME_MASTER_WAIT);
|
|
|
4d476f |
+ if (wait < 0)
|
|
|
4d476f |
+ wait = atol(DEFAULT_MASTER_WAIT);
|
|
|
4d476f |
+
|
|
|
4d476f |
+ return (int) wait;
|
|
|
4d476f |
+}
|
|
|
4d476f |
+
|
|
|
4d476f |
unsigned int defaults_get_negative_timeout(void)
|
|
|
4d476f |
{
|
|
|
4d476f |
long n_timeout;
|
|
|
4d476f |
--- autofs-5.0.7.orig/man/autofs.conf.5.in
|
|
|
4d476f |
+++ autofs-5.0.7/man/autofs.conf.5.in
|
|
|
4d476f |
@@ -30,6 +30,11 @@ default is 10 minutes, but the default i
|
|
|
4d476f |
overrides this and sets the timeout to 5 minutes to be consistent
|
|
|
4d476f |
with earlier autofs releases.
|
|
|
4d476f |
.TP
|
|
|
4d476f |
+.B master_wait
|
|
|
4d476f |
+sets the default maximum time to wait for the master map to become
|
|
|
4d476f |
+available if it cannot be read at program start (program default -1,
|
|
|
4d476f |
+wait forever).
|
|
|
4d476f |
+.TP
|
|
|
4d476f |
.B negative_timeout
|
|
|
4d476f |
.br
|
|
|
4d476f |
Set the default timeout for caching failed key lookups (program default
|
|
|
4d476f |
--- autofs-5.0.7.orig/man/automount.8
|
|
|
4d476f |
+++ autofs-5.0.7/man/automount.8
|
|
|
4d476f |
@@ -37,6 +37,10 @@ The internal program default is 10 minut
|
|
|
4d476f |
installed configuration overrides this and sets the timeout
|
|
|
4d476f |
to 5 minutes to be consistent with earlier autofs releases.
|
|
|
4d476f |
.TP
|
|
|
4d476f |
+.I "\-M <seconds>, \-\-master-wait <seconds>"
|
|
|
4d476f |
+Set the maximum time to wait for the master map to become available
|
|
|
4d476f |
+if it cannot be read at program start.
|
|
|
4d476f |
+.TP
|
|
|
4d476f |
.I "\-n <seconds>, \-\-negative\-timeout <seconds>"
|
|
|
4d476f |
Set the default timeout for caching failed key lookups. The default is 60 seconds.
|
|
|
4d476f |
.TP
|
|
|
4d476f |
--- autofs-5.0.7.orig/redhat/autofs.conf.default.in
|
|
|
4d476f |
+++ autofs-5.0.7/redhat/autofs.conf.default.in
|
|
|
4d476f |
@@ -14,6 +14,13 @@
|
|
|
4d476f |
#
|
|
|
4d476f |
timeout = 300
|
|
|
4d476f |
#
|
|
|
4d476f |
+# master_wait - set the default maximum time to wait for the
|
|
|
4d476f |
+# master map to become available if it cannot
|
|
|
4d476f |
+# be read at program start (default -1, wait
|
|
|
4d476f |
+# forever).
|
|
|
4d476f |
+#
|
|
|
4d476f |
+#master_wait = -1
|
|
|
4d476f |
+#
|
|
|
4d476f |
# negative_timeout - set the default negative timeout for
|
|
|
4d476f |
# failed mount attempts (default 60).
|
|
|
4d476f |
#
|
|
|
4d476f |
--- autofs-5.0.7.orig/samples/autofs.conf.default.in
|
|
|
4d476f |
+++ autofs-5.0.7/samples/autofs.conf.default.in
|
|
|
4d476f |
@@ -14,6 +14,13 @@
|
|
|
4d476f |
#
|
|
|
4d476f |
timeout = 300
|
|
|
4d476f |
#
|
|
|
4d476f |
+# master_wait - set the default maximum time to wait for the
|
|
|
4d476f |
+# master map to become available if it cannot
|
|
|
4d476f |
+# be read at program start (default -1, wait
|
|
|
4d476f |
+# forever).
|
|
|
4d476f |
+#
|
|
|
4d476f |
+# master_wait = -1
|
|
|
4d476f |
+#
|
|
|
4d476f |
# negative_timeout - set the default negative timeout for
|
|
|
4d476f |
# failed mount attempts (default 60).
|
|
|
4d476f |
#
|