From: Ian Kent <raven@themaw.net>
To: autofs mailing list <autofs@vger.kernel.org>
Subject: [PATCH 24/37] autofs-5.1.2 - add master read wait option
Date: Tue, 25 Oct 2016 09:19:33 +0800 [thread overview]
Message-ID: <20161025011932.7778.57328.stgit@pluto.themaw.net> (raw)
In-Reply-To: <20161025010014.7778.69274.stgit@pluto.themaw.net>
Add command line and configuration options to set the amount of time to
wait for the master map to become available at program start.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
daemon/automount.c | 11 +++++++++--
include/defaults.h | 2 ++
lib/defaults.c | 17 +++++++++++++++++
man/autofs.conf.5.in | 5 +++++
man/automount.8 | 4 ++++
redhat/autofs.conf.default.in | 7 +++++++
samples/autofs.conf.default.in | 7 +++++++
8 files changed, 52 insertions(+), 2 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index d1bc1e1..576f52a 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -21,6 +21,7 @@ xx/xx/2016 autofs-5.1.3
- fix create_client() RPC client handling.
- update and add README for old autofs schema.
- wait for master map available at start.
+- add master read wait option.
15/06/2016 autofs-5.1.2
=======================
diff --git a/daemon/automount.c b/daemon/automount.c
index 14af9ff..72c980e 100644
--- a/daemon/automount.c
+++ b/daemon/automount.c
@@ -2103,10 +2103,11 @@ int main(int argc, char *argv[])
unsigned ghost, logging, daemon_check;
unsigned dumpmaps, foreground, have_global_options;
unsigned master_read;
+ int master_wait;
time_t timeout;
time_t age = monotonic_time(NULL);
struct rlimit rlim;
- const char *options = "+hp:t:vmdD:fVrO:l:n:CF";
+ const char *options = "+hp:t:vmdD:fVrO:l:n:CFM";
static const struct option long_options[] = {
{"help", 0, 0, 'h'},
{"pid-file", 1, 0, 'p'},
@@ -2123,6 +2124,7 @@ int main(int argc, char *argv[])
{"set-log-priority", 1, 0, 'l'},
{"dont-check-daemon", 0, 0, 'C'},
{"force", 0, 0, 'F'},
+ {"master-wait", 1, 0, 'M'},
{0, 0, 0, 0}
};
@@ -2143,6 +2145,7 @@ int main(int argc, char *argv[])
nfs_mount_uses_string_options = check_nfs_mount_version(&vers, &check);
kpkt_len = get_kpkt_len();
+ master_wait = defaults_get_master_wait();
timeout = defaults_get_timeout();
ghost = defaults_get_browse_mode();
logging = defaults_get_logging();
@@ -2202,6 +2205,10 @@ int main(int argc, char *argv[])
dumpmaps = 1;
break;
+ case 'M':
+ master_wait = getnumopt(optarg, opt);
+ break;
+
case 'O':
if (!have_global_options) {
global_options = strdup(optarg);
@@ -2525,7 +2532,7 @@ int main(int argc, char *argv[])
* a signal is received, in which case exit returning an
* error.
*/
- if (!do_master_read_master(master_list, -1)) {
+ if (!do_master_read_master(master_list, master_wait)) {
logerr("%s: failed to read master map!", program);
master_kill(master_list);
release_flag_file();
diff --git a/include/defaults.h b/include/defaults.h
index 8db2bb1..80db18d 100644
--- a/include/defaults.h
+++ b/include/defaults.h
@@ -25,6 +25,7 @@
#define DEFAULT_MASTER_MAP_NAME "auto.master"
#define DEFAULT_TIMEOUT "600"
+#define DEFAULT_MASTER_WAIT "-1"
#define DEFAULT_NEGATIVE_TIMEOUT "60"
#define DEFAULT_MOUNT_WAIT "-1"
#define DEFAULT_UMOUNT_WAIT "12"
@@ -152,6 +153,7 @@ void defaults_conf_release(void);
const char *defaults_get_master_map(void);
int defaults_master_set(void);
unsigned int defaults_get_timeout(void);
+int defaults_get_master_wait(void);
unsigned int defaults_get_negative_timeout(void);
unsigned int defaults_get_browse_mode(void);
unsigned int defaults_get_logging(void);
diff --git a/lib/defaults.c b/lib/defaults.c
index ae76513..5fa4a2b 100644
--- a/lib/defaults.c
+++ b/lib/defaults.c
@@ -48,6 +48,7 @@
#define NAME_MASTER_MAP "master_map_name"
#define NAME_TIMEOUT "timeout"
+#define NAME_MASTER_WAIT "master_wait"
#define NAME_NEGATIVE_TIMEOUT "negative_timeout"
#define NAME_BROWSE_MODE "browse_mode"
#define NAME_LOGGING "logging"
@@ -288,6 +289,11 @@ static int conf_load_autofs_defaults(void)
if (ret == CFG_FAIL)
goto error;
+ ret = conf_update(sec, NAME_MASTER_WAIT,
+ DEFAULT_MASTER_WAIT, CONF_ENV);
+ if (ret == CFG_FAIL)
+ goto error;
+
ret = conf_update(sec, NAME_NEGATIVE_TIMEOUT,
DEFAULT_NEGATIVE_TIMEOUT, CONF_ENV);
if (ret == CFG_FAIL)
@@ -1569,6 +1575,17 @@ unsigned int defaults_get_timeout(void)
return (unsigned int) timeout;
}
+int defaults_get_master_wait(void)
+{
+ long wait;
+
+ wait = conf_get_number(autofs_gbl_sec, NAME_MASTER_WAIT);
+ if (wait < 0)
+ wait = atol(DEFAULT_MASTER_WAIT);
+
+ return (int) wait;
+}
+
unsigned int defaults_get_negative_timeout(void)
{
long n_timeout;
diff --git a/man/autofs.conf.5.in b/man/autofs.conf.5.in
index 4405ac8..466db10 100644
--- a/man/autofs.conf.5.in
+++ b/man/autofs.conf.5.in
@@ -30,6 +30,11 @@ default is 10 minutes, but the default installed configuration
overrides this and sets the timeout to 5 minutes to be consistent
with earlier autofs releases.
.TP
+.B master_wait
+sets the default maximum time to wait for the master map to become
+available if it cannot be read at program start (program default -1,
+wait forever).
+.TP
.B negative_timeout
.br
Set the default timeout for caching failed key lookups (program default
diff --git a/man/automount.8 b/man/automount.8
index d1db4ec..601c18c 100644
--- a/man/automount.8
+++ b/man/automount.8
@@ -37,6 +37,10 @@ The internal program default is 10 minutes, but the default
installed configuration overrides this and sets the timeout
to 5 minutes to be consistent with earlier autofs releases.
.TP
+.I "\-M <seconds>, \-\-master-wait <seconds>"
+Set the maximum time to wait for the master map to become available
+if it cannot be read at program start.
+.TP
.I "\-n <seconds>, \-\-negative\-timeout <seconds>"
Set the default timeout for caching failed key lookups. The default is 60 seconds.
.TP
diff --git a/redhat/autofs.conf.default.in b/redhat/autofs.conf.default.in
index d114249..2fa8a4c 100644
--- a/redhat/autofs.conf.default.in
+++ b/redhat/autofs.conf.default.in
@@ -14,6 +14,13 @@
#
timeout = 300
#
+# master_wait - set the default maximum time to wait for the
+# master map to become available if it cannot
+# be read at program start (default -1, wait
+# forever).
+#
+#master_wait = -1
+#
# negative_timeout - set the default negative timeout for
# failed mount attempts (default 60).
#
diff --git a/samples/autofs.conf.default.in b/samples/autofs.conf.default.in
index bc25f52..77c5999 100644
--- a/samples/autofs.conf.default.in
+++ b/samples/autofs.conf.default.in
@@ -14,6 +14,13 @@
#
timeout = 300
#
+# master_wait - set the default maximum time to wait for the
+# master map to become available if it cannot
+# be read at program start (default -1, wait
+# forever).
+#
+# master_wait = -1
+#
# negative_timeout - set the default negative timeout for
# failed mount attempts (default 60).
#
--
To unsubscribe from this list: send the line "unsubscribe autofs" in
next prev parent reply other threads:[~2016-10-25 1:19 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-25 1:17 [PATCH 00/37] Current patch queue for review Ian Kent
2016-10-25 1:17 ` [PATCH 01/37] autofs-5.1.2 - fix release date in CHANGELOG Ian Kent
2016-10-25 1:17 ` [PATCH 02/37] autofs-5.1.2 - build: check for clock_gettime in librt Ian Kent
2016-10-25 1:17 ` [PATCH 03/37] autofs-5.1.2 - Fix compiler warning in try_remount() Ian Kent
2016-10-25 1:17 ` [PATCH 04/37] autofs-5.1.2 - Drop redundant \n in logerr() Ian Kent
2016-10-25 1:17 ` [PATCH 05/37] autofs-5.1.2 - Fix size arg of fgets(3) Ian Kent
2016-10-25 1:17 ` [PATCH 06/37] autofs-5.1.2 - fix libtirpc detection with -Wl, --as-needed Ian Kent
2016-10-25 1:18 ` [PATCH 07/37] autofs-5.1.2 - Fix a typo in CREDITS Ian Kent
2016-10-25 1:18 ` [PATCH 08/37] autofs-5.1.2 - Change .requestor to .requester for consistency Ian Kent
2016-10-25 1:18 ` [PATCH 09/37] autofs-5.1.2 - fix file map changed check Ian Kent
2016-10-25 1:18 ` [PATCH 10/37] autofs-5.1.2 - Remove unused local 2KB buffer Ian Kent
2016-10-25 1:18 ` [PATCH 11/37] autofs-5.1.2 - Fix typos in error messages Ian Kent
2016-10-25 1:18 ` [PATCH 12/37] autofs-5.1.2 - Fix fgets(3) size argument (another one) Ian Kent
2016-10-25 1:18 ` [PATCH 13/37] autofs-5.1.2 - fix short memory allocation in lookup_amd_instance() Ian Kent
2016-10-25 1:18 ` [PATCH 14/37] autofs-5.1.2 - fix count_mounts() function Ian Kent
2016-10-25 1:18 ` [PATCH 15/37] autofs-5.1.2 - configure: add cache variable for Linux proc filesystem check Ian Kent
2016-10-25 1:18 ` [PATCH 16/37] autofs-5.1.2 - Avoid local variable name shadowing another Ian Kent
2016-10-25 1:18 ` [PATCH 17/37] autofs-5.1.2 - fix typo in MOUNT_FLAG_GHOST comment Ian Kent
2016-10-25 1:19 ` [PATCH 18/37] autofs-5.1.2 - fix cachefs parse message not being logged Ian Kent
2016-10-25 1:19 ` [PATCH 19/37] autofs-5.1.2 - fix argc off by one in mount_autofs.c Ian Kent
2016-10-25 1:19 ` [PATCH 20/37] autofs-5.1.2 - fix _strncmp() usage Ian Kent
2016-10-25 1:19 ` [PATCH 21/37] autofs-5.1.1 - fix create_client() RPC client handling Ian Kent
2016-10-25 1:19 ` [PATCH 22/37] autofs-5.1.2 - update and add README for old autofs schema Ian Kent
2016-10-25 1:19 ` [PATCH 23/37] autofs-5.1.2 - wait for master map available at start Ian Kent
2016-10-25 1:19 ` Ian Kent [this message]
2016-10-25 1:19 ` [PATCH 25/37] autofs-5.1.2 - work around sss startup delay Ian Kent
2016-10-25 1:19 ` [PATCH 26/37] autofs-5.1.2 - add sss master map wait config option Ian Kent
2016-10-25 1:19 ` [PATCH 27/37] autofs-5.1.2 - fix typos in README.amd-maps Ian Kent
2016-10-25 1:19 ` [PATCH 28/37] autofs-5.1.2 - add ref counting to struct map_source Ian Kent
2016-10-25 1:19 ` [PATCH 29/37] autofs-5.1.2 - add support for amd browsable option Ian Kent
2016-10-25 1:20 ` [PATCH 30/37] autofs-5.1.2 - add function conf_amd_get_map_name() Ian Kent
2016-10-25 1:20 ` [PATCH 31/37] autofs-5.1.2 - add function conf_amd_get_mount_paths() Ian Kent
2016-10-25 1:20 ` [PATCH 32/37] autofs-5.1.2 - include amd mount section mounts in master mounts list Ian Kent
2016-10-25 1:20 ` [PATCH 33/37] autofs-5.1.2 - check for conflicting amd section mounts Ian Kent
2016-10-25 1:20 ` [PATCH 34/37] autofs-5.1.2 - add function conf_get_map_options() Ian Kent
2016-10-25 1:20 ` [PATCH 35/37] autofs-5.1.2 - capture cache option and its settings during parsing Ian Kent
2016-10-25 1:20 ` [PATCH 36/37] autofs-5.1.2 - handle map_option cache for top level mounts Ian Kent
2016-10-25 1:20 ` [PATCH 37/37] autofs-5.1.2 - handle amd cache option all in amd type auto mounts Ian Kent
2016-11-04 8:53 ` [PATCH 00/37] Current patch queue for review Ian Kent
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161025011932.7778.57328.stgit@pluto.themaw.net \
--to=raven@themaw.net \
--cc=autofs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.