Blame SOURCES/autofs-5.1.1-change-lookup-to-use-reinit-instead-of-reopen.patch

4d476f
autofs-5.1.1 - change lookup to use reinit instead of reopen
4d476f
4d476f
From: Ian Kent <raven@themaw.net>
4d476f
4d476f
When a HUP signal is received lookup module are cloed and then re-opened.
4d476f
This can occassionally cause a problem with library data segemets and
4d476f
lead to a SEGV.
4d476f
4d476f
Signed-off-by: Ian Kent <raven@themaw.net>
4d476f
---
4d476f
 CHANGELOG       |    1 +
4d476f
 daemon/lookup.c |   32 +++++++++++++++++++++-----------
4d476f
 2 files changed, 22 insertions(+), 11 deletions(-)
4d476f
4d476f
--- autofs-5.0.7.orig/CHANGELOG
4d476f
+++ autofs-5.0.7/CHANGELOG
4d476f
@@ -195,6 +195,7 @@
4d476f
 - fix gcc5 complaints.
4d476f
 - fix missing source sss in multi map lookup.
4d476f
 - fix update_hosts_mounts() return.
4d476f
+- change lookup to use reinit instead of reopen.
4d476f
 
4d476f
 25/07/2012 autofs-5.0.7
4d476f
 =======================
4d476f
--- autofs-5.0.7.orig/daemon/lookup.c
4d476f
+++ autofs-5.0.7/daemon/lookup.c
4d476f
@@ -300,17 +300,27 @@ static int do_read_map(struct autofs_poi
4d476f
 	struct lookup_mod *lookup;
4d476f
 	int status;
4d476f
 
4d476f
-	status = open_lookup(map->type, "", map->format,
4d476f
-			     map->argc, map->argv, &lookup);
4d476f
-	if (status != NSS_STATUS_SUCCESS) {
4d476f
-		debug(ap->logopt, "lookup module %s failed", map->type);
4d476f
-		return status;
4d476f
-	}
4d476f
-
4d476f
+	lookup = NULL;
4d476f
 	master_source_writelock(ap->entry);
4d476f
-	if (map->lookup)
4d476f
-		close_lookup(map->lookup);
4d476f
-	map->lookup = lookup;
4d476f
+	if (!map->lookup) {
4d476f
+		status = open_lookup(map->type, "", map->format,
4d476f
+				     map->argc, map->argv, &lookup);
4d476f
+		if (status != NSS_STATUS_SUCCESS) {
4d476f
+			master_source_unlock(ap->entry);
4d476f
+			debug(ap->logopt,
4d476f
+			      "lookup module %s open failed", map->type);
4d476f
+			return status;
4d476f
+		}
4d476f
+		map->lookup = lookup;
4d476f
+	} else {
4d476f
+		lookup = map->lookup;
4d476f
+		status = lookup->lookup_reinit(map->format,
4d476f
+					       map->argc, map->argv,
4d476f
+					       &lookup->context);
4d476f
+		if (status)
4d476f
+			warn(ap->logopt,
4d476f
+			     "lookup module %s reinit failed", map->type);
4d476f
+	}
4d476f
 	master_source_unlock(ap->entry);
4d476f
 
4d476f
 	if (!map->stale)
4d476f
@@ -742,7 +752,7 @@ int do_lookup_mount(struct autofs_point
4d476f
 				     map->format, map->argc, map->argv, &lookup);
4d476f
 		if (status != NSS_STATUS_SUCCESS) {
4d476f
 			debug(ap->logopt,
4d476f
-			      "lookup module %s failed", map->type);
4d476f
+			      "lookup module %s open failed", map->type);
4d476f
 			return status;
4d476f
 		}
4d476f
 		map->lookup = lookup;