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

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