Blame SOURCES/autofs-5.1.2-add-sss-master-map-wait-config-option.patch

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