You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

173 lines
5.8 KiB

autofs-5.1.2 - add sss master map wait config option
From: Ian Kent <raven@themaw.net>
When sssd is starting up it can sometimes return "no such entry" for a
short time until it has read in the LDAP map information. This affects
reading the master map at autofs startup and results in no automount
mounts if sssd is the primary map source.
This problem should be resolved in sssd but it's a problem for the
moment so a configuration option, sss_master_map_wait, has been added
to work around it.
The internal program default is 0, don't wait. If the work around is
needed try setting this to 10 seconds to work around it.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
include/defaults.h | 2 ++
lib/defaults.c | 17 +++++++++++++++++
man/autofs.conf.5.in | 7 +++++++
modules/lookup_sss.c | 7 ++++---
redhat/autofs.conf.default.in | 10 ++++++++++
samples/autofs.conf.default.in | 10 ++++++++++
7 files changed, 51 insertions(+), 3 deletions(-)
--- autofs-5.0.7.orig/CHANGELOG
+++ autofs-5.0.7/CHANGELOG
@@ -241,6 +241,7 @@
- factor out set_thread_mount_request_log_id().
- add config option to use mount request log id.
- work around sss startup delay.
+- add sss master map wait config option.
25/07/2012 autofs-5.0.7
=======================
--- autofs-5.0.7.orig/include/defaults.h
+++ autofs-5.0.7/include/defaults.h
@@ -51,6 +51,7 @@
#define DEFAULT_USE_HOSTNAME_FOR_MOUNTS "0"
#define DEFAULT_DISABLE_NOT_FOUND_MESSAGE "0"
+#define DEFAULT_SSS_MASTER_MAP_WAIT "0"
#define DEFAULT_USE_MOUNT_REQUEST_LOG_ID "0"
/* Config entry flags */
@@ -171,6 +172,7 @@ const char *defaults_get_auth_conf_file(
unsigned int defaults_get_map_hash_table_size(void);
unsigned int defaults_use_hostname_for_mounts(void);
unsigned int defaults_disable_not_found_message(void);
+unsigned int defaults_get_sss_master_map_wait(void);
unsigned int defaults_get_use_mount_request_log_id(void);
unsigned int conf_amd_mount_section_exists(const char *);
--- autofs-5.0.7.orig/lib/defaults.c
+++ autofs-5.0.7/lib/defaults.c
@@ -76,6 +76,7 @@
#define NAME_USE_HOSTNAME_FOR_MOUNTS "use_hostname_for_mounts"
#define NAME_DISABLE_NOT_FOUND_MESSAGE "disable_not_found_message"
+#define NAME_SSS_MASTER_MAP_WAIT "sss_master_map_wait"
#define NAME_USE_MOUNT_REQUEST_LOG_ID "use_mount_request_log_id"
#define NAME_AMD_ARCH "arch"
@@ -356,6 +357,11 @@ static int conf_load_autofs_defaults(voi
if (ret == CFG_FAIL)
goto error;
+ ret = conf_update(sec, NAME_SSS_MASTER_MAP_WAIT,
+ DEFAULT_SSS_MASTER_MAP_WAIT, CONF_ENV);
+ if (ret == CFG_FAIL)
+ goto error;
+
ret = conf_update(sec, NAME_USE_MOUNT_REQUEST_LOG_ID,
DEFAULT_USE_MOUNT_REQUEST_LOG_ID, CONF_ENV);
if (ret == CFG_FAIL)
@@ -1850,6 +1856,17 @@ unsigned int defaults_get_use_mount_requ
return res;
}
+
+unsigned int defaults_get_sss_master_map_wait(void)
+{
+ int res;
+
+ res = conf_get_yesno(autofs_gbl_sec, NAME_SSS_MASTER_MAP_WAIT);
+ if (res < 0)
+ res = atoi(DEFAULT_SSS_MASTER_MAP_WAIT);
+
+ return res;
+}
unsigned int conf_amd_mount_section_exists(const char *section)
{
--- autofs-5.0.7.orig/man/autofs.conf.5.in
+++ autofs-5.0.7/man/autofs.conf.5.in
@@ -142,6 +142,13 @@ That produces, IMHO, unnecessary noise i
has been added to provide the ability to turn it off. The default is "no"
to maintain the current behaviour.
.TP
+.B sss_master_map_wait
+.br
+Set the time to wait and retry if sssd returns "no such entry" when starting
+up. When sssd is starting up it can sometimes return "no such entry" for a
+short time until it has read in the LDAP map information. Default is 0 seconds,
+don't wait.
+.TP
.B use_mount_request_log_id
.br
Set whether to use a mount request log id so that log entries for specific
--- autofs-5.0.7.orig/modules/lookup_sss.c
+++ autofs-5.0.7/modules/lookup_sss.c
@@ -32,8 +32,6 @@
/* Half a second between retries */
#define SETAUTOMOUNTENT_MASTER_INTERVAL 500000000
-/* Try for 10 seconds */
-#define SETAUTOMOUNTENT_MASTER_RETRIES 10 * 2
#define MODPREFIX "lookup(sss): "
@@ -304,7 +302,10 @@ int lookup_read_master(struct master *ma
if (ret != ENOENT)
return NSS_STATUS_UNAVAIL;
- retries = SETAUTOMOUNTENT_MASTER_RETRIES;
+ retries = defaults_get_sss_master_map_wait() * 2;
+ if (retries <= 0)
+ return NSS_STATUS_NOTFOUND;
+
ret = setautomntent_wait(logopt,
ctxt, ctxt->mapname, &sss_ctxt,
retries);
--- autofs-5.0.7.orig/redhat/autofs.conf.default.in
+++ autofs-5.0.7/redhat/autofs.conf.default.in
@@ -173,6 +173,16 @@ mount_nfs_default_protocol = 4
#
#disable_not_found_message = "no"
#
+# sss_master_map_wait - When sssd is starting up it can sometimes return
+# "no such entry" for a short time until it has read
+# in the LDAP map information. Internal default is 0
+# seconds, don't wait but if there is a problem with
+# autofs not finding the master map at startup (when
+# it should) then try setting this to 10 to work
+# around it.
+#
+#sss_master_map_wait = 0
+#
# Otions for the amd parser within autofs.
#
# amd configuration options that are aren't used, haven't been
--- autofs-5.0.7.orig/samples/autofs.conf.default.in
+++ autofs-5.0.7/samples/autofs.conf.default.in
@@ -172,6 +172,16 @@ browse_mode = no
#
#disable_not_found_message = "no"
#
+# sss_master_map_wait - When sssd is starting up it can sometimes return
+# "no such entry" for a short time until it has read
+# in the LDAP map information. Internal default is 0
+# seconds, don't wait but if there is a problem with
+# autofs not finding the master map at startup (when
+# it should) then try setting this to 10 to work
+# around it.
+#
+#sss_master_map_wait = 0
+#
# Otions for the amd parser within autofs.
#
# amd configuration options that are aren't used, haven't been